/* --- Variablen für Light- und Darkmode --- */
:root {
    --bg-color: #f4f6f8;
    --surface-color: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --primary-color: #e67e22;
    --primary-hover: #d35400;
    --secondary-color: #7f8c8d;
    --border-color: #dee2e6;
    --sidebar-width: 320px;
    --nutrition-bg: #fdf2e9;
    --header-height: 60px;
}

body[data-theme="dark"] {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #f5f5f5;
    --text-muted: #a0a0a0;
    --border-color: #2d2d2d;
    --secondary-color: #555555;
    --nutrition-bg: #2c2520;
}

/* =========================================
   SCROLLBAR STYLING (Fixt die weißen Ränder)
   ========================================= */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color); 
}
::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color); 
    border-radius: 10px;
    border: 3px solid var(--bg-color); 
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-color);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: '-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* LAYOUT GRID DESKTOP */
#app-container { display: grid; grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width); height: 100vh; }
#sidebar-left, #sidebar-right { overflow-y: auto; padding: 1.5rem; background-color: var(--surface-color); }
#sidebar-left { border-right: 1px solid var(--border-color); }
#sidebar-right { border-left: 1px solid var(--border-color); display: flex; flex-direction: column; height: 100vh; }
#main-content { overflow-y: auto; padding: 2rem 3rem; background-color: var(--bg-color); }
#shopping-list-container { flex: 1; overflow-y: auto; }

/* MOBILE HEADER & OVERLAY */
#mobile-header { display: none; }
#mobile-overlay { display: none; }
.mobile-close-btn { display: none; background: none; border: none; font-size: 1.8rem; color: var(--text-color); cursor: pointer; padding: 0.2rem; }

h1, h2, h3, h4 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.print-only { display: none; }

button {
    background-color: var(--primary-color); color: white; border: none;
    padding: 0.65rem 1.2rem; border-radius: 8px; cursor: pointer;
    font-weight: 600; transition: background 0.2s, transform 0.1s;
}
button:hover { background-color: var(--primary-hover); }
button:active { transform: scale(0.98); }

.btn-secondary { background-color: var(--secondary-color); }
.full-width-btn { width: 100%; margin-top: 0.75rem; }

input, select, textarea {
    width: 100%; padding: 0.65rem; margin-bottom: 0.75rem;
    border: 1px solid var(--border-color); border-radius: 6px;
    background-color: var(--bg-color); color: var(--text-color); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-color); }

/* SIDEBARS & SUCH-TOOLS */
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
#theme-toggle { background: none; color: var(--text-color); font-size: 1.2rem; padding: 0.5rem; cursor: pointer; border: none; }
.sidebar-logo-container { text-align: center; margin-bottom: 1.2rem; }
.sidebar-logo { max-width: 75%; height: auto; object-fit: contain; }

.search-tools-row { display: flex; gap: 8px; margin-bottom: 0.75rem; }
.icon-tool-btn { flex: 1; background-color: var(--surface-color); border: 1px solid var(--border-color); color: var(--text-color); padding: 8px 0; border-radius: 6px; cursor: pointer; font-size: 1.1rem; transition: all 0.2s; }
.icon-tool-btn:hover, .icon-tool-btn.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }

.fridge-search-box { background-color: var(--bg-color); padding: 10px; border-radius: 8px; border: 1px dashed var(--primary-color); margin-bottom: 0.75rem; }
.auth-section { background-color: var(--bg-color); padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; text-align: center; }
#user-status { font-weight: bold; font-size: 0.95rem; margin-bottom: 0.25rem; }
.btn-profile { background-color: #16a085; }
.btn-forum { background-color: #2980b9; }

.recipe-list-item {
    display: flex; align-items: center; padding: 0.75rem; margin-bottom: 0.5rem;
    border-radius: 8px; cursor: pointer; background-color: var(--surface-color);
    border: 1px solid var(--border-color); transition: all 0.2s; position: relative;
}
.recipe-list-item:hover { background-color: var(--bg-color); border-color: var(--primary-color); }
.recipe-list-item img { width: 55px; height: 55px; border-radius: 6px; object-fit: cover; margin-right: 1rem; }
.recipe-list-item h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.recipe-list-item small { color: var(--text-muted); font-size: 0.8rem; }
.inactive-badge { position: absolute; top: -5px; right: -5px; background-color: #e74c3c; color: white; font-size: 0.65rem; padding: 2px 6px; border-radius: 10px; font-weight: bold; }

.welcome-screen { text-align: center; margin-top: 5%; color: var(--text-muted); }
.welcome-logo { max-width: 320px; width: 100%; height: auto; margin-bottom: 1.5rem; }

/* RECIPE DETAIL DESKTOP */
.recipe-image-wrapper { position: relative; margin-bottom: 1.5rem; }
.recipe-image-wrapper img { width: 100%; max-height: 400px; object-fit: cover; border-radius: 12px; display: block; }

/* Aktionen direkt im Bild */
.recipe-header-actions { position: absolute; bottom: 1.5rem; right: 1.5rem; display: flex; gap: 0.8rem; z-index: 10; }
.image-action-btn { background-color: rgba(255, 255, 255, 0.9); color: #333; border: none; font-size: 1.3rem; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 8px rgba(0,0,0,0.3); transition: all 0.2s ease; cursor: pointer; margin: 0; padding: 0;}
.image-action-btn:hover { background-color: white; transform: scale(1.1); color: var(--primary-color); }
#fav-btn.active { color: #e74c3c; }

.recipe-meta { display: flex; gap: 1.5rem; color: var(--text-muted); margin-bottom: 1.5rem; align-items: center; }

/* PAPA TIPP - BLAU */
.tip-box { background-color: #e3f2fd; border-left: 4px solid #2196f3; padding: 1rem; border-radius: 6px; margin-bottom: 1.5rem; color: #0d47a1; }
body[data-theme="dark"] .tip-box { background-color: #0d2a45; color: #64b5f6; border-left-color: #2196f3; }

.recipe-socials { display: flex; gap: 10px; margin-bottom: 1.5rem; }
.social-link-btn { display: inline-block; padding: 8px 12px; border-radius: 6px; color: white; text-decoration: none; font-size: 0.9rem; font-weight: bold; }
.social-link-btn.youtube { background-color: #ff0000; }
.social-link-btn.tiktok { background-color: #000000; }
.social-link-btn.instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.social-link-btn.facebook { background-color: #1877f2; }

.recipe-nutrition { background-color: var(--nutrition-bg); padding: 1rem 1.25rem; border-radius: 8px; margin-bottom: 2rem; border-left: 4px solid var(--primary-color); }
.nutrition-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; font-size: 0.9rem; }

.recipe-body { display: grid; grid-template-columns: 1fr 1.8fr; gap: 2.5rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
#detail-ingredients { list-style: none; }
#detail-ingredients li { padding: 0.6rem 0; border-bottom: 1px dashed var(--border-color); }
#detail-steps { padding-left: 1.2rem; }
#detail-steps li { margin-bottom: 1.2rem; line-height: 1.6; }

/* EINKAUFSLISTE */
#shopping-list { list-style: none; }
#shopping-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-color); }
#shopping-list input[type="checkbox"] { width: 18px; height: 18px; margin: 0; cursor: pointer; flex-shrink: 0; }
#shopping-list li.checked span { text-decoration: line-through; color: var(--text-muted); }

/* SIDEBAR ACTIONS (ADMIN & BOOK BUTTONS EXAKT GLEICH) */
.sidebar-action-btn {
    display: flex; justify-content: center; align-items: center; gap: 10px;
    width: 100%; height: 48px; font-size: 1.05rem; font-weight: 700;
    border-radius: 8px; color: white; text-decoration: none; border: none;
    cursor: pointer; margin-bottom: 0.75rem; transition: background 0.2s, transform 0.1s;
}
.sidebar-action-btn:active { transform: scale(0.98); }
.sidebar-action-btn.admin { background-color: #c0392b; }
.sidebar-action-btn.admin:hover { background-color: #a53125; }
.sidebar-action-btn.book { background-color: #27ae60; margin-bottom: 1.5rem; }
.sidebar-action-btn.book:hover { background-color: #2ecc71; }

/* DEZENTE SOCIAL ICONS */
.sidebar-socials-container { display: flex; justify-content: space-around; font-size: 1.6rem; padding: 5px 0; }
.sidebar-socials-container a { color: var(--secondary-color); transition: color 0.2s; }
.sidebar-socials-container a:hover { color: var(--primary-color); }

/* ADMIN & MODALS */
.admin-card { background-color: var(--surface-color); border: 1px solid var(--border-color); padding: 1.5rem; border-radius: 10px; margin-bottom: 1.5rem; }
.admin-sticky-header { display: flex; gap: 10px; border-bottom: 2px solid var(--border-color); margin-bottom: 1.5rem; flex-wrap: wrap; }
.admin-tab { background: none; color: var(--text-muted); border-radius: 0; padding: 0.75rem 1rem; border-bottom: 3px solid transparent; }
.admin-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.table-container { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.9rem; min-width: 600px; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
th { background-color: var(--bg-color); }
.action-cell { display: flex; gap: 6px; }
.action-cell button { font-size: 0.8rem; padding: 5px 8px; margin-top:0; }
.status-badge { padding: 3px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: bold; color: white; }
.status-badge.active { background-color: #27ae60; }
.status-badge.banned { background-color: #e74c3c; }

.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.admin-grid-nutrition { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

#global-notification-bar { background-color: #2980b9; color: white; padding: 15px; margin-bottom: 20px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
#global-notification-bar button { background: rgba(255,255,255,0.25); color: white; padding: 8px 15px; border-radius: 6px; border: none; }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 3000; }
.modal-content { background-color: var(--surface-color); padding: 2.5rem; border-radius: 12px; width: 90%; max-width: 440px; position: relative; }
.close-btn { position: absolute; top: 1rem; right: 1.5rem; font-size: 1.8rem; cursor: pointer; color: var(--text-muted); }
.auth-tabs { display: flex; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border-color); }
.auth-tab { flex: 1; background: none; color: var(--text-muted); padding: 0.5rem; border-bottom: 3px solid transparent; }
.auth-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }

/* =========================================
   MOBILE LAYOUT
   ========================================= */
@media (max-width: 900px) {
    body { overflow: auto; height: auto; }
    #app-container { display: block; height: auto; }
    
    #mobile-header { 
        display: flex; justify-content: space-between; align-items: center; 
        height: var(--header-height); background-color: var(--surface-color); 
        padding: 0 1rem; border-bottom: 1px solid var(--border-color); 
        position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    }
    .mobile-icon-btn { background: none; border: none; color: var(--text-color); font-size: 1.6rem; padding: 0.5rem; cursor: pointer; }
    .mobile-title { font-weight: 700; font-size: 1.2rem; color: var(--primary-color); }
    
    #main-content { margin-top: var(--header-height); padding: 1rem; min-height: calc(100vh - var(--header-height)); overflow: visible; }
    
    #sidebar-left, #sidebar-right { 
        position: fixed; top: 0; height: 100vh; width: 85%; max-width: 350px; 
        z-index: 2000; background-color: var(--surface-color); transition: transform 0.3s ease; 
        box-shadow: 0 0 15px rgba(0,0,0,0.2); overflow-y: auto; padding-bottom: 80px;
    }
    #sidebar-left { left: 0; transform: translateX(-100%); }
    #sidebar-left.open { transform: translateX(0); }
    #sidebar-right { right: 0; transform: translateX(100%); }
    #sidebar-right.open { transform: translateX(0); }
    
    .mobile-close-btn { display: block; }
    #mobile-overlay.active { display: block; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); z-index: 1500; }

    .desktop-only { display: none !important; }
    .desktop-only-btn { display: none !important; }
    .mobile-recipe-actions { display: flex; gap: 10px; margin-bottom: 1.5rem; }
    .mobile-action-btn { flex: 1; padding: 10px; font-size: 0.95rem; border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--primary-color); background-color: var(--surface-color); color: var(--primary-color); }
    
    .recipe-image-wrapper { margin: -1rem -1rem 1rem -1rem; }
    .recipe-image-wrapper img { height: 35vh; border-radius: 0; }
    .recipe-meta { font-size: 0.9rem; justify-content: space-between; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; flex-wrap: wrap; }
    .recipe-body { display: flex; flex-direction: column; gap: 2rem; border: none; padding-top: 0; }
    .nutrition-grid { grid-template-columns: repeat(2, 1fr); }
    
    #admin-menu, #sacha-admin-panel { display: none !important; }
}

/* =========================================
   DRUCK & PDF ANSICHT
   ========================================= */
@media print {
    body { background: white !important; color: black !important; overflow: auto !important; height: auto !important; }
    #app-container { display: block; }
    #sidebar-left, #sidebar-right, #mobile-header, .no-print { display: none !important; }
    #main-content { padding: 0 !important; margin: 0 !important; }
    .print-only { display: inline-block !important; }
    
    .recipe-image-wrapper img { max-height: 300px; object-fit: contain; }
    .recipe-body { display: block; }
    .ingredients-column, .steps-column { width: 100%; margin-bottom: 2rem; page-break-inside: avoid; }
    #detail-ingredients li { border-bottom: 1px solid #ccc; }
    
    #shopping-list-container { display: block !important; }
    #shopping-list li { border-bottom: 1px solid #000; font-size: 14pt; padding: 10px 0; }
}