/* assets/style.css - Optimiert */

/* --- 1. FARB-DEFINITIONEN --- */
/* Light Theme & Default */
:root, body.theme-light {
    --bg-body: #f2f2f7;
    --card-bg: #ffffff;
    --text-main: #000000;
    --text-muted: #8e8e93;
    --border: #c6c6c8;
    --primary: #007aff;
    --primary-bg: #e5f1ff;
    --success: #34c759;
    --danger: #ff3b30;
    --nav-glass: rgba(255, 255, 255, 0.9);
    --input-bg: #e3e3e8;
    --chat-bg: #ffffff;
    --chat-msg-user: #007aff;
    --chat-msg-bot: #e9e9eb;
    --chat-text-bot: #000;
}

/* Dark Theme (Media Query) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #000000;
        --card-bg: #1c1c1e;
        --text-main: #ffffff;
        --text-muted: #98989d;
        --border: #38383a;
        --primary: #0a84ff;
        --primary-bg: #1a2a3a;
        --success: #30d158;
        --danger: #ff453a;
        --nav-glass: rgba(30, 30, 30, 0.85);
        --input-bg: #2c2c2e;
        --chat-bg: #1c1c1e;
        --chat-msg-user: #0a84ff;
        --chat-msg-bot: #2c2c2e;
        --chat-text-bot: #fff;
    }
}

/* Dark Theme (Forced Class) */
body.theme-dark {
    --bg-body: #000000;
    --card-bg: #1c1c1e;
    --text-main: #ffffff;
    --text-muted: #98989d;
    --border: #38383a;
    --primary: #0a84ff;
    --primary-bg: #1a2a3a;
    --success: #30d158;
    --danger: #ff453a;
    --nav-glass: rgba(30, 30, 30, 0.85);
    --input-bg: #2c2c2e;
    --chat-bg: #1c1c1e;
    --chat-msg-user: #0a84ff;
    --chat-msg-bot: #2c2c2e;
    --chat-text-bot: #fff;
}


/* --- 2. BASIS STYLES --- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0 auto;
    max-width: 800px;
    min-height: 100vh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    padding-left: calc(env(safe-area-inset-left) + 20px);
    padding-right: calc(env(safe-area-inset-right) + 20px);
}

@media screen and (min-width: 800px) {
    body { padding-top: 20px; }
    .nav-wrapper { bottom: 20px !important; }
    .modal-box { margin-bottom: 20px !important; }
}

button, .btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    display: block;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

button:active, .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--primary);
    box-shadow: none;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
    display: inline-block;
    width: auto;
    margin: 5px 0;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

input, select, textarea {
    background: var(--input-bg);
    color: var(--text-main);
    border: none;
    padding: 14px;
    border-radius: 10px;
    width: 100%;
    font-size: 16px;
    margin-bottom: 12px;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    background: var(--card-bg);
}

label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
    font-weight: 700;
    letter-spacing: 0.5px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

td {
    padding: 12px 5px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}


/* --- 3. MENÜ & ACTIONS --- */
.row-actions {
    position: relative;
}

.ctx-menu {
    display: none;
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    z-index: 100;
    flex-direction: row;
    gap: 5px;
    min-width: auto;
    white-space: nowrap;
}

.row-actions.active .ctx-menu {
    display: flex;
}

.sub-nav {
    display: flex;
    background: var(--input-bg);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.sub-nav a {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 9px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.sub-nav a.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


/* --- 4. MAIN NAVIGATION --- */
.nav-wrapper {
    position: fixed;
    bottom: max(10px, calc(env(safe-area-inset-bottom) - 10px));
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
    display: flex;
    pointer-events: none;
    z-index: 999;
}

.glass-nav {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--nav-glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 40px;
    padding: 5px 10px;
    height: 65px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 0.5px solid rgba(255,255,255,0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100%;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 2px;
    flex: 1;
    cursor: pointer;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
    display: block;
}

.nav-item.active {
    color: var(--primary);
}

.nav-plus {
    color: var(--primary);
    margin-left: 5px;
    cursor: pointer;
    flex: 0;
    min-width: 40px;
}

.nav-plus svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 5px rgba(0,122,255,0.3));
}

@media (max-width: 480px) {
    .nav-item span { display: none; }
    .nav-item svg { width: 26px; height: 26px; margin-bottom: 0; }
    .glass-nav { height: 60px; padding: 0 5px; }
}

.glass-nav.collapsed {
    width: 65px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

.glass-nav.collapsed .nav-item {
    display: none;
}

.nav-dots {
    display: none;
    color: var(--text-main);
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.glass-nav.collapsed .nav-dots {
    display: flex;
}

.nav-dots svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.pill-priv {
    background: var(--input-bg);
    color: var(--text-muted);
}

.pill-pub {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}


/* --- 5. CHAT STYLES --- */
#chat-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999999;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#chat-overlay.open {
    display: flex;
    opacity: 1;
}

.chat-window {
    background: var(--chat-bg);
    width: 100%;
    max-width: 600px;
    height: 85vh;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -5px 40px rgba(0,0,0,0.3);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

#chat-overlay.open .chat-window {
    transform: translateY(0);
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    background: var(--chat-bg);
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-area {
    padding: 15px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 15px);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    background: var(--chat-bg);
}

.chat-input-area textarea {
    margin: 0;
    resize: none;
    height: 50px;
    padding: 12px;
    line-height: 1.3;
}

.msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.msg.user {
    align-self: flex-end;
    background: var(--chat-msg-user);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg.bot {
    align-self: flex-start;
    background: var(--chat-msg-bot);
    color: var(--chat-text-bot);
    border-bottom-left-radius: 4px;
}

.typing {
    font-size: 12px;
    color: var(--text-muted);
    margin: 5px 15px;
    font-style: italic;
    display: none;
}

.typing.active {
    display: block;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.ai-btn-active svg {
    color: var(--primary);
    filter: drop-shadow(0 0 5px rgba(0,122,255,0.4));
    transform: scale(1.1);
    transition: all 0.3s;
}


/* --- 6. TEMPLATES & MODALS --- */
.tpl-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.tpl-card:active {
    transform: scale(0.98);
    background: var(--input-bg);
}

.tpl-name {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 4px;
}

.tpl-meta {
    font-size: 0.8em;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal.open {
    display: flex;
}

.modal-box {
    background: var(--card-bg);
    width: calc(100% - 40px);
    max-width: 760px;
    border-radius: 20px;
    margin-bottom: max(10px, calc(env(safe-area-inset-bottom) - 10px));
    padding: 25px;
    box-shadow: 0 5px 40px rgba(0,0,0,0.4);
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal.open .modal-box {
    transform: translateY(0);
}

.btn-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--input-bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin: 15px 0;
    text-align: center;
}

.stat-box {
    background: var(--input-bg);
    padding: 8px;
    border-radius: 10px;
}

.stat-label {
    font-size: 9px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.stat-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.item-list {
    margin-top: 10px;
    border-top: 1px solid var(--border);
}

.meal-sep {
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 10px;
    margin-bottom: 5px;
    padding-left: 2px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
}

.txt-success { color: var(--success); }
.txt-warn { color: #ff9f0a; }

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.action-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.action-icon.del {
    color: var(--danger);
    background: rgba(255, 59, 48, 0.1);
}

.add-box {
    background: var(--input-bg);
    padding: 10px;
    border-radius: 10px;
    margin-top: 15px;
    display: none;
}

.add-box.active {
    display: block;
}

.search-res {
    max-height: 300px;
    overflow-y: auto;
    background: var(--card-bg);
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid var(--border);
}

.search-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 600px) {
    .search-item {
        flex-direction: row;
        align-items: center;
    }
}

.search-item:last-child {
    border-bottom: none;
}

/* --- WEIGHT PAGE STYLES --- */
.dash-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr 1fr; 
    gap: 8px; 
    margin-bottom: 15px; 
}
.dash-card { 
    background: var(--card-bg); 
    padding: 8px 5px; 
    border-radius: 12px; 
    text-align: center; 
    border: 1px solid var(--border); 
    display:flex; 
    flex-direction:column; 
    justify-content:center; 
}
.dash-val { font-size: 1em; font-weight: bold; margin: 3px 0; white-space:nowrap; }
.dash-label { font-size: 0.7em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; line-height:1.1; }
.trend-good { color: var(--success); }
.trend-bad { color: var(--danger); }

.chart-controls { display: flex; gap: 10px; margin-bottom: 15px; }
.btn-group { display: flex; background: var(--input-bg); border-radius: 8px; padding: 2px; flex: 1; }
.btn-group button { flex: 1; background: none; border: none; padding: 6px 0; font-size: 0.8em; cursor: pointer; border-radius: 6px; color: var(--text-muted); transition:0.2s; text-align: center; white-space: nowrap; }
.btn-group button.active { background: var(--card-bg); color: var(--text-main); box-shadow: 0 1px 3px rgba(0,0,0,0.1); font-weight: 600; }

.chart-wrapper { display: flex; gap: 15px; align-items: stretch; height: 300px; }
.chart-side-stats { width: 70px; display: flex; flex-direction: column; justify-content: space-between; padding: 10px 0; font-size: 0.85em; color: var(--text-muted); text-align: right; border-right: 1px solid var(--border); padding-right: 10px; }
.chart-side-stats .stat-box strong { display: block; font-size: 1.1em; color: var(--text-main); }
.chart-area { flex: 1; position: relative; overflow: hidden; }

@media (max-width: 700px) {
    .chart-wrapper { flex-direction: column; height: auto; }
    .chart-area { height: 250px; width: 100%; order: 1; }
    .chart-side-stats { order: 2; width: 100%; flex-direction: row; justify-content: space-around; border-right: none; border-top: 1px solid var(--border); padding: 10px 0 0 0; text-align: center; }
    .chart-side-stats .stat-box { flex: 1; }
}

.prog-cont { height: 20px; background: var(--input-bg); border-radius: 10px; overflow: hidden; margin-top: 5px; position: relative; }
.prog-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); width: 0%; transition: width 1s ease-out; }
.prog-text { position: absolute; width: 100%; text-align: center; top: 0; line-height: 20px; font-size: 0.75em; font-weight: bold; color: rgba(255,255,255,0.9); text-shadow: 0 0 3px rgba(0,0,0,0.5); }

.pred-container { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; margin-bottom: 20px; }
.flip-card { 
    background: var(--card-bg); border-radius: 16px; padding: 15px; 
    text-align: center; border: 1px solid var(--border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.flip-val {
    background: var(--input-bg); color: var(--text-main); font-size: 1.3em;
    font-weight: 800; padding: 10px 5px; border-radius: 8px; margin: 8px 0; width: 100%;
    font-family: 'Courier New', Courier, monospace; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: -0.5px;
}
.flip-lbl { font-size: 0.7em; color: var(--text-muted); text-transform: uppercase; font-weight: bold; }
.flip-sub { font-size: 0.75em; color: var(--primary); font-weight: 600; }


/* --- JOURNAL PAGE STYLES --- */
.mood-grid { display: flex; justify-content: space-between; gap: 5px; margin-bottom: 20px; }
.mood-opt { 
    flex:1; text-align:center; padding: 10px 0; 
    border: 1px solid var(--border); border-radius:10px; 
    cursor:pointer; background:var(--input-bg); font-size:1.5em; 
    transition:0.2s; 
}
.mood-opt.selected { 
    background: var(--primary-bg); 
    border-color: var(--primary); 
    transform: scale(1.05); 
}

.gym-toggle { 
    display: flex; align-items: center; justify-content: space-between; 
    background: var(--input-bg); padding: 15px; 
    border-radius: 12px; margin-bottom: 20px; cursor: pointer; 
}
.gym-check { 
    width: 24px; height: 24px; 
    border: 2px solid var(--text-muted); border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    transition:0.2s; 
}
.gym-toggle.active { background: rgba(52, 199, 89, 0.15); border: 1px solid var(--success); }
.gym-toggle.active .gym-check { background: var(--success); border-color: var(--success); color: white; }
.gym-toggle.active .gym-label { color: var(--success); font-weight: bold; }


/* --- DASHBOARD STYLES --- */
.segmented-control { 
    display: flex; 
    background: var(--input-bg); 
    border-radius: 9px; 
    padding: 2px; 
    margin: 15px 0; 
}
.segment-btn { 
    flex: 1; 
    text-align: center; 
    padding: 6px; 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--text-muted); 
    text-decoration: none; 
    border-radius: 7px; 
    transition: all 0.2s; 
}
.segment-btn.active { 
    background: var(--card-bg); 
    color: var(--text-main); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.stat-box .stat-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.stat-bar-bg { height: 4px; background: rgba(0,0,0,0.05); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 2px; }

.meal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding-bottom: 8px; 
    border-bottom: 1px solid var(--border); 
    margin-bottom: 8px; 
}
.meal-title { font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 0.8em; }
.meal-sum { font-size: 0.8em; font-weight: 600; color: var(--text-main); }

.macro-tags { display: flex; gap: 6px; margin-top: 5px; }
.m-tag { 
    font-size: 10px; 
    font-weight: 600; 
    padding: 2px 6px; 
    border-radius: 4px; 
    color: white; 
    min-width: 35px; 
    text-align: center; 
}
.m-p { background-color: var(--danger); } 
.m-c { background-color: var(--success); } 
.m-f { background-color: #ffcc00; color: black; }

.btn-icon { 
    width: 40px; height: 40px; 
    border-radius: 12px; 
    background: var(--card-bg); 
    display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); 
    color: var(--text-main); 
    text-decoration: none; 
    border: 1px solid var(--border); 
    transition: transform 0.1s; 
}
.btn-icon:active { transform: scale(0.95); }

.bar-striped { 
    background-color: var(--danger) !important; 
    background-image: linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent); 
    background-size: 1rem 1rem; 
}


/* --- SETTINGS PAGE STYLES --- */
.calc-box { 
    background: linear-gradient(135deg, var(--card-bg), var(--input-bg)); 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    padding: 15px; 
    margin-bottom: 20px; 
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.preview-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr 1fr; 
    gap: 5px; 
    margin-top: 15px; 
    text-align: center; 
}
.preview-item { background: rgba(0,0,0,0.05); padding: 5px; border-radius: 8px; }
.preview-item span { display: block; font-size: 0.7em; text-transform: uppercase; color: var(--text-muted); }
.preview-item strong { font-size: 1.1em; color: var(--text-main); }

.sport-row { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
    margin-bottom: 8px; 
    animation: fadeIn 0.3s ease; 
}
.sport-row select { flex: 2; margin: 0; font-size: 0.9em; padding: 10px; }
.sport-row input { flex: 1; margin: 0; font-size: 0.9em; text-align: center; padding: 10px; }
.sport-row button { 
    width: 36px; height: 36px; 
    padding: 0; margin: 0; 
    background: rgba(255, 59, 48, 0.15); 
    color: var(--danger); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 8px; 
}

@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(-5px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.add-sport-btn { 
    background: var(--input-bg); 
    color: var(--primary); 
    font-size: 0.9em; 
    padding: 8px; 
    width: 100%; 
    border-radius: 8px; 
    border: 1px dashed var(--primary); 
    margin-top: 5px; 
    cursor: pointer; 
}

.section-label { 
    font-size: 0.85em; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    color: var(--text-muted); 
    font-weight: 700; 
    margin-top: 20px; 
    margin-bottom: 8px; 
    border-bottom: 1px solid var(--border); 
    padding-bottom: 2px; 
}


/* --- MANAGE PAGE STYLES --- */
.food-row { border-bottom: 1px solid var(--border); }
.food-row:last-child { border-bottom: none; }
.food-row td { padding: 12px 5px; vertical-align: top; }

.macro-row { 
    font-size: 0.8em; 
    color: var(--text-muted); 
    display: flex; 
    gap: 10px; 
    margin-top: 4px; 
}
.macro-val { white-space: nowrap; }

.search-box {
    width: 100%;
    margin: 0; 
    padding: 12px 15px; 
    font-size: 16px; 
    border-radius: 12px; 
    border: none; 
    background: var(--card-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 15px;
}


/* --- BARCODE SCANNER OVERLAY --- */
#scanner-container { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: #000; 
    z-index: 3000; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
#reader { width: 100%; max-width: 600px; }
.scan-overlay-ui { 
    position: absolute; 
    top: 20px; left: 20px; 
    margin-top: env(safe-area-inset-top); 
    z-index: 3001; 
}
.scan-close-btn {
    background: rgba(255,255,255,0.2); 
    backdrop-filter: blur(5px); 
    color: white; 
    border: 1px solid rgba(255,255,255,0.4);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
}
.barcode-wrapper { position: relative; }
.barcode-wrapper input { padding-right: 45px; }
.barcode-icon {
    position: absolute; 
    right: 8px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); 
    cursor: pointer;
    display: flex;
    align-items: center;
}


/* --- ACCOUNT PAGE STYLES --- */
.pfp-container { position: relative; width: 100px; height: 100px; margin: 0 auto 20px auto; }
.pfp-img { 
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover; 
    background-color: var(--input-bg); border: 2px solid var(--border);
}
.pfp-upload-btn {
    position: absolute; bottom: 0; right: 0; background: var(--primary); color: white;
    border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.file-input { display: none; }

.form-row { display: grid; grid-template-columns: 2fr 1fr; gap: 15px; }
input[type="date"] { -webkit-appearance: none; appearance: none; min-height: 50px; background-color: var(--input-bg); }

.pw-rules { display: flex; gap: 8px; margin-top: 5px; margin-bottom: 15px; }
.pw-badge { font-size: 0.75em; padding: 4px 8px; border-radius: 6px; background: var(--input-bg); color: var(--text-muted); transition: all 0.2s; border: 1px solid transparent; font-weight: 600; }
.pw-badge.valid { background: rgba(52, 199, 89, 0.15); color: var(--success); border-color: var(--success); }

.push-status { padding: 12px; background: var(--input-bg); border-radius: 10px; margin-bottom: 15px; font-size: 0.9em; display:flex; align-items:center; gap:10px;}
.push-status.active { background: rgba(52, 199, 89, 0.15); color: var(--success); }

.reminder-row { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.reminder-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.rem-label { font-weight: 600; margin-bottom: 8px; font-size: 0.95em; color: var(--text-main); }
.rem-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.time-input { width: 90px !important; margin: 0 !important; padding: 8px !important; text-align: center; }

.day-select { display: flex; gap: 4px; flex-wrap: wrap; }
.day-cb { display: none; }
.day-lbl { 
    padding: 8px 10px; border-radius: 8px; font-size: 11px; font-weight:600; 
    background: var(--input-bg); color: var(--text-muted); 
    cursor: pointer; user-select: none; transition: all 0.2s;
    margin: 0 !important; border: 1px solid transparent;
}
.day-cb:checked + .day-lbl { background: var(--primary); color: white; border-color: var(--primary); }

.crop-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 9999;
    align-items: center; justify-content: center; flex-direction: column;
}
.crop-container {
    max-width: 90%; max-height: 70vh; background: #000; overflow: hidden;
    border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}
.crop-container img { display: block; max-width: 100%; }
.crop-actions { margin-top: 20px; display: flex; gap: 15px; }


/* --- GROUP PAGE STYLES --- */
.pfp-circle { 
    width: 50px; height: 50px; border-radius: 50%; 
    background: var(--input-bg); flex-shrink: 0; 
    background-size: cover; background-position: center; 
    border: 2px solid var(--border); 
    display: flex; align-items: center; justify-content: center; 
    overflow: hidden; 
}
.progress-bar { 
    height: 6px; background: var(--input-bg); 
    border-radius: 3px; margin-top: 5px; 
    overflow: hidden; width: 100%; 
}
.progress-fill { height: 100%; background: var(--primary); transition: width 0.3s; }

.stats-row { display: flex; gap: 12px; font-size: 0.7em; color: var(--text-muted); margin-top: 6px; }
.stat-item { display: flex; align-items: center; gap: 4px; white-space: nowrap; }

.trend-badge { font-size: 0.8em; font-weight:bold; margin-left: 5px; }
.trend-neutral { color: var(--text-muted); }

.action-btn {
    width: 40px; height: 40px; border-radius: 12px; 
    display: flex; align-items: center; justify-content: center; 
    border: none; cursor: pointer; text-decoration: none;
    margin: 0; padding: 0; font-size: 1.2em;
}
.btn-rate { background: var(--input-bg); color: var(--text-main); }
.btn-profile { background: var(--primary-bg); color: var(--primary); }
.btn-disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; filter: grayscale(1); }

.modal-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); z-index: 999; 
    justify-content: center; align-items: center; 
}
.modal-box-center { 
    background: var(--card-bg); padding: 20px; 
    border-radius: 15px; width: 90%; max-width: 320px; 
    text-align: center; border: 1px solid var(--border); 
}
.smiley-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 15px; }
.smiley-btn { 
    font-size: 24px; background: var(--input-bg); 
    border: 1px solid var(--border); border-radius: 8px; 
    cursor: pointer; padding: 10px 0; transition: transform 0.1s; 
}
.smiley-btn:active { transform: scale(0.95); }


/* --- ADMIN PAGE STYLES --- */
.pfp-circle-small { 
    width: 45px; height: 45px; 
    border-radius: 50%; 
    background: var(--input-bg); 
    background-size: cover; 
    background-position: center; 
    border: 1px solid var(--border); 
    display: flex; align-items: center; justify-content: center; 
    margin-right: 12px; 
}
.group-header { 
    background: var(--input-bg); 
    font-weight: bold; 
    font-size: 0.85em; 
    color: var(--text-muted); 
    padding: 8px 12px; 
    border-radius: 8px; 
    margin-top: 20px; 
    margin-bottom: 5px; 
}
.progress-bar-thin { 
    height: 5px; 
    background: var(--input-bg); 
    border-radius: 3px; 
    margin-top: 5px; 
    overflow: hidden; 
    width: 100%; 
}
.stats-row-compact { 
    display: flex; gap: 12px; 
    font-size: 0.75em; 
    color: var(--text-muted); 
    margin-top: 4px; 
}
.goal-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr; 
    gap: 8px; 
    margin-top: 10px; 
}
.goal-inp label { font-size: 0.7em; margin-bottom: 2px; }
.goal-inp input { padding: 8px; font-size: 0.9em; margin-bottom: 0; }
.ctx-menu a { border-bottom: none !important; }


/* --- ENTRY PAGE STYLES --- */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 15px; }
.tab { 
    flex: 1; text-align: center; padding: 10px; 
    color: var(--text-muted); cursor: pointer; 
    font-weight: 600; border-bottom: 2px solid transparent; 
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.cat-header { 
    font-size: 0.8em; font-weight: 700; color: var(--text-muted); 
    text-transform: uppercase; margin: 25px 0 8px 5px; 
}
.food-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 12px; background: var(--input-bg); border-radius: 12px; 
    margin-bottom: 8px; cursor: pointer; transition: transform 0.1s; 
}
.food-item:active { transform: scale(0.98); }

.food-info-line { 
    display: flex; gap: 8px; font-size: 0.75em; 
    color: var(--text-muted); margin-top: 5px; align-items: center; 
}

/* Macro Tags (Farben bereits oben definiert, hier nur Layout falls abweichend) */
.macro-tags { display: flex; gap: 4px; }
/* .m-tag, .m-p, .m-c, .m-f entfernt (Duplikate von oben) */

.input-area { 
    position: fixed; bottom: 0; left: 0; right: 0; 
    background: var(--card-bg); padding: 20px 20px 40px 20px; 
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2); 
    border-top-left-radius: 24px; border-top-right-radius: 24px; 
    transform: translateY(110%); 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    z-index: 2000; 
}
.input-area.visible { transform: translateY(0); }

.header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
/* .btn-icon entfernt (Duplikat von oben) */

.date-wrapper { position: relative; display: flex; align-items: center; gap: 10px; }
.date-text { font-weight: 600; font-size: 0.9em; color: var(--text-muted); }
.date-icon { 
    width: 40px; height: 40px; border-radius: 12px; 
    background: var(--input-bg); display: flex; align-items: center; justify-content: center; 
    cursor: pointer; color: var(--primary); 
}
.date-real { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* Scanner Overlay CSS entfernt (exaktes Duplikat) */

.meal-select { width:100%; margin:0; font-weight:bold; font-size:1.1em; background:transparent; border:none; }
.search-wrapper { position:relative; }
.scan-btn-search { position:absolute; right:8px; top:8px; width:30px; height:30px; color:var(--text-muted); cursor:pointer; }


/* --- LOGIN PAGE STYLES --- */
body.login-page { 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; 
    width: 100vw; 
    max-width: none; 
    margin: 0; 
    padding: 20px; 
    box-sizing: border-box; 
    text-align: center;
}

.login-wrapper { width: 100%; max-width: 320px; }

.login-title { 
    font-size: 1.8em; 
    margin: 0 0 25px 0; 
    font-weight: 700; 
    letter-spacing: -0.5px;
}

.login-card { 
    padding: 30px 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    margin: 0 auto; 
}

.login-input { 
    text-align: center; 
    font-weight: 500; 
    transition: all 0.2s;
}
.login-input:focus { 
    border-color: var(--primary); 
    background: var(--card-bg); 
    transform: scale(1.02);
}

.error-msg {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.forgot-link {
    display: block;
    margin-top: 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85em;
    transition: color 0.2s;
}
.forgot-link:hover { color: var(--primary); }

.footer-copy {
    margin-top: 40px;
    font-size: 0.75em;
    color: var(--text-muted);
    opacity: 0.5;
}

.msg-box { 
    padding: 15px; 
    border-radius: 12px; 
    margin-bottom: 20px; 
    font-size: 0.9em; 
    font-weight: 600; 
    line-height: 1.4; 
    text-align: center;
}
.msg-success { background: rgba(52, 199, 89, 0.15); color: var(--success); }
.msg-error { background: rgba(255, 59, 48, 0.15); color: var(--danger); }

.auth-status-icon { font-size: 45px; margin-bottom: 15px; display: block; }
.auth-desc { font-size:0.9em; color:var(--text-muted); margin-bottom:25px; line-height:1.4; }

.pw-rules.centered { justify-content: center; margin-top: -10px; margin-bottom: 20px; }
