/* === Fitness Tracker — Dark Theme === */

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-card-hover: #222636;
    --border: #2a2d3a;
    --text: #e1e4ed;
    --text-muted: #7b8192;
    --accent: #4ade80;
    --accent-dim: #3a9d5f;
    --red: #f87171;
    --orange: #fb923c;
    --yellow: #facc15;
    --blue: #60a5fa;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* === Navbar === */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.nav-brand a {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}
.nav-links { display: flex; gap: 16px; align-items: center; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-card-hover); }
.nav-user { color: var(--accent); font-weight: 600; font-size: 14px; }
.nav-badge { font-size: 12px; color: var(--orange); }
.nav-badge-on { color: var(--accent); }

/* === Container === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

/* === Headings === */
h1 { font-size: 24px; margin-bottom: 8px; color: var(--text); }
h2 { font-size: 18px; margin-bottom: 12px; color: var(--text); }
h3 { font-size: 15px; margin: 16px 0 8px; color: var(--text-muted); }

/* === Flash Messages === */
.flash-messages { margin-bottom: 16px; }
.flash {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 14px;
}
.flash-success { background: #14532d; border: 1px solid var(--accent-dim); color: var(--accent); }
.flash-error { background: #450a0a; border: 1px solid var(--red); color: var(--red); }
.flash-info { background: #172554; border: 1px solid var(--blue); color: var(--blue); }

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.card-wide { grid-column: span 2; }

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* === Auth Box === */
.auth-box {
    max-width: 420px;
    margin: 60px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
}
.auth-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.auth-form { text-align: left; }
.auth-form label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.auth-form input, .auth-form select {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
}
.auth-form input:focus, .auth-form select:focus {
    border-color: var(--accent);
    outline: none;
}
.checkbox-label { display: flex !important; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; margin: 0; }
.auth-footer { margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.auth-footer a { color: var(--accent); }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { background: var(--bg-card-hover); }
.btn-primary {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.btn-primary:hover { background: var(--accent); color: #000; }
.btn-large { width: 100%; padding: 14px; font-size: 16px; margin-top: 24px; }

/* === Badges & Labels === */
.phase-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* === Score Display === */
.score-card {
    text-align: center;
    padding: 24px;
    border-radius: var(--radius);
    margin: 16px 0;
}
.score-card-green { background: #14532d; border: 2px solid var(--accent); }
.score-card-yellow { background: #422006; border: 2px solid var(--yellow); }
.score-card-orange { background: #431407; border: 2px solid var(--orange); }
.score-card-red { background: #450a0a; border: 2px solid var(--red); }
.score-big { font-size: 48px; font-weight: 800; }
.score-label { font-size: 14px; text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; }

.score-green { color: var(--accent); font-weight: 700; }
.score-yellow { color: var(--yellow); font-weight: 700; }
.score-orange { color: var(--orange); font-weight: 700; }
.score-red { color: var(--red); font-weight: 700; }

/* === Tables === */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: var(--bg-card-hover); }
.notes-cell { color: var(--text-muted); font-size: 12px; }

.info-table td:first-child { color: var(--text-muted); width: 140px; }

/* === Bar === */
.bar {
    width: 100%;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

/* === Trend Strip === */
.trend-strip {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 140px;
    padding-top: 8px;
}
.trend-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 40px;
}
.trend-bar {
    width: 24px;
    background: var(--accent-dim);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.3s;
}
.trend-label { font-size: 10px; color: var(--text-muted); }
.trend-value { font-size: 11px; color: var(--accent); font-weight: 600; }

.trend-down { color: var(--accent); font-weight: 600; }
.trend-up { color: var(--red); font-weight: 600; }
.trend-flat { color: var(--text-muted); }

/* === Survey Form === */
.survey-form fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    background: var(--bg-card);
}
.survey-form legend {
    font-size: 16px;
    font-weight: 700;
    padding: 0 8px;
    color: var(--accent);
}
.survey-form label {
    display: block;
    margin: 14px 0 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.survey-form input[type="text"],
.survey-form input[type="number"],
.survey-form select,
.survey-form textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}
.survey-form input:focus,
.survey-form select:focus,
.survey-form textarea:focus {
    border-color: var(--accent);
    outline: none;
}
.survey-form textarea { resize: vertical; }
.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.input-row input { flex: 1; }
.input-sep { color: var(--text-muted); font-size: 12px; }
.hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* === Survey Summary === */
.survey-summary ul { list-style: none; padding-left: 0; }
.survey-summary li { padding: 3px 0; font-size: 13px; color: var(--text-muted); }
.survey-summary li::before { content: "• "; color: var(--accent); }

/* === Wiki Content (rendered markdown) === */
.wiki-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    font-size: 14px;
    line-height: 1.7;
}
.wiki-content h1 { font-size: 22px; margin-top: 24px; }
.wiki-content h2 { font-size: 18px; margin-top: 20px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.wiki-content h3 { font-size: 15px; margin-top: 16px; }
.wiki-content table { margin: 12px 0; }
.wiki-content th { background: var(--bg); }
.wiki-content code {
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 13px;
}
.wiki-content pre {
    background: var(--bg);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
}
.wiki-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 16px;
    margin: 12px 0;
    background: var(--bg);
    color: var(--text-muted);
}

/* === QR === */
.qr-container {
    margin: 20px auto;
    padding: 16px;
    background: #fff;
    border-radius: var(--radius);
    display: inline-block;
}
.qr-container img { max-width: 200px; }
.secret-code { font-size: 12px; color: var(--text-muted); margin: 12px 0; word-break: break-all; }

/* === Footer === */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
}
.footer code { background: var(--bg-card); padding: 2px 6px; border-radius: 3px; }

/* === Muted === */
.muted { color: var(--text-muted); font-size: 13px; }

/* === Responsive === */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .card-wide { grid-column: span 1; }
    .navbar { flex-direction: column; height: auto; padding: 12px; gap: 8px; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .input-row { flex-direction: column; }
    .trend-strip { height: 100px; }
}
