@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&display=swap');

/* ==========================================
   1. VARIABLEN & GRUNDLAGEN
   ========================================== */
:root {
    --bg-main: #0a0a0a;
    --bg-card: #141414;
    --bg-card-hover: #1a1a1a;
    --accent: #412257;
    --accent-hover: #5a2f78;
    --text-main: #ffffff;
    --text-muted: #888888;
    --border: #222222;
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    font-family: 'Outfit', system-ui, sans-serif !important;
}

html, body {
    background-color: var(--bg-main) !important;
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    padding-bottom: 80px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; }
.hidden { display: none !important; }

/* ==========================================
   2. HEADER
   ========================================== */
.app-logo {
    display: block;
    height: 100px;
    width: auto;
    object-fit: contain;
}


.app-header h1 {
    display: none; 
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border);
}

/* ==========================================
   3. LAYOUT (GRID FÜR DESKTOP)
   ========================================== */
.app-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1.5fr 1fr;
    }
}

.left-column, .right-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ==========================================
   4. DATUMS-NAVIGATION
   ========================================== */
.section-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}

.date-nav-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.date-nav-container h3 {
    font-size: 24px;
    color: var(--text-main);
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}
.icon-btn:hover { color: var(--text-main); border-color: var(--text-muted); }

.badge-heute {
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

/* ==========================================
   5. KARTEN & MAKROS
   ========================================== */
.card, .macro-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
}

.macros {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.macro-header {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.macro-values {
    margin-bottom: 15px;
}

.macro-values strong {
    font-size: 24px;
    color: var(--text-main);
}

.goal-text {
    font-size: 12px;
    color: var(--text-muted);
}

.highlight-card {
    border: 1px solid rgba(65, 34, 87, 0.5); 
    position: relative;
}

.card-header-small {
    font-size: 10px;
    color: var(--accent);
    letter-spacing: 1px;
    font-weight: 700;
    margin-bottom: 20px;
}

.kcal-display {
    text-align: center;
    margin-bottom: 30px;
}

.huge-number {
    font-size: 56px;
    font-weight: 800;
    font-style: italic;
    line-height: 1;
    margin-bottom: 5px;
}

.kcal-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.kcal-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.detail-row {
    display: flex;
    justify-content: space-between;
}
.detail-row span:last-child { color: var(--text-main); font-weight: 600; }

.progress-bar {
    background-color: #222;
    height: 4px;
    border-radius: 2px;
    width: 100%;
    overflow: hidden;
}
.mt-3 { margin-top: 20px; }
.fill { height: 100%; transition: width 0.4s ease; border-radius: 2px; }

.kcal-fill { background-color: var(--accent); }
.protein-fill { background-color: #ef4444; } 
.carbs-fill { background-color: #0aad20; } 
.fat-fill { background-color: #eab308; } 

/* ==========================================
   6. LOG & BUTTONS
   ========================================== */
.log-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
}
.btn-primary:hover { background-color: var(--accent-hover); }

.btn-icon { padding: 10px; }

.empty-state {
    border: 1px dashed var(--border);
    border-radius: var(--border-radius);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    background: rgba(255,255,255,0.02);
}

.meal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.meal-list li {
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
}

/* ==========================================
   7. FORMULARE & MODALS
   ========================================== */
input, textarea, select {
    background-color: #000 !important;
    border: 1px solid var(--border) !important;
    color: var(--text-main) !important;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent) !important;
    outline: none;
}

label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

/* ==========================================
   8. BOTTOM NAVIGATION (Mobile)
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background-color: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-item, .nav-btn {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 11px;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; cursor: pointer;
}

.nav-item.active, .nav-btn.active {
    color: var(--accent);
}

/* ==========================================
   MODAL / POP-UP OVERLAY (SCHWEBENDE FENSTER)
   ========================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8),
                0 0 25px rgba(65, 34, 87, 0.25);
    animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
    from {
        transform: scale(0.92) translateY(15px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.modal-content h3 {
    font-size: 15px;
    color: var(--text-main);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: flex-end;
}

.modal-actions .btn {
    flex: 1;
    text-align: center;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ==========================================
   MOBILE LAYOUT: Kalorienbox über Makros
   ========================================== */
@media (max-width: 899px) {
    .dashboard-layout {
        display: flex;
        flex-direction: column;
    }

    .left-column, .right-column {
        display: contents;
    }

    .left-column > .section-header { order: 1; }
    .right-column > .dashboard     { order: 2; }
    .left-column > .macros         { order: 3; }
    .left-column > .log-section    { order: 4; }
}