/* ==========================================================================
   KLEINE MÜHLE CRM 2026 - ELITE UI CORE
   ========================================================================== */

/* --- 0. Fonts (Lokal gehostet & DSGVO konform) --- */
@font-face {
    font-family: 'Lato';
    font-style: normal;
    font-weight: 400;
    src: url('/assets/fonts/Lato-Regular.woff2') format('woff2');
    font-display: swap;
}
@font-face {
    font-family: 'Lato';
    font-style: italic;
    font-weight: 400;
    src: url('/assets/fonts/Lato-Italic.woff2') format('woff2');
    font-display: swap;
}
@font-face {
    font-family: 'Lato';
    font-style: normal;
    font-weight: 700;
    src: url('/assets/fonts/Lato-Bold.woff2') format('woff2');
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400;
    src: url('/assets/fonts/PlayfairDisplay-Regular.woff2') format('woff2');
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 600;
    /* Wir mappen 600 und 700 auf Bold, da es in der master.css für h1-h4 verlangt wird */
    src: url('/assets/fonts/PlayfairDisplay-Bold.woff2') format('woff2');
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    src: url('/assets/fonts/PlayfairDisplay-Bold.woff2') format('woff2');
    font-display: swap;
}

/* --- 1. System Variablen (CI Konform) --- */
:root {
    /* Brand Colors */
    --c-marine: #1A3A53;
    --c-beige-light: #EAE2D7;
    --c-beige-bg: #FCFBF9;
    --c-blue-grey: #A0AEC0;
    --c-text: #2c3e50;
    --c-gold: #C4A380;
    
    /* Semantic Colors */
    --c-success: #557A46;
    --c-success-bg: #eaf1e8;
    --c-danger: #9B4444;
    --c-danger-bg: #f8e9e9;
    --c-warning: #D4A373;
    --c-warning-bg: #fcf4ec;
    
    /* UI Metrics */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 72px;
    
    /* Shadows & Radii */
    --shadow-soft: 0 4px 20px rgba(26, 58, 83, 0.05);
    --shadow-hover: 0 8px 30px rgba(26, 58, 83, 0.08);
    --shadow-panel: -10px 0 40px rgba(0,0,0,0.08);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Transitions */
    --trans-fast: 0.15s ease-out;
    --trans-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. CSS Reset & Typography --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; width: 100%; overflow: hidden; }

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--c-beige-bg);
    color: var(--c-text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    color: var(--c-marine);
    font-weight: 600;
    line-height: 1.3;
}

a { color: var(--c-marine); text-decoration: none; transition: color var(--trans-fast); }
a:hover { color: var(--c-gold); }

/* --- 3. Utility Classes (Das Rückgrat) --- */
.d-flex { display: flex; }
.flex-column { display: flex; flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-grow-1 { flex-grow: 1; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.m-0 { margin: 0 !important; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-muted { color: var(--c-blue-grey); }
.text-primary { color: var(--c-marine); }
.text-success { color: var(--c-success); }
.text-danger { color: var(--c-danger); }
.font-bold { font-weight: 700; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.5px; }

/* --- 4. Layout Architecture --- */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Die magische Hover-Sidebar */
.sidebar {
    width: var(--sidebar-collapsed);
    background-color: var(--c-marine);
    display: flex;
    flex-direction: column;
    transition: width var(--trans-smooth);
    z-index: 100;
    position: relative;
    border-right: 1px solid rgba(255,255,255,0.05);
    overflow-x: hidden;
	flex-shrink: 0;
}
.sidebar:hover { width: var(--sidebar-width); box-shadow: var(--shadow-panel); }

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}
.sidebar-logo-icon { color: var(--c-gold); width: 24px; height: 24px; flex-shrink: 0; }
.sidebar-logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: #fff;
    margin-left: 16px;
    opacity: 0;
    transition: opacity var(--trans-fast);
}
.sidebar:hover .sidebar-logo-text { opacity: 1; transition-delay: 0.1s; }

.sidebar-nav { padding: 24px 0; display: flex; flex-direction: column; gap: 8px; flex-grow: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    white-space: nowrap;
    position: relative;
}
.sidebar-nav a i { width: 24px; height: 24px; flex-shrink: 0; }
.sidebar-nav a span { margin-left: 16px; opacity: 0; transition: opacity var(--trans-fast); }
.sidebar:hover .sidebar-nav a span { opacity: 1; transition-delay: 0.1s; }

.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-nav a.active {
    color: var(--c-gold);
    background: rgba(196, 163, 128, 0.1);
    border-left: 4px solid var(--c-gold);
    padding-left: 20px;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid rgba(234, 226, 215, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.search-bar { position: relative; width: 450px; }
/* NEU: Wir sprechen i UND svg an, und machen das Icon "klick-durchlässig" (pointer-events: none) */
.search-bar i, .search-bar svg { 
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%); 
    color: var(--c-blue-grey); width: 18px; height: 18px; pointer-events: none; 
}
.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--c-beige-light);
    border-radius: 30px;
    background: var(--c-beige-bg);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--trans-fast);
    outline: none;
}
.search-bar input:focus { background: #fff; border-color: var(--c-marine); box-shadow: 0 0 0 3px rgba(26,58,83,0.1); }

.content-area {
    padding: 32px;
    overflow-y: auto;
    flex-grow: 1;
}

/* --- 5. UI Components --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

.card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(234, 226, 215, 0.6);
    transition: box-shadow var(--trans-fast);
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-header { font-size: 1.25rem; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--c-beige-light); display: flex; align-items: center; gap: 8px;}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 700;
    font-size: 0.9rem; cursor: pointer; border: 1px solid transparent;
    transition: var(--trans-fast); font-family: inherit; outline: none;
}
.btn i { width: 18px; height: 18px; }
.btn-primary { background: var(--c-marine); color: #fff; }
.btn-primary:hover { background: #112638; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,83,0.2); }
.btn-outline { background: #fff; border-color: var(--c-blue-grey); color: var(--c-text); }
.btn-outline:hover { background: var(--c-beige-bg); border-color: var(--c-marine); color: var(--c-marine); }
.btn-icon { padding: 8px; background: transparent; color: var(--c-blue-grey); border-radius: 50%; }
.btn-icon:hover { background: var(--c-beige-bg); color: var(--c-marine); }

/* Badges */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; display: inline-flex; align-items: center; gap: 4px; }
.badge-green { background: var(--c-success-bg); color: var(--c-success); }
.badge-red { background: var(--c-danger-bg); color: var(--c-danger); }
.badge-blue { background: rgba(26,58,83,0.08); color: var(--c-marine); }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th { padding: 16px; font-weight: 700; color: var(--c-blue-grey); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; border-bottom: 2px solid var(--c-beige-light); }
.table td { padding: 16px; border-bottom: 1px solid rgba(234, 226, 215, 0.4); vertical-align: middle; }
.table tbody tr { transition: background var(--trans-fast); }
.table tbody tr:hover { background-color: var(--c-beige-bg); }

/* --- 6. Das neue Slide-Over Panel --- */
.slide-over-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 58, 83, 0.3);
    backdrop-filter: blur(3px);
    z-index: 1000;
    opacity: 0; visibility: hidden;
    transition: var(--trans-smooth);
}
.slide-over-overlay.active { opacity: 1; visibility: visible; }

.slide-over-panel {
    position: fixed; top: 0; right: -600px; bottom: 0;
    width: 600px; max-width: 100vw;
    background: #fff;
    box-shadow: var(--shadow-panel);
    z-index: 1001;
    display: flex; flex-direction: column;
    transition: transform var(--trans-smooth);
}
.slide-over-overlay.active .slide-over-panel { transform: translateX(-600px); }

.slide-over-header { padding: 24px; border-bottom: 1px solid var(--c-beige-light); display: flex; justify-content: space-between; align-items: center; }
.slide-over-content { padding: 24px; overflow-y: auto; flex-grow: 1; background: var(--c-beige-bg); }

/* ==========================================================================
   2026 UI FIXES: ACTIONBAR & COMPACT COMPONENTS
   ========================================================================== */

/* --- Actionbar Custom Selects (Versteckt die Windows-Pfeile) --- */
.actionbar-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%231A3A53" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>') no-repeat right center;
    padding: 4px 24px 4px 8px; /* Platz für den neuen SVG-Pfeil */
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 700;
    color: var(--c-marine);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all var(--trans-fast);
    outline: none;
}
.actionbar-select:hover, .actionbar-select:focus {
    background-color: var(--c-beige-bg);
    border-color: var(--c-beige-light);
}

/* --- Macro Dropdown Buttons (Überschreibt Standard-Browser-Buttons) --- */
.hover-dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 240px;
    box-shadow: var(--shadow-hover);
    border-radius: var(--radius-sm);
    z-index: 200;
    top: 100%;
    right: 0;
    border: 1px solid var(--c-beige-light);
    padding: 0.5rem 0;
    overflow: hidden;
}
.hover-dropdown:hover .hover-dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease;
}
.hover-dropdown-content button {
    width: 100%;
    text-align: left;
    background: none !important;
    border: none !important;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--c-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    transition: all var(--trans-fast);
}
.hover-dropdown-content button:hover {
    background-color: var(--c-beige-bg) !important;
    color: var(--c-marine);
    padding-left: 1.2rem; /* Eleganter Einrück-Effekt beim Hover */
}
.hover-dropdown-content button i, 
.hover-dropdown-content button svg {
    color: var(--c-blue-grey);
    transition: color var(--trans-fast);
}
.hover-dropdown-content button:hover i, 
.hover-dropdown-content button:hover svg {
    color: var(--c-marine);
}

/* ==========================================================================
   2026 UI FIXES: ACTIONBAR PILLS & CLICK-DROPDOWNS
   ========================================================================== */

/* --- Die edlen Actionbar Select-Kapseln (Pills) --- */
.actionbar-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--c-beige-bg) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%231A3A53" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>') no-repeat right 10px center;
    padding: 6px 32px 6px 12px;
    border: 1px solid var(--c-beige-light);
    border-radius: 20px; /* Moderne Pillen-Form */
    font-weight: 700;
    color: var(--c-marine);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all var(--trans-fast);
    outline: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.actionbar-select:hover, .actionbar-select:focus {
    background-color: #fff;
    border-color: var(--c-blue-grey);
    box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}

/* --- Klick-Dropdowns (HubSpot Style) --- */
.dropdown-wrapper { position: relative; display: inline-block; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;          /* <-- Das hält es am rechten Rand des Buttons fest */
    left: auto;        /* <-- WICHTIG: Das zwingt es, nach links aufzuklappen */
    background: #fff;
    min-width: 240px;
    box-shadow: 0 10px 25px rgba(26,58,83,0.15);
    border: 1px solid var(--c-beige-light);
    border-radius: var(--radius-md);
    z-index: 1000;
    padding: 0.5rem 0;
}
.dropdown-menu.show { display: block; animation: dropFade 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes dropFade { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.dropdown-menu button {
    width: 100%; text-align: left; background: none; border: none;
    padding: 0.6rem 1.2rem; font-size: 0.85rem; color: var(--c-text);
    cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
    font-family: inherit; transition: background var(--trans-fast);
}
.dropdown-menu button:hover { background: var(--c-beige-bg); color: var(--c-marine); }
.dropdown-menu button i, .dropdown-menu button svg { color: var(--c-blue-grey); width: 16px; transition: color 0.2s; }
.dropdown-menu button:hover i, .dropdown-menu button:hover svg { color: var(--c-marine); }

/* ==========================================================================
   2026 MODALS & OVERLAYS (Hat gefehlt!)
   ========================================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(26, 58, 83, 0.4); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; opacity: 0; visibility: hidden; transition: all 0.2s ease-out;
}
.modal-overlay.active {
    opacity: 1; visibility: visible;
}
.modal-content {
    background: #fff; width: 100%; max-width: 500px;
    border-radius: var(--radius-md); padding: 2rem;
    box-shadow: var(--shadow-panel);
    transform: translateY(-20px) scale(0.98);
    transition: all 0.2s ease-out;
    border-top: 4px solid var(--c-marine);
    position: relative;
}
.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

/* ==========================================================================
   OMNI-SEARCH (Spotlight)
   ========================================================================== */
.omni-search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    min-width: 500px;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: 0 15px 35px rgba(26, 58, 83, 0.2);
    border: 1px solid var(--c-beige-light);
    z-index: 2000;
    overflow: hidden;
    display: none;
}
.omni-search-results.active {
    display: block;
    animation: dropFade 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.omni-search-group {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--c-beige-light);
}
.omni-search-group:last-child { border-bottom: none; }
.omni-search-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--c-blue-grey);
    padding: 0.5rem 1.2rem;
    letter-spacing: 0.5px;
}
.omni-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    color: var(--c-text);
    text-decoration: none;
    transition: background var(--trans-fast);
    cursor: pointer;
}
.omni-search-item:hover {
    background: var(--c-beige-bg);
    color: var(--c-marine);
}
.omni-search-item i, .omni-search-item svg { width: 16px; color: var(--c-blue-grey); }
.omni-search-empty {
    padding: 2rem;
    text-align: center;
    color: var(--c-blue-grey);
    font-size: 0.85rem;
}

/* ==========================================================================
   2026 SETTINGS TOGGLE SWITCH
   ========================================================================== */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0;}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--c-blue-grey); transition: .3s; border-radius: 24px; }
.toggle-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2);}
.toggle-switch input:checked + .toggle-slider { background-color: var(--c-success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Vertikale Tabs für Settings */
.settings-nav { display: flex; flex-direction: column; gap: 0.2rem; }
.settings-nav-btn { text-align: left; padding: 0.75rem 1rem; background: transparent; border: none; border-radius: var(--radius-sm); font-weight: 700; color: var(--c-text); cursor: pointer; transition: all var(--trans-fast); display: flex; align-items: center; gap: 0.75rem; font-family: inherit;}
.settings-nav-btn:hover { background: var(--c-beige-bg); color: var(--c-marine); }
.settings-nav-btn.active { background: rgba(26, 58, 83, 0.05); color: var(--c-marine); }

/* ==========================================================================
   MARKETING TABS (Navigation)
   ========================================================================== */
.marketing-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 30px; /* Echter Abstand! */
    border-bottom: 1px solid var(--c-beige-light);
    margin-bottom: 20px;
}
.marketing-tab {
    text-decoration: none;
    color: var(--c-blue-grey);
    padding: 10px 0;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    transition: all 0.2s;
}
.marketing-tab:hover {
    color: var(--c-primary);
}
.marketing-tab.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-gold);
    font-weight: bold;
}

/* ==========================================================================
   MOBILE MENU BUTTON (Auf dem Desktop unsichtbar!)
   ========================================================================== */
.mobile-menu-btn { 
    display: none; 
    background: transparent; 
    border: none; 
    color: var(--c-marine); 
    cursor: pointer; 
    outline: none; 
}

/* ==========================================================================
   2026 MOBILE RESPONSIVENESS (Nativer App-Scroll & Flow)
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. Nativer Scroll - Keine abgeschnittenen Seiten mehr! */
    html, body { height: auto !important; overflow-y: auto !important; overflow-x: hidden !important; }
    
    /* 2. Flex-Wrapper sprengen! Forciert den natürlichen Block-Fluss von oben nach unten */
    .app-wrapper { display: block !important; height: auto !important; min-height: 100vh !important; }
    .main-content { display: block !important; height: auto !important; min-width: 0 !important; }
    .content-area { display: block !important; height: auto !important; overflow: visible !important; padding: 15px !important; }

    /* 3. Topbar aufräumen & Suchfeld 100% */
    .topbar { display: flex !important; flex-wrap: wrap !important; height: auto !important; min-height: 60px !important; padding: 10px 15px !important; }
    .mobile-menu-btn { display: block !important; order: 1; margin-right: 15px; }
    .search-bar { width: 100% !important; order: 3; margin-top: 10px !important; }
    .hide-mobile, .user-name-text, .user-avatar, .status-text, .notif-btn { display: none !important; }

    /* 4. Sidebar als Off-Canvas Menü (unsichtbar bis Klick) */
    .sidebar { position: fixed !important; left: -320px !important; top: 0 !important; bottom: 0 !important; width: 280px !important; z-index: 9999 !important; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important; box-shadow: none !important; }
    .sidebar.mobile-open { left: 0 !important; box-shadow: 10px 0 40px rgba(0,0,0,0.6) !important; }
    .mobile-sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(26,58,83,0.6); z-index: 9998; backdrop-filter: blur(3px); }
    .mobile-sidebar-overlay.active { display: block; animation: fadeIn 0.2s ease; }
}