/* Verfeinerte Sidebar Styles */
:root {
    --sidebar-w: 13.5rem;
    /* reduziert von 16rem um ca. 15% */
}

.sidebar {
    --sidebar-bg: hsl(var(--background));
    --sidebar-hover: #f6f6f6;
    --sidebar-active: #f6f6f6;
    --sidebar-text: #000000;
    /* Echtes Schwarz */
    --sidebar-text-active: #000000;
    /* Echtes Schwarz */

    /* background-color: hsl(var(--background)) !important; // Entfernt, wird durch Tailwind im EJS gesteuert */
    border-right: 1px solid hsl(var(--border));
    height: 100vh;
    position: relative;
}

/* Entferne den linken Rand des Headers im Desktop-Modus */
@media (min-width: 1024px) {
    header {
        border-left: none !important;
    }

    /*     .sidebar {
        border-right: none !important;
    } */

    /* Verhindere Doppelrand zwischen Sidebar und Content */
    .sidebar {
        height: 100vh;
        margin-top: 0;
        box-shadow: none;
        border-right: none;
    }

    /* Verhindere Border zwischen Sidebar und Header */
    .sidebar::before {
        content: none !important;
    }

    /* Zentrierte Icons für eingeklappte Sidebar */
    .sidebar:not(.mobile-open)[style*="4rem"] .sidebar-link {
        @apply justify-center w-full px-0;
    }

    .sidebar:not(.mobile-open)[style*="4rem"] .sidebar-icon {
        @apply w-6 h-6;
        /* größer, wie im Mockup */
    }

    /* Entferne zusätzliche Abstände zwischen Icons wenn collapsed */
    .sidebar:not(.mobile-open)[style*="4rem"] nav.space-y-6,
    .sidebar:not(.mobile-open)[style*="4rem"] nav>*+* {
        margin-top: 0.25rem !important;
        /* Einheitlicher Abstand wie in der expanded Sidebar */
    }
}

/* Mobile Sidebar spezifische Styles */
@media (max-width: 1023px) {
    .sidebar.mobile-open {
        /* --sidebar-bg: #1A1A1A; // Entfernt, Tailwind steuert das */
        /* --sidebar-hover: #333333; // Entfernt */
        /* --sidebar-active: #333333; // Entfernt */
        /* --sidebar-text: #ffffff; // Entfernt */
        /* --sidebar-text-active: #ffffff; // Entfernt */

        height: 100%;
        min-height: 100vh;
        /* Wichtig für iOS Safari */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 60;
        overscroll-behavior: contain;
        /* Verhindert Pull-to-refresh auf iOS */
    }

    /* Für iOS Safari spezifische Höhenanpassung */
    @supports (-webkit-touch-callout: none) {
        .sidebar.mobile-open {
            height: -webkit-fill-available;
            min-height: -webkit-fill-available;
        }
    }
}

/* Entferne den oberen Border der Sidebar */
.sidebar::after {
    content: none;
    /* Pseudo-Border komplett aus */
}

/* Navigation Links OHNE Transitions für Dark Mode */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
    color: var(--sidebar-text);
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    overflow: hidden;
}

/* Mobile spezifische Link-Styles */
@media (max-width: 1023px) {
    .sidebar.mobile-open .sidebar-link {
        border-radius: 0;
        padding: 0.875rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        /* Bleibt für Trennlinien */
        margin-bottom: 0;
        /* background-color: transparent !important; // Entfernt! Farbe kommt von Tailwind aus EJS */
        /* color: inherit !important; // Entfernt! Farbe kommt von Tailwind aus EJS */
        font-weight: 500;
        font-size: 17px;
        font-family: Poppins, sans-serif;
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }

    .sidebar.mobile-open .sidebar-icon {
        width: 1.25rem;
        height: 1.25rem;
        margin-right: 0.25rem;
    }

    /* .sidebar.mobile-open { // Entfernt, Tailwind steuert das
        background-color: transparent !important;
        box-shadow: none !important;
    } */

    /* .sidebar.mobile-open+* { // ENTFERNT, um Blur und unerwünschte Effekte unter der Sidebar zu beseitigen
        background: none !important;
        box-shadow: none !important;
        filter: none !important;
        backdrop-filter: none !important;
    } */
}

/* .dark .sidebar.mobile-open { // Entfernt, Tailwind steuert das über EJS (dark:bg-background)
    background-color: #1e1e1e !important;
} */

.sidebar-link:hover {
    background-color: transparent;
    color: var(--sidebar-text-active);
    font-weight: 600;
}

.sidebar-link.active {
    background-color: transparent;
    color: var(--sidebar-text-active);
    font-weight: 700;
}

/* Icons OHNE Dark Mode Transitions */
.sidebar-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: currentColor;
    stroke-width: 1.5;
    flex-shrink: 0;
}

.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon {
    transform: scale(1.1);
    color: currentColor;
    stroke-width: 2;
}

/* Sidebar Text Animation */
.sidebar-text {
    font-size: 0.875rem;
    font-weight: 400;
    /* transition-property: opacity, max-width; // Max-width transition kann hier bleiben */
    transition-property: opacity;
    /* Max-width transition ggf. später wieder rein, wenn Label-Animation angepasst wird */
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
}

/* Dark Mode Variablen */
.dark .sidebar {
    --sidebar-bg: hsl(var(--background));
    --sidebar-hover: #232323;
    --sidebar-active: #232323;
    --sidebar-text: hsl(var(--foreground));
    --sidebar-text-active: hsl(var(--foreground));

    border-right-color: hsl(var(--border));
}

.dark .sidebar::after {
    background-color: hsl(var(--border));
}

/* Verbessern der Anzeige des V-Logos in der eingeklappten Sidebar */
.sidebar .flex.justify-center.w-full img {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Hintergrund mobile Sidebar ======================================== */
/* .sidebar.mobile-open { // Entfernt, Tailwind steuert das
    background-color: hsl(var(--background)) !important;
    font-family: Poppins, sans-serif;
    font-size: 17px;
    font-weight: 500;
    font-style: normal;
} */

/* .dark .sidebar.mobile-open { // Entfernt, Tailwind steuert das
    background-color: #1e1e1e !important;
} */

/* === Active-Link Farbe & Punkt im mobilen Dark-Mode ===================== */
.sidebar.mobile-open .sidebar-link.active {
    color: #000;
    /* Light */
    font-weight: 700;
}

.dark .sidebar.mobile-open .sidebar-link.active {
    color: #fff;
    /* Dark */
}

.dark .active-dot {
    background-color: #fff !important;
}

/* Punkt weiß */

/* === Icon-Alignment mob. Sidebar ↔ Header ============================== */
.sidebar.mobile-open .sidebar-icon {
    width: 1.25rem;
    height: 1.25rem;
    /* identisch zu Header */
    margin-right: 0.75rem;
    /* gleich wie Link-Padding */
}

/* Punkt-Indicator immer rund */
.sidebar-link span.select-none {
    display: inline-block;
    line-height: 1;
    border-radius: 50%;
}

/* Fix für den Active-Dot */
.sidebar-link .rounded-full {
    border-radius: 9999px;
}

/* Fix für den Active-Dot */
.sidebar-link span.select-none {
    display: inline-block;
    line-height: 1;
    border-radius: 50%;
}

/* Suchfeld-Input: Nur Icon, kein Text sichtbar */
.sidebar.mobile-open input[type="text"]::placeholder {
    color: transparent;
}

.sidebar.mobile-open input[type="text"] {
    font-family: Poppins, sans-serif;
    font-size: 17px;
    font-weight: 500;
    font-style: normal;
}