@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');
@import url('variables.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; color: var(--text); }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
p { margin-bottom: 1rem; }
ul, ol { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* --- Container --- */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* --- Nav --- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  transition: box-shadow var(--transition);
}
.nav.scrolled { box-shadow: var(--shadow); }
.nav-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}
.nav-logo {
  font-family: var(--font-heading); font-weight: 800; font-size: 1.4rem;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.nav-logo span { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a {
  font-size: 0.95rem; font-weight: 500; color: var(--text-secondary);
  transition: color var(--transition); position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
  height: 2px; background: var(--primary); border-radius: 1px;
}
.nav-cta {
  background: var(--primary) !important; color: var(--white) !important;
  padding: 10px 24px !important; border-radius: var(--radius-full) !important;
  font-weight: 600 !important; font-size: 0.9rem !important;
  transition: all var(--transition) !important;
}
.nav-cta:hover { background: var(--primary-hover) !important; transform: translateY(-1px); box-shadow: var(--shadow-md) !important; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle svg { width: 24px; height: 24px; color: var(--text); }

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-height); left: 0; right: 0;
    flex-direction: column; background: var(--white); padding: 24px;
    border-bottom: 1px solid var(--border); gap: 16px;
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1.1rem; padding: 8px 0; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 32px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 1rem; border: none; cursor: pointer;
  transition: all var(--transition); min-height: 48px;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); color: var(--white); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-secondary:hover { background: var(--secondary-hover); color: var(--white); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--text); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: var(--primary-light); color: var(--primary-dark); }
.btn-ghost:hover { background: var(--primary); color: var(--white); }
.btn-sm { padding: 10px 20px; font-size: 0.9rem; min-height: 40px; }
.btn-lg { padding: 18px 40px; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* --- Cards --- */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 24px; transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-flat { box-shadow: none; }
.card-flat:hover { transform: none; }
.card-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 1.4rem;
}
.card-icon.green { background: var(--primary-light); color: var(--primary); }
.card-icon.orange { background: var(--secondary-light); color: var(--secondary); }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.card-text { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }

/* --- Hero --- */
.hero {
  padding: calc(var(--nav-height) + 60px) 0 80px;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--bg) 0%, var(--primary-light) 50%, var(--bg-alt) 100%);
}
.hero-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white); padding: 8px 16px; border-radius: var(--radius-full);
  font-size: 0.85rem; font-weight: 500; color: var(--primary);
  border: 1px solid var(--primary-light); margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.hero h1 { margin-bottom: 20px; letter-spacing: -0.02em; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero-subtitle { font-size: 1.15rem; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.7; max-width: 520px; }
.hero-buttons { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-image { position: relative; }
.hero-image img {
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  width: 100%; height: 480px; object-fit: cover;
}
.hero-float {
  position: absolute; background: var(--white); padding: 16px 20px;
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 12px;
  font-size: 0.9rem; font-weight: 500; animation: float 3s ease-in-out infinite;
}
.hero-float.top { top: 20px; right: -20px; }
.hero-float.bottom { bottom: 40px; left: -20px; }
.hero-float-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

@media (max-width: 768px) {
  .hero { padding: calc(var(--nav-height) + 40px) 0 60px; }
  .hero-inner { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .hero-subtitle { margin: 0 auto 32px; }
  .hero-buttons { justify-content: center; }
  .hero-image img { height: 320px; }
  .hero-float { display: none; }
}

/* --- Sections --- */
.section { padding: 80px 0; }
.section-alt { background: var(--white); }
.section-header { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-header p { color: var(--text-secondary); margin-top: 12px; font-size: 1.05rem; }
.section-label {
  font-family: var(--font-heading); font-weight: 600; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--primary); margin-bottom: 12px;
}

/* --- Grid layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* --- Steps / How it works --- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; counter-reset: step; }
.step { text-align: center; position: relative; counter-increment: step; }
.step-number {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem;
  margin: 0 auto 16px; box-shadow: 0 4px 12px rgba(123,158,107,0.3);
}
.step h3 { font-size: 1rem; margin-bottom: 8px; }
.step p { font-size: 0.9rem; color: var(--text-secondary); }

/* --- Sport tags --- */
.sport-tags { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.sport-tag {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); padding: 16px 24px; border-radius: var(--radius-full);
  font-weight: 500; font-size: 0.95rem; border: 1px solid var(--border);
  transition: all var(--transition); cursor: default;
}
.sport-tag:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow); }
.sport-tag-icon { font-size: 1.3rem; }

/* --- CTA Banner --- */
.cta-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #5A8A4A 100%);
  border-radius: var(--radius-xl); padding: 60px 48px;
  text-align: center; color: var(--white); position: relative; overflow: hidden;
}
.cta-banner h2 { color: var(--white); margin-bottom: 16px; }
.cta-banner p { opacity: 0.9; font-size: 1.1rem; max-width: 500px; margin: 0 auto 32px; }
.cta-banner .btn { background: var(--white); color: var(--primary-dark); }
.cta-banner .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cta-banner::before {
  content: ''; position: absolute; top: -50%; right: -10%; width: 400px; height: 400px;
  border-radius: 50%; background: rgba(255,255,255,0.08);
}

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-weight: 500; font-size: 0.9rem;
  margin-bottom: 6px; color: var(--text);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--white);
  font-size: 1rem; color: var(--text); transition: all var(--transition);
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 40px; max-width: 520px; margin: 0 auto;
  border: 1px solid var(--border-light); box-shadow: var(--shadow);
}
.form-card h2 { text-align: center; margin-bottom: 8px; }
.form-card .form-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; }
.form-help { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { color: #DC3545; font-size: 0.85rem; margin-top: 4px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; }
.errorlist li { color: #DC3545; font-size: 0.85rem; }

/* --- Auth pages --- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--nav-height) + 40px) 20px 40px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--primary-light) 100%);
}
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.9rem; color: var(--text-secondary); }
.auth-footer a { color: var(--primary); font-weight: 500; }

/* --- Dashboard --- */
.dashboard { padding: calc(var(--nav-height) + 32px) 0 60px; }
.dashboard-header { margin-bottom: 32px; }
.dashboard-header h1 { font-size: 1.8rem; }
.dashboard-header p { color: var(--text-secondary); margin-top: 4px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; border: 1px solid var(--border-light);
  display: flex; align-items: flex-start; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 1.3rem;
}
.stat-icon.green { background: var(--primary-light); color: var(--primary); }
.stat-icon.orange { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.purple { background: #F0E8F5; color: var(--accent); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; }

.quick-actions { margin-top: 32px; }
.quick-actions h2 { font-size: 1.2rem; margin-bottom: 16px; }
.actions-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* --- Sidebar layout for private pages --- */
.private-layout { display: flex; min-height: 100vh; padding-top: var(--nav-height); }
.sidebar {
  width: 260px; background: var(--white); border-right: 1px solid var(--border-light);
  padding: 32px 0; position: fixed; top: var(--nav-height); bottom: 0;
  overflow-y: auto;
}
.sidebar-nav { padding: 0 16px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--radius); color: var(--text-secondary); font-weight: 500;
  font-size: 0.95rem; transition: all var(--transition); margin-bottom: 4px;
}
.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link.active { background: var(--primary-light); color: var(--primary-dark); }
.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-section { padding: 12px 32px 8px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.main-content { flex: 1; margin-left: 260px; padding: 32px; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
}

/* --- Tables --- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-light); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); text-align: left; padding: 12px 16px; }
td { padding: 14px 16px; border-top: 1px solid var(--border-light); font-size: 0.95rem; }
tr:hover td { background: var(--surface-hover); }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 600;
}
.badge-green { background: var(--primary-light); color: var(--primary-dark); }
.badge-orange { background: var(--secondary-light); color: var(--secondary); }
.badge-gray { background: var(--bg-alt); color: var(--text-secondary); }
.badge-purple { background: #F0E8F5; color: var(--accent); }

/* --- Notices --- */
.notice-card {
  display: flex; gap: 16px; padding: 20px; background: var(--surface);
  border-radius: var(--radius); border-left: 4px solid var(--primary);
  margin-bottom: 12px; align-items: flex-start;
}
.notice-card.motivacional { border-left-color: var(--secondary); }
.notice-card.recordatorio { border-left-color: var(--accent); }
.notice-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* --- Messages --- */
.message-item {
  display: flex; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  transition: background var(--transition); cursor: pointer;
}
.message-item:hover { background: var(--surface-hover); }
.message-item.unread { background: var(--primary-light); }
.message-item.unread:hover { background: #E4EDE0; }
.message-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 8px; flex-shrink: 0; }
.message-subject { font-weight: 600; margin-bottom: 2px; }
.message-preview { font-size: 0.9rem; color: var(--text-secondary); }
.message-time { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* --- Shopping list --- */
.shopping-category { margin-bottom: 24px; }
.shopping-category h3 { font-size: 1rem; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
.shopping-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
}
.shopping-item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.shopping-item.checked span { text-decoration: line-through; color: var(--text-muted); }
.shopping-qty { font-size: 0.85rem; color: var(--text-secondary); margin-left: auto; }

/* --- Adherence chips --- */
.adherence-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: var(--radius-full); font-weight: 500; font-size: 0.9rem;
  cursor: pointer; border: 2px solid var(--border); transition: all var(--transition);
}
.adherence-chip input { display: none; }
.adherence-chip.selected-si { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.adherence-chip.selected-regular { border-color: var(--secondary); background: var(--secondary-light); color: var(--secondary); }
.adherence-chip.selected-no { border-color: #E5484D; background: #FFF1F0; color: #CD2B31; }

/* --- Footer --- */
.footer {
  background: var(--text); color: rgba(255,255,255,0.7); padding: 48px 0 24px;
}
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer-brand { font-family: var(--font-heading); font-weight: 700; font-size: 1.3rem; color: var(--white); margin-bottom: 12px; }
.footer-brand span { color: var(--primary); }
.footer-desc { font-size: 0.9rem; max-width: 300px; line-height: 1.6; }
.footer h4 { color: var(--white); font-size: 0.9rem; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.05em; }
.footer a { color: rgba(255,255,255,0.6); font-size: 0.9rem; display: block; margin-bottom: 8px; transition: color var(--transition); }
.footer a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 24px; font-size: 0.85rem; text-align: center; }

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; gap: 32px; text-align: center; }
  .footer-desc { margin: 0 auto; }
}

/* --- Alerts / Messages (Django) --- */
.alerts { position: fixed; top: calc(var(--nav-height) + 12px); right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.alert {
  padding: 14px 20px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px; min-width: 300px; max-width: 420px;
  box-shadow: var(--shadow-md); animation: slideIn 0.3s ease;
}
.alert-success { background: var(--primary-light); color: var(--primary-dark); border: 1px solid var(--primary); }
.alert-error { background: #FFF1F0; color: #CD2B31; border: 1px solid #E5484D; }
.alert-info { background: #EDF5FF; color: #1D4E89; border: 1px solid #6BA3D6; }
.alert-close { margin-left: auto; cursor: pointer; opacity: 0.6; background: none; border: none; font-size: 1.2rem; color: inherit; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* --- Page transitions --- */
.page-enter { animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
