/* FitnessX - Mobile-First, Dark Mode, Gruen-Theme */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a3a;
    --bg-input: #253345;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #2ecc71;
    --accent-hover: #27ae60;
    --accent-light: rgba(46, 204, 113, 0.15);
    --border: #2a3a4a;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #2ecc71;
    --nav-height: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary); color: var(--text-primary);
    min-height: 100vh; padding-bottom: calc(var(--nav-height) + 10px);
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================
   BOTTOM NAV (Mobile)
   ========================================== */
.sidebar {
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height);
    background: var(--bg-secondary); border-top: 1px solid var(--border);
    z-index: 100; overflow: hidden;
}
.sidebar-header { display: none; }
.sidebar-nav {
    list-style: none; display: flex; height: 100%;
    align-items: center; justify-content: space-around; padding: 0;
}
.sidebar-nav li { flex: 1; }
.sidebar-nav li a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 8px 4px; color: var(--text-secondary); text-decoration: none;
    font-size: 0.65rem; font-weight: 600; border-left: none;
    transition: color 0.2s; gap: 2px; text-align: center; line-height: 1.2;
}
.sidebar-nav li a.active { color: var(--accent); }
.sidebar-nav li a::before {
    font-size: 1.3rem; display: block; margin-bottom: 1px;
}
.sidebar-nav li:nth-child(1) a::before { content: "🏠"; }
.sidebar-nav li:nth-child(2) a::before { content: "💪"; }
.sidebar-nav li:nth-child(3) a::before { content: "🔬"; }

/* Content */
.content { padding: 16px 16px 20px; width: 100%; }

/* Page Header */
.page-header { margin-bottom: 16px; }
.page-header h2 { color: var(--accent); margin-bottom: 2px; font-size: 1.4rem; }
.page-header .subtitle { color: var(--text-secondary); font-size: 0.82rem; }

/* Filter */
.filter-bar { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-btn {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px;
    background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
    font-size: 0.78rem; transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ==========================================
   CARD GRID
   ========================================== */
.vit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vcard {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 14px; cursor: pointer; position: relative; overflow: hidden;
    transition: all 0.2s; -webkit-tap-highlight-color: transparent;
    min-height: 120px;
}
.vcard:active { transform: scale(0.97); border-color: var(--accent); }
.vcard-badge {
    position: absolute; top: 8px; right: 8px; font-size: 0.55rem; padding: 2px 6px;
    border-radius: 8px; text-transform: uppercase; font-weight: 700;
}
.vcard-badge.fettlöslich { background: rgba(241,196,15,0.2); color: #f1c40f; }
.vcard-badge.wasserlöslich { background: rgba(52,152,219,0.2); color: #3498db; }
.vcard-badge.mengenelement { background: rgba(155,89,182,0.2); color: #9b59b6; }
.vcard-badge.spurenelement { background: rgba(230,126,34,0.2); color: #e67e22; }
.vcard h3 { font-size: 1.6rem; color: var(--accent); margin-bottom: 2px; font-weight: 900; }
.vcard-name { color: var(--text-secondary); font-size: 0.7rem; margin-bottom: 6px; }
.vcard-desc { color: var(--text-primary); font-size: 0.78rem; line-height: 1.3; margin-bottom: 8px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcard-daily { font-size: 0.7rem; color: var(--text-secondary); }

/* ==========================================
   EXPANDED VIEW (Karte + Straenge)
   ========================================== */
.expanded-view { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.exp-card {
    background: var(--bg-card); border: 1px solid var(--accent);
    border-radius: 12px; padding: 16px; position: relative;
    box-shadow: 0 0 20px rgba(46,204,113,0.15);
    animation: cardUp 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes cardUp { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.exp-card h3 { font-size: 1.8rem; color: var(--accent); font-weight: 900; margin-bottom: 2px; }
.exp-wirkung { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; margin: 8px 0; }

/* SVG Straenge */
.strand-svg { display: block; width: 100%; height: 80px; margin: 0 auto; }
.strand {
    fill: none; stroke-width: 2.5; stroke-linecap: round;
    stroke-dasharray: 300; stroke-dashoffset: 300;
    animation: drawStrand 0.8s 0.3s ease forwards;
}
.strand-left { stroke: #e74c3c; }
.strand-right { stroke: var(--accent); }
@keyframes drawStrand { to { stroke-dashoffset: 0; } }
.strand-dot { opacity: 0; animation: dotFade 0.3s 1s ease forwards; }
.strand-dot-left { fill: #e74c3c; }
.strand-dot-right { fill: var(--accent); }
@keyframes dotFade { to { opacity: 0.6; } }

/* Endpunkte */
.strand-targets { display: flex; justify-content: space-around; margin: 0 auto 12px; }
.strand-target {
    text-align: center; opacity: 0;
    animation: targetPop 0.4s 0.8s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes targetPop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.target-label {
    display: inline-block; padding: 5px 14px; border-radius: 16px;
    font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.target-left .target-label { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.target-right .target-label { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(46,204,113,0.3); }

/* Panels */
.strand-panels { display: flex; gap: 10px; }
.strand-panel { flex: 1; min-width: 0; opacity: 0; animation: panelUp 0.4s 1s ease forwards; }
@keyframes panelUp { from { transform: translateY(15px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Panel Items */
.pitem {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 6px;
}
.pitem:active { border-color: var(--accent); }
.pitem strong { display: block; color: var(--text-primary); font-size: 0.88rem; }
.pitem p { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; margin-top: 3px; }

.pitem.rel-h { border-left: 3px solid #e74c3c; }
.pitem.rel-m { border-left: 3px solid #f39c12; }
.pitem.rel-l { border-left: 3px solid #95a5a6; }
.pitem-rel {
    display: inline-block; font-size: 0.58rem; padding: 1px 7px; border-radius: 8px;
    margin-bottom: 3px; font-weight: 700; text-transform: uppercase;
}
.rel-h .pitem-rel { background: rgba(231,76,60,0.15); color: #e74c3c; }
.rel-m .pitem-rel { background: rgba(243,156,18,0.15); color: #f39c12; }
.rel-l .pitem-rel { background: rgba(149,165,166,0.15); color: #95a5a6; }

.food-pitem { display: flex; align-items: center; gap: 8px; }
.pitem-rank {
    flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 800; font-size: 0.75rem;
    display: flex; align-items: center; justify-content: center;
}
.pitem-body { flex: 1; min-width: 0; }
.pitem-body strong { display: inline; font-size: 0.85rem; }
.pitem-kat {
    font-size: 0.6rem; padding: 1px 6px; border-radius: 8px;
    background: var(--accent-light); color: var(--accent); margin-left: 4px;
}
.pitem-bar-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.pitem-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-input); overflow: hidden; }
.pitem-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); }
.pitem-bar-row span { font-size: 0.68rem; color: var(--text-secondary); white-space: nowrap; }

/* Buttons */
.exp-back {
    display: inline-flex; align-items: center; gap: 6px;
    margin-bottom: 12px; padding: 8px 16px;
    background: none; border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-secondary); cursor: pointer; font-size: 0.85rem;
    -webkit-tap-highlight-color: transparent;
}
.exp-back:active { border-color: var(--accent); color: var(--text-primary); }

.exp-close {
    display: block; margin: 16px auto 0; padding: 8px 20px;
    background: none; border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-secondary); cursor: pointer; font-size: 0.85rem;
}
.exp-close:active { border-color: var(--accent); color: var(--text-primary); }

.empty { color: var(--text-secondary); text-align: center; padding: 16px; }

/* ==========================================
   DASHBOARD
   ========================================== */
.dashboard h2 { color: var(--accent); margin-bottom: 16px; }

.search-box {
    position: relative; margin-bottom: 20px;
}
.search-input {
    width: 100%; padding: 14px 16px 14px 44px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; color: var(--text-primary); font-size: 1rem;
    -webkit-appearance: none;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-size: 1.1rem; color: var(--text-secondary); pointer-events: none;
}

.search-results { margin-top: 12px; }

.dash-section { margin-bottom: 20px; }
.dash-section h3 { color: var(--accent); font-size: 1rem; margin-bottom: 10px; }

.dash-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dash-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px; text-align: center; cursor: pointer;
    -webkit-tap-highlight-color: transparent; text-decoration: none;
}
.dash-card:active { border-color: var(--accent); }
.dash-card-icon { font-size: 2rem; margin-bottom: 6px; }
.dash-card-title { color: var(--text-primary); font-weight: 700; font-size: 0.9rem; }
.dash-card-sub { color: var(--text-secondary); font-size: 0.72rem; margin-top: 2px; }

.fact-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px;
}
.fact-card p { font-size: 0.88rem; line-height: 1.5; color: var(--text-primary); }
.fact-card .fact-label { font-size: 0.7rem; color: var(--accent); font-weight: 700; text-transform: uppercase; margin-bottom: 6px; }

/* Tables (mobile) */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
th { color: var(--accent); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; }
.kat-tag {
    display: inline-block; font-size: 0.6rem; padding: 1px 6px;
    border-radius: 8px; background: var(--accent-light); color: var(--accent);
}
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }

/* Overlay (fallback) */
.fitnessx-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.overlay-content {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 12px; padding: 20px; max-width: 100%; width: 100%;
    max-height: 90vh; overflow-y: auto; position: relative;
}
.overlay-close {
    position: absolute; top: 8px; right: 12px; background: none; border: none;
    color: var(--text-secondary); font-size: 1.8rem; cursor: pointer; line-height: 1;
}

/* Detail */
.det-header h2 { color: var(--accent); margin-bottom: 4px; font-size: 1.2rem; }
.det-badge { font-size: 0.65rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.det-badge.fettlöslich { background: rgba(241,196,15,0.2); color: #f1c40f; }
.det-badge.wasserlöslich { background: rgba(52,152,219,0.2); color: #3498db; }
.det-badge.mengenelement { background: rgba(155,89,182,0.2); color: #9b59b6; }
.det-badge.spurenelement { background: rgba(230,126,34,0.2); color: #e67e22; }
.det-daily { color: var(--text-secondary); margin-top: 6px; font-size: 0.85rem; }
.det-daily strong { color: var(--accent); }
.det-section { margin-top: 14px; }
.det-section h4 { color: var(--accent); margin-bottom: 6px; font-size: 0.88rem; }
.det-section p { line-height: 1.5; color: var(--text-primary); font-size: 0.85rem; }
.mangel-text { color: var(--warning); }

/* Symptom Items */
.sym-item {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 6px;
}
.sym-item.rel-h { border-left: 3px solid #e74c3c; }
.sym-item.rel-m { border-left: 3px solid #f39c12; }
.sym-item.rel-l { border-left: 3px solid #95a5a6; }
.sym-rel {
    display: inline-block; font-size: 0.58rem; padding: 1px 7px; border-radius: 8px;
    margin-bottom: 3px; font-weight: 700; text-transform: uppercase;
}
.rel-h .sym-rel { background: rgba(231,76,60,0.15); color: #e74c3c; }
.rel-m .sym-rel { background: rgba(243,156,18,0.15); color: #f39c12; }
.rel-l .sym-rel { background: rgba(149,165,166,0.15); color: #95a5a6; }
.sym-item strong { display: block; color: var(--text-primary); font-size: 0.85rem; }
.sym-item p { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; margin-top: 3px; }
