/* ===== Control de Peso — estilos ===== */

:root {
    --bg: #1b1b1b;
    --bg-card: #242424;
    --bg-input: #2c2c2c;
    --border: #383838;
    --text: #ffffff;
    --muted: #a3a3a3;
    --accent: #8b7cf6;
    --accent-dark: #7161e0;
    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
}

body {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .btn, .brand, .logout-link, .stat-value, .result-badge {
    font-family: 'Montserrat', sans-serif;
}

h1 { font-size: 1.8rem; font-weight: 800; margin: 0 0 0.4rem; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.5rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); font-size: 0.92rem; }

/* ---------- Layout ---------- */

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.9rem 1.25rem;
    background: #202020;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
}
.brand:hover { text-decoration: none; opacity: 0.85; }

.topnav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.92rem;
    flex-wrap: wrap;
}

.topnav a { color: var(--text); }
.topnav a:hover { color: var(--accent); text-decoration: none; }
.topnav-user { color: var(--muted); }
.logout-link { color: var(--muted) !important; }

/* ---------- Hero (landing) ---------- */

.hero {
    text-align: center;
    padding: 3.5rem 1rem 2rem;
}
.hero-title { font-size: 2.4rem; }
.hero-subtitle { color: var(--muted); max-width: 420px; margin: 0 auto 2rem; }
.hero-actions { display: flex; flex-direction: column; gap: 0.9rem; max-width: 320px; margin: 0 auto; }
.hero-credit { color: var(--muted); font-size: 0.82rem; margin-top: 2.5rem; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    padding: 0.7rem 1.3rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-big { padding: 0.95rem 1.5rem; font-size: 1.05rem; }
.btn-full { width: 100%; margin-top: 0.5rem; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.5rem;
}
.btn-icon:hover { color: var(--danger); }

/* ---------- Cards ---------- */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.1rem;
}

/* ---------- Forms ---------- */

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    max-width: 460px;
    margin: 1.5rem auto;
}

.form-row { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.form-row label { font-size: 0.88rem; color: var(--muted); font-weight: 500; }
.form-row-group { display: flex; gap: 0.9rem; }
.form-row-group .form-row { flex: 1; }

.form-row-inline { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.form-row-inline .form-row { flex: 1; min-width: 140px; margin-bottom: 0; }
.form-row-inline .btn { height: 42px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    font-size: 0.98rem;
    font-family: inherit;
    width: 100%;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

.radio-group { display: flex; gap: 0.75rem; }
.radio-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.92rem;
}
.radio-pill:has(input:checked) { border-color: var(--accent); color: var(--accent); }

.hint { font-size: 0.8rem; color: var(--muted); margin: 0.35rem 0 0; }

.switch-link { text-align: center; margin-top: 1.25rem; font-size: 0.92rem; color: var(--muted); }

/* ---------- Flash messages ---------- */

.flash {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}
.flash ul { margin: 0; padding-left: 1.1rem; }
.flash-error { background: var(--danger-bg); border: 1px solid var(--danger); color: #ffb4b4; }
.flash-success { background: var(--success-bg); border: 1px solid var(--success); color: #bdf5cf; }

/* ---------- Daily summary ---------- */

.summary-numbers { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.summary-stat { display: flex; flex-direction: column; }
.stat-label { color: var(--muted); font-size: 0.82rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-value small { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.stat-value-sm { display: block; font-size: 1.1rem; font-weight: 700; font-family: 'Montserrat', sans-serif; }

.progress-bar {
    height: 10px;
    background: var(--bg-input);
    border-radius: 999px;
    overflow: hidden;
    margin: 0.5rem 0 1.1rem;
}
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s ease; }
.progress-bar-fill.over { background: var(--danger); }
.progress-bar-goal .progress-bar-fill { background: var(--success); }

.result-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}
.result-deficit { background: var(--success-bg); color: var(--success); }
.result-surplus { background: var(--danger-bg); color: var(--danger); }
.result-amount { font-size: 1.05rem; }

/* ---------- Food list ---------- */

.food-form .form-row-inline .btn { flex: 0 0 auto; }
.list-title { border-top: 1px solid var(--border); padding-top: 1rem; }
.list-total { text-align: right; margin-top: 0.6rem; }
.list-total strong { color: var(--text); }
.summary-note { margin-top: -0.4rem; margin-bottom: 0.6rem; }

.food-list { list-style: none; margin: 0; padding: 0; }
.food-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.food-list li:last-child { border-bottom: none; }
.food-desc { flex: 1; }
.food-kcal { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.inline-form { display: inline; }

/* ---------- Progress page ---------- */

.goal-stats { display: flex; justify-content: space-between; text-align: center; margin-bottom: 1rem; }
.goal-note { margin-top: 0.6rem; }
.chart-wrap { position: relative; height: 220px; margin-top: 1.1rem; }

.center-link { text-align: center; margin-top: 1.5rem; }

/* ---------- Responsive (desktop) ---------- */

@media (min-width: 720px) {
    .page { max-width: 900px; padding-top: 2rem; }
    .hero { padding-top: 5rem; }
    .hero-actions { flex-direction: row; max-width: none; justify-content: center; }
}
