/* ═══ Aquiles — Fitness Coach ═══ */
/* Mobile-first, light background */

:root {
    --primary: #2c6b4f;
    --primary-light: #e8f5ed;
    --primary-dark: #1f5c3a;
    --danger: #c0392b;
    --danger-light: #fdecea;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #dee2e6;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(0,0,0,0.06);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh;
}

/* ═══ Navbar ═══ */
.navbar {
    display: flex; background: var(--card-bg); border-bottom: 1px solid var(--border);
    padding: 0 4px; position: sticky; top: 0; z-index: 100;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 10px; text-decoration: none; color: var(--text-muted);
    font-size: 0.7rem; font-weight: 500; border-bottom: 2px solid transparent;
    white-space: nowrap; transition: color 0.2s, border-color 0.2s;
}
.nav-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav-icon { font-size: 1.1rem; margin-bottom: 1px; }
.nav-logout { margin-left: auto; }

/* ═══ Layout ═══ */
.container { max-width: 640px; margin: 0 auto; padding: 12px; }
h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 12px; }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }

/* ═══ Cards ═══ */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* ═══ Upload zone ═══ */
.upload-zone {
    border: 2px dashed var(--border); text-align: center;
    padding: 28px 16px; cursor: pointer;
    transition: border-color 0.2s, background 0.2s; border-radius: 8px;
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-light); }

/* ═══ Login ═══ */
.login-container { max-width: 360px; margin: 60px auto; text-align: center; }
.login-container h1 { font-size: 2rem; color: var(--primary); margin-bottom: 4px; }
.subtitle { color: var(--text-muted); margin-bottom: 24px; }
.login-form {
    background: var(--card-bg); padding: 24px; border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border); text-align: left;
}

/* ═══ Forms ═══ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 4px; }
.form-group input, .form-group select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.95rem; transition: border-color 0.2s;
    background: var(--card-bg);
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row { display: flex; gap: 8px; align-items: end; }

/* ═══ Buttons ═══ */
.btn-primary {
    width: 100%; padding: 12px; background: var(--primary); color: white;
    border: none; border-radius: 6px; font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    padding: 8px 16px; background: var(--bg); color: var(--primary);
    border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
    cursor: pointer; transition: background 0.2s;
}
.btn-secondary:hover { background: var(--primary-light); }

.btn-icon {
    padding: 4px 8px; background: none; border: none; color: var(--text-muted);
    font-size: 1.1rem; cursor: pointer;
}
.btn-icon:hover { color: var(--danger); }

.serving-btn {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px;
    background: var(--card-bg); cursor: pointer; font-size: 0.9rem; font-weight: 500;
}
.serving-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ═══ Tables ═══ */
.ingredients-table {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.ingredients-table th {
    text-align: left; padding: 6px 4px; border-bottom: 2px solid var(--border);
    font-weight: 600; color: var(--text-muted); font-size: 0.75rem;
}
.ingredients-table td { padding: 4px; border-bottom: 1px solid var(--border); }
.ingredients-table input {
    width: 100%; padding: 4px 6px; border: 1px solid transparent;
    border-radius: 4px; font-size: 0.85rem; text-align: right; background: transparent;
}
.ingredients-table input:focus { border-color: var(--primary); background: var(--card-bg); outline: none; }
.ingredients-table input.name-input { text-align: left; }
.ingredients-table .total-row { font-weight: 700; border-top: 2px solid var(--border); }
.ingredients-table .total-row td { padding-top: 8px; }
.ingredients-table .total-row input { font-weight: 700; background: var(--primary-light); }

/* ═══ Exercise rows ═══ */
.exercise-row {
    display: flex; gap: 6px; align-items: center; margin-bottom: 6px;
}
.exercise-row input {
    padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.9rem;
}
.exercise-row input:focus { border-color: var(--primary); outline: none; }

/* ═══ Progress bars ═══ */
.progress-bar {
    height: 8px; background: #e9ecef; border-radius: 4px; margin: 4px 0; overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 4px; transition: width 0.3s;
}
.progress-green { background: #27ae60; }
.progress-yellow { background: #f39c12; }
.progress-red { background: #e74c3c; }

.macro-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; font-size: 0.9rem;
}
.macro-label { display: flex; align-items: center; gap: 6px; }
.macro-values { font-weight: 600; font-size: 0.85rem; }

/* ═══ History ═══ */
.meal-item, .training-item {
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.meal-item:last-child, .training-item:last-child { border-bottom: none; }
.meal-time, .training-date { color: var(--text-muted); font-size: 0.8rem; }

/* ═══ KPI Grid ═══ */
.kpi-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.kpi-item {
    text-align: center; padding: 10px 4px;
    background: var(--bg); border-radius: 8px;
}
.kpi-icon { font-size: 1.2rem; display: block; margin-bottom: 2px; }
.kpi-value { font-size: 1.1rem; font-weight: 700; display: block; }
.kpi-label { font-size: 0.7rem; color: var(--text-muted); }

/* ═══ Volume Chart ═══ */
.volume-chart { margin-top: 4px; }
.chart-bars {
    display: flex; align-items: flex-end; gap: 12px;
    height: 80px; padding: 0 4px;
}
.chart-bar-col {
    flex: 1; display: flex; flex-direction: column; align-items: center;
}
.chart-bar {
    width: 100%; max-width: 36px; min-height: 2px;
    background: var(--primary-light); border-radius: 4px 4px 0 0;
    transition: height 0.3s;
}
.chart-bar-current { background: var(--primary); }
.chart-label {
    font-size: 0.65rem; color: var(--text-muted); margin-top: 4px;
    white-space: nowrap;
}

/* ═══ Session exercises ═══ */
.session-exercise { }
.set-row input:focus, .set-row select:focus {
    border-color: var(--primary); outline: none;
}

/* ═══ Plan exercise ═══ */
.plan-exercise:last-child { border-bottom: none !important; }


/* ═══ Alerts ═══ */
.alert {
    padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem;
}
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #f5c6cb; }

/* ═══ Toast ═══ */
.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 8px; color: white; font-weight: 600;
    z-index: 1000; transition: opacity 0.3s; font-size: 0.9rem;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }
.toast.hidden { opacity: 0; pointer-events: none; }

/* ═══ Hidden ═══ */
.hidden { display: none !important; }

/* ═══ Spinner ═══ */
.spinner {
    display: inline-block; width: 24px; height: 24px;
    border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Utils ═══ */
.text-muted { color: var(--text-muted); font-size: 0.9rem; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }

/* ═══ Desktop ═══ */
@media (min-width: 768px) {
    .nav-item { flex-direction: row; gap: 5px; padding: 10px 18px; font-size: 0.82rem; }
    .nav-icon { font-size: 1rem; margin-bottom: 0; }
    .container { padding: 20px; }
}
