/* ==========================================================================
   1. GLOBALE RESETS & BASIS
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    background-color: #000000; 
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    color: #ffffff;
    overflow: auto; /* Seite scrollen erlauben */
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   LOGIN PAGE STYLES (Wiederherstellung)
   ========================================================================== */
.login-page {
    background-color: #0f172a; /* Dunkler Hintergrund */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.login-card {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    color: white;
}

.login-card h2 {
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-card .subtitle {
    color: #888;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #efefef;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: #262626;
    border: 1px solid #444;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    box-sizing: border-box;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background-color: #f97316; /* Orange */
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background-color: #ea580c;
}

/* ==========================================================================
   3. HEADER / TOP-BAR (Zentrale Navigation)
   ========================================================================== */
.top-bar {
    height: 60px;
    background-color: #000000;
    border-bottom: 1px solid #1f2937;
    display: flex;
    align-items: center;
    padding: 0 25px;
    z-index: 1000;
}

/* Linke Gruppe: Logo + Brand + Nav rücken ganz nach links */
.top-bar-left-content {
    display: flex;
    align-items: center;
    gap: 40px; /* Abstand zwischen Branding und Menü */
    flex: 1;   /* Schiebt Logout-Bereich nach rechts */
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-placeholder {
    width: 28px;
    height: 28px;
    background: #ffffff;
    border-radius: 6px;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTIyIDE5YTIgMiAwIDAgMS0yIDJINGEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxNmEyIDIgMCAwIDEgMiAydjE0WiIvPjxwYXRoIGQ9Ik02IDhoMTJNNiAxMmgxMk02IDE2aDgiLz48L3N2Zz4=');
    background-size: 18px;
    background-repeat: no-repeat;
    background-position: center;
}

.brand-name {
    font-weight: 700;
    font-size: 1.15rem;
    color: #ffffff;
    white-space: nowrap;
}

/* Navigation Links */
.top-nav {
    display: flex;
    gap: 6px;
}

.nav-link {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: 0.2s ease;
}

.nav-link:hover, 
.nav-link.active {
    background-color: #1f2937;
    color: #ffffff;
}

/* ==========================================================================
   4. DROPDOWNS
   ========================================================================== */
.nav-item {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: #0a0a0a;
    border: 1px solid #262626;
    border-radius: 10px;
    min-width: 180px;
    padding: 6px;
    margin-top: 5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s ease;
}

.nav-item:hover .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 10px 12px;
    color: #a1a1aa;
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: 0.2s;
}

.dropdown-menu a:hover {
    background-color: #1a1a1a;
    color: #ffffff;
}

/* ==========================================================================
   5. RECHTE SEITE (USER & LOGOUT)
   ========================================================================== */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.online-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
}

.logout-btn {
    background-color: #ffffff;
    color: #000000;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    transition: opacity 0.2s;
}

.logout-btn:hover {
    opacity: 0.8;
}

/* ==========================================================================
   6. INHALTSBEREICH (CANVAS)
   ========================================================================== */
.content-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.canvas {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000000;
    background-image: radial-gradient(#1e293b 1px, transparent 1px);
    background-size: 40px 40px; /* Dezentes Punkt-Raster */
}

.placeholder-text {
    color: #1e293b;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 5px;
    text-transform: uppercase;
    user-select: none;
}

/* Hilfsklasse zum Aufräumen alter Reste */
.top-bar-side { display: none; }

/* ==========================================================================
   STATUS WIDGET
   ========================================================================== */
.status-box {
    width: 380px;
    background: linear-gradient(180deg, #0b1220, #08090b);
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 14px;
    color: #e6eef8;
    box-shadow: 0 6px 20px rgba(0,0,0,0.6);
    position: fixed; /* oben links unter Header */
    top: 80px; /* etwas tiefer, damit keine Überschneidung mit Header */
    right: 20px; /* links positionieren */
    z-index: 2000;
    max-height: calc(100vh - 160px); /* oben+unten jeweils 80px */
    overflow: auto;
}

/* simplified: removed advanced per-process and dir styles to restore stable appearance */

/* basic bar styles are defined below (keep duplicated safe) */

.status-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:10px;
    font-weight:700;
    color:#ffffff;
}

.status-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:10px;
}

.status-item{
    background: rgba(255,255,255,0.02);
    padding:10px;
    border-radius:8px;
}

.status-item .label{ font-size:0.85rem; color:#9ca3af; margin-bottom:6px }
.status-item .value{ font-size:1.05rem; font-weight:700 }

.bar{ background: rgba(255,255,255,0.06); height:10px; border-radius:6px; margin-top:8px; overflow:hidden; border:1px solid rgba(255,255,255,0.03); }
.bar-fill{ height:100%; background:linear-gradient(90deg,#06b6d4,#60a5fa); width:0%; box-shadow: inset 0 -2px 6px rgba(0,0,0,0.4); transition: width 300ms ease; }

@media (max-width:420px){ .status-box{ left:10px; right:10px; } .status-grid{ grid-template-columns:1fr 1fr } }
/* Removed 4-column layout to keep 2x2 arrangement for clarity on large screens */

/* ==========================================================================
   LOGS PAGE STYLES
   ========================================================================== */
.logs-controls {
    display:flex;
    gap:8px;
    align-items:center;
    margin-bottom:12px;
    flex-wrap:wrap;
}
.logs-controls label { color:#9ca3af; font-size:0.85rem; }
.logs-controls select, .logs-controls input, .logs-controls button {
    background:#0b1220;
    color:#e6eef8;
    border:1px solid #1f2937;
    padding:8px 10px;
    border-radius:6px;
}

.log-box {
    background: linear-gradient(180deg, #071019, #05060a);
    border:1px solid #1f2937;
    border-radius:8px;
    padding:12px;
    max-height:60vh;
    overflow:auto;
}

.log-meta { font-size:0.8rem; color:#9ca3af; margin-bottom:8px; display:flex; gap:10px; align-items:center; }

.log-pre {
    font-family: monospace;
    font-size:0.85rem;
    line-height:1.35;
    white-space:pre-wrap;
    word-break:break-word;
    color:#e6eef8;
    background:transparent;
    border-radius:6px;
    padding:8px;
}

/* ==========================================================================
   MANAGE MEALS PAGE
   ========================================================================== */
.manage-meals {
    padding: 36px 48px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
}

.manage-meals .container {
    width: 100%;
    max-width: 1100px;
}

.controls-row {
    display: flex;
    gap: 18px;
    width: 100%;
    align-items: flex-start;
}
.controls-left, .controls-right { flex: 1 1 0; }
.controls-left { max-width: 560px; }
.controls-right { min-width: 280px; }

@media (max-width: 900px) {
    .controls-row { flex-direction: column; }
}

.manage-meals h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
    color: #fff;
}
.manage-meals h2 {
    font-size: 1.05rem;
    margin: 12px 0 10px;
    color: #cbd5e1;
    font-weight: 600;
}

.card {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 6px 20px rgba(2,6,23,0.6);
}

/* inputs inside cards should have a consistent, dark appearance */
.card input[type="text"], .card input[type="search"], .card textarea {
    background: #030312 !important;
    border: 1px solid rgba(255,255,255,0.04) !important;
    color: #e6eef8 !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
}

.meal-form { max-width: 100%; margin-bottom: 8px; }
.form-row { margin-bottom: 12px; }
.form-row label { font-size: 0.95rem; color: #e6eef8; display:block; }
.form-row input[type="text"], .form-row textarea {
    width: 100%;
    padding: 12px 14px;
    background: #030312;
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    color: #e6eef8;
    font-size: 0.98rem;
    transition: box-shadow 120ms ease, border-color 120ms ease;
}
.form-row input[type="text"]:focus, .form-row textarea:focus { box-shadow: 0 6px 18px rgba(2,6,23,0.6); border-color: #374151; outline: none; }

/* two-column form layout for add-meal */
.meal-form .form-grid { display:flex; gap:18px; align-items:flex-end; }
.meal-form .form-grid .col-left { flex: 1 1 35%; }
.meal-form .form-grid .col-right { flex: 2 1 55%; }
.meal-form .form-grid .col-action { flex: 0 0 140px; display:flex; align-items:flex-end; justify-content:flex-end; }
.meal-form .form-grid .col-action .btn { margin: 0; }


.table { width: 100%; border-collapse: collapse; max-width: 1200px; border-radius: 8px; overflow: hidden; }
.table th, .table td {
    padding: 12px 14px; vertical-align: top; border-bottom: 1px solid rgba(255,255,255,0.03);
}
.table thead th { text-align: left; color: #9aa7b8; font-size: 0.95rem; background: rgba(255,255,255,0.01); }
.table tbody tr:nth-child(odd) { background: rgba(255,255,255,0.01); }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }

.btn { display: inline-block; padding: 8px 12px; border-radius: 10px; background: linear-gradient(90deg,#0ea5a4,#3b82f6); color: #fff; text-decoration: none; border: none; font-size: 0.95rem; cursor: pointer; box-shadow: 0 6px 18px rgba(2,6,23,0.45); }
.btn:hover { transform: translateY(-1px); }
.btn-link { background: transparent; color: #9ca3af; border: none; padding: 4px 8px; }
.btn-danger { background: linear-gradient(90deg,#ef4444,#dc2626); box-shadow: 0 6px 18px rgba(220,38,38,0.18); }

.sample-actions { margin: 12px 0; }

@media (max-width: 900px) {
    .manage-meals { padding: 18px; }
    .table { font-size: 0.92rem; }
}

@media (max-width: 900px) {
    .meal-form .form-grid { flex-direction: column; }
    .meal-form .form-grid .col-left { flex: none; max-width: 100%; }
    .meal-form .form-grid .col-right { flex: none; }
    .meal-form .form-grid .col-action { flex: none; display:flex; justify-content:flex-end; margin-top:8px; }
}

/* Page body layout: main + sidebar (dinnerplan widget) */
.page-body { display:flex; gap:24px; align-items:flex-start; }
.page-body .main-column { flex: 1 1 auto; }
.sidebar-column { flex: 0 0 380px; max-width: 380px; }

/* When the widget is included inline, override its fixed positioning */
.inline-dinnerplan .dinnerplan-box {
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    max-height: none !important;
    margin: 0;
}

.inline-dinnerplan .dinnerplan-content iframe { min-height: 400px; }

@media (max-width: 1100px) {
    .page-body { flex-direction: column; }
    .sidebar-column { width: 100%; max-width: 100%; }
}

.btn { display: inline-block; padding: 6px 10px; border-radius: 6px; background: #111827; color: #fff; text-decoration: none; border: 1px solid #2b2b2b; font-size: 0.9rem; }
.btn:hover { opacity: 0.9; }
.btn-link { background: transparent; color: #9ca3af; border: none; padding: 4px 8px; }
.btn-danger { background: #dc2626; border-color: #b91c1c; }

@media (max-width: 900px) {
    .manage-meals { padding: 18px; }
    .table { font-size: 0.92rem; }
}
