/* --- 1. SETUP & VARIABLES --- */
:root {
    --color-primary: 59 130 246; 

    --transition-speed: 0.3s;
    --transition-curve: cubic-bezier(0.4, 0, 0.2, 1);

    --bg-body: #DAE1EA; 
    
    --bg-gradient-start: rgb(var(--color-primary) / 0.15);
    --bg-gradient-end: transparent;

    --bg-panel: rgba(241, 245, 249, 0.85);
    --border-panel: rgba(255, 255, 255, 0.6);

    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);

    --text-main: #1e293b;        
    --text-muted: #64748b;

    --input-bg: #f8fafc;
    --input-border: #94a3b8;
    --input-ring: 226, 232, 240;

    --scrollbar-track: #cbd5e1;
    --scrollbar-thumb: #94a3b8;
    --scrollbar-thumb-hover: #64748b;
}

/* --- DARK MODE --- */
.dark {
    --bg-body: #000000;
    
    --bg-gradient-start: rgb(var(--color-primary) / 0.25);
    --bg-gradient-end: rgba(0, 0, 0, 0);

    --bg-panel: rgba(18, 18, 20, 0.85);
    --border-panel: rgba(255, 255, 255, 0.12);
    
    --shadow-card: 0 0 0 1px rgba(255,255,255,0.05), 0 10px 30px -10px rgba(0,0,0,0.8);

    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;

    --input-bg: #09090b;
    --input-border: rgba(255, 255, 255, 0.15);
    --input-ring: 40, 40, 40;

    --scrollbar-track: #09090b;
    --scrollbar-thumb: #3f3f46;
    --scrollbar-thumb-hover: #52525b;
}

[x-cloak] { display: none !important; }

/* --- 2. FONTS --- */
@font-face { font-family: 'Inter'; src: url('Inter-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('Inter-SemiBold.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('Inter-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('Inter-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }

/* --- 3. GLOBAL STYLES --- */

body, aside, .glass-panel, .mobile-header, .mobile-nav {
    transition: background-color var(--transition-speed) var(--transition-curve),
                color var(--transition-speed) var(--transition-curve),
                border-color var(--transition-speed) var(--transition-curve);
}

body { 
    background-color: var(--bg-body); 
    background-image: 
        radial-gradient(circle at 0% 0%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 50%), 
        radial-gradient(circle at 100% 100%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 50%);
    background-attachment: fixed;
    color: var(--text-main); 
    font-family: 'Inter', sans-serif; 
    overflow: hidden;
    
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* --- 4. COMPONENTS --- */

.glass-panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-panel);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
}

.dark .glass-panel {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.input-modern {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.dark .input-modern {
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.3); 
}

.input-modern:focus {
    border-color: rgb(var(--color-primary));
    box-shadow: 0 0 0 2px rgba(var(--input-ring), 1), 0 0 0 4px rgba(var(--color-primary), 0.25);
    outline: none;
}

.input-modern::placeholder {
    color: #64748b; 
    opacity: 1;
}
.dark .input-modern::placeholder {
    color: #71717a;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

select option {
    background-color: var(--input-bg);
    color: var(--text-main);
    padding: 10px;
}

.dark select option {
    background-color: #18181b;
    color: white;
}

.btn-glow {
    background: rgb(var(--color-primary));
    color: white;
    transition: background-color 0.2s, transform 0.1s, filter 0.2s, box-shadow 0.2s;
}
.btn-glow:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(var(--color-primary), 0.4);
}
.btn-glow:active {
    transform: translateY(0);
    box-shadow: none;
}

.nav-item { 
    position: relative; 
    color: var(--text-muted);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-item::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: rgb(var(--color-primary)); border-radius: 0 4px 4px 0; transform: scaleY(0); transition: transform 0.2s ease;
}

.nav-item.active { 
    background: rgb(var(--color-primary) / 0.1); 
    color: rgb(var(--color-primary)); 
    font-weight: 600;
}
.nav-item.active::before { transform: scaleY(1); }

.nav-item:hover:not(.active) { 
    background: rgba(148, 163, 184, 0.1); 
    color: var(--text-main); 
}
.dark .nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

/* --- ANIMATION FIX --- */

.nav-item svg,
.nav-item i {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease, filter 0.2s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
}

.nav-item:hover svg,
.nav-item:hover i {
    transform: scale(1.15) rotate(-8deg) translateY(-2px) translateZ(0);
    color: rgb(var(--color-primary));
    filter: drop-shadow(0 4px 6px rgba(var(--color-primary), 0.4));
}

/* --- 5. UTILS --- */
.small-mode-hidden { display: none !important; }
body.is-small-mode .hide-in-small { display: none !important; }
body.is-small-mode aside { display: none !important; }
body.is-small-mode .md\:hidden { display: none !important; } 
body.is-small-mode main { padding: 1rem !important; padding-bottom: 1rem !important; }
body.is-small-mode .glass-panel { padding: 1rem !important; }

.step-number {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 0 rgba(59, 130, 246, 0)); }
    50% { transform: scale(1.1); opacity: 0.9; filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5)); }
}

@keyframes spin-custom {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-breathe {
    animation: breathe 3s infinite ease-in-out;
}

.animate-spin-custom {
    animation: spin-custom 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.text-adaptive { color: var(--text-main); }
.text-adaptive-muted { color: var(--text-muted); }

@keyframes float-slow { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-20px); } }
@keyframes float-delayed { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-15px); } }
.animate-float-slow { animation: float-slow 6s ease-in-out infinite; }
.animate-float-delayed { animation: float-delayed 7s ease-in-out infinite 1s; }
.will-change-transform { will-change: transform, opacity; }

.custom-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

/* --- 6. CALENDAR POPUP --- */

.calendar-popup {
    /* Basis Layout */
    position: absolute;
    bottom: 100%; /* Standard für Listenansicht (popup geht nach oben) */
    margin-bottom: 0.75rem;
    z-index: 50;
    width: 18rem;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    border-radius: 0.75rem;
    pointer-events: none; /* Events standardmäßig aus, wird interaktiv wenn sichtbar */
    text-align: left;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    transition: all 0.2s ease-out;
    transform-origin: bottom;
    
    /* Whitemode Design */
    background-color: white;
    border: 1px solid #e2e8f0; /* slate-200 */
}

/* Überschreibung für Datepicker im Write-Tab (popup geht nach unten) */
.datepicker-popup {
    bottom: auto !important;
    top: 100% !important;
    margin-top: 0.5rem;
    margin-bottom: 0;
    transform-origin: top !important;
    pointer-events: auto !important; /* Muss klickbar sein */
}

/* Darkmode Design - Milchglas Effekt */
.dark .calendar-popup {
    background-color: rgba(15, 15, 15, 0.90); /* Fast deckendes Dunkelgrau */
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
}