/* main.css - Admin Backend mit Seiten-Navigation & Sub-Menüs */

/* ============================================================
   Reset / Grundlegendes
   ============================================================ */
   * {
    box-sizing: border-box;
}
html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background-color: #ffffff; /* überall weiß */
    color: #333;
    height: auto;               /* Anpassung an Inhalt statt 100% */
}

/* ============================================================
   Header Styling
   ============================================================ */
#main-header {
    width: 100%;
    background-color: #1f2d3b;
    color: #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px; /* Feste Höhe für den Header */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    height: 100%;
}

.header-content .logo a {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    height: 100%;
}

.header-content .logo img {
    height: 40px; /* Passe die Höhe nach Bedarf an */
}

/* ============================================================
   Wrapper um Sidebar + Hauptinhalt
   ============================================================ */
.admin-wrapper {
    display: flex;          /* Desktop: Sidebar links, Inhalt rechts */
    flex-direction: row;    /* Reihenrichtung für Desktop */
    min-height: auto;       /* Anpassung an Inhalt statt volle Viewport-Höhe */
    margin-top: 60px;       /* Platz für fixierten Header */
    background-color: #ffffff; /* sicherstellen: Hintergrund ist weiß */
}

/* ============================================================
   SIDEBAR (Desktop)
   ============================================================ */
.admin-sidebar {
    width: 240px;
    background-color: #2c3e50;
    color: #ecf0f1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease, width 0.22s ease, left 0.22s ease; /* Übergang für rechte Position und Breite */
    position: fixed; /* Sidebar fixiert auf der linken Seite */
    top: 60px; /* Platz für Header */
    left: 0; /* Standardposition links */
    bottom: var(--admin-footer-height); /* Stoppe oberhalb des festen Footers */
    overflow-y: auto; /* Scrollen, wenn Inhalt zu lang ist */
}

.sidebar-header {
    padding: 20px;
    background: #1f2d3b;
}
.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

/* Sidebar-Header Toggle im gleichen Look wie die Menü-Links */
.sidebar-header .sidebar-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #ecf0f1;
    text-align: left;
    border: none;
    cursor: pointer;
    border-radius: 0;
    font-size: 1rem;
}

/* Hover / Fokus identisch zu Menü-Links */
.sidebar-header .sidebar-toggle-btn:hover,
.sidebar-header .sidebar-toggle-btn:focus {
    background-color: #34495e;
    color: #fff;
    outline: none;
}

/* Icon-Größe / Ausrichtung wie bei den nav-icons */
.sidebar-header .sidebar-toggle-btn .nav-icon {
    width: 28px;
    text-align: center;
    font-size: 1.2rem;
    display: inline-block;
    color: #ecf0f1;
}

/* Wenn Sidebar collapsed ist: Button auch zentrieren (wie Links) */
.admin-sidebar.collapsed .sidebar-header .sidebar-toggle-btn {
    justify-content: center;
    padding: 12px 8px;
}

/* Wenn collapsed: Label wird ohnehin ausgeblendet (.nav-label global), aber sicherstellen */
.admin-sidebar.collapsed .sidebar-header .nav-label {
    display: none;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1; /* Platz für Navigation */
    display: flex;
    flex-direction: column;
}

.sidebar-nav li {
    position: relative; /* Damit Submenü absolute/relative positionieren kann */
    border-bottom: 1px solid #34495e;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.3s;
}

.sidebar-nav a:hover {
    background-color: #34495e;
    color: #fff;
}

/* ============================================================
   Sub-Menüs
   ============================================================ */
.has-submenu ul.sub-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none; /* Start: verborgen */
    background-color: #2c3e50; /* Gleiche Farbe wie Sidebar */
}

.has-submenu ul.sub-nav li {
    border-bottom: none; /* kein extra Separator */
}

.has-submenu ul.sub-nav a {
    padding-left: 40px; /* Einrückung, um die Hierarchie zu zeigen */
}

.has-submenu.open .sub-nav {
    display: block; /* Sub-Menü anzeigen, wenn .open */
}

/* Pfeil-Icon neben dem Haupt-Menüpunkt */
.submenu-toggle {
    font-size: 0.8rem;
    margin-left: 5px;
    transition: transform 0.3s ease; /* Animiertes Drehen */
    display: inline-block; /* Damit transform funktioniert */
}

.has-submenu.open .submenu-toggle {
    transform: rotate(180deg); /* Nach oben drehen */
}

/* ============================================================
   Hauptinhalt
   ============================================================ */
.admin-main {
    flex: 1;
    background: #fff;
    padding: 0;
    min-height: 400px; /* Vernünftige Mindesthöhe statt 100vh */
    box-shadow: inset 0 0 10px rgba(0,0,0,0);
    padding-bottom: calc(15px + var(--admin-footer-height)); /* Abstand zum festen Footer */
    transition: margin-left 0.3s ease;
}

/* Make content area expand/contract depending on sidebar state */
.admin-main {
    transition: margin-left 220ms ease, width 220ms ease;
}

/* Normaler Zustand (Sidebar ausgeklappt) */
.admin-sidebar:not(.collapsed) + .admin-main,
.admin-sidebar.open + .admin-main {
    margin-left: 250px; /* vorher 240px -> +10px mehr Abstand */
}

/* Collapsed Zustand: Inhalt weiter nach links ziehen */
.admin-sidebar.collapsed + .admin-main {
    margin-left: 70px;  /* vorher 60px -> +10px mehr Abstand */
}

/* Optional: wenn Sidebar auf mobilen Geräten overlayed ist, stelle margin-left zurück */
@media (max-width: 768px) {
    /* Überschreibe alle Desktop margin-left Regeln, damit kein linker Abstand auf Mobile bleibt */
    .admin-sidebar:not(.collapsed) + .admin-main,
    .admin-sidebar.open + .admin-main,
    .admin-sidebar + .admin-main,
    .admin-sidebar.collapsed + .admin-main {
        margin-left: 0 !important;
    }
}

/* Kleinere Korrektur für content-box, damit es mit verkleinerter Sidebar gut aussieht */
.admin-sidebar.collapsed + .admin-main .content-box {
    margin-left: 18px; /* beibehalten (leicht zusätzlicher Innenabstand) */
}

/* Einfaches Layout für Formulare */
.form-container {
    max-width: 400px;
    margin: 20px auto;
}

.form-container label {
    display: block;
    margin-top: 10px;
}

.form-container input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.form-container button {
    margin-top: 15px;
    padding: 10px;
}

/* ============================================================
   Footer
   ============================================================ */
.admin-footer {
    background: #1f2d3b;
    color: #bdc3c7;
    text-align: center;
    font-size: 0.6rem;
    position: fixed; 
    bottom: 0; 
    left: 0;
    width: 100%; 
    z-index: 1500; 
    min-height: var(--admin-footer-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-footer p {
    margin: 0;
}

/* ============================================================
   Hamburger-Menü
   ============================================================ */
#hamburger-btn {
    display: none; /* Standard: Verstecken (Desktop) */
    width: 30px;
    height: 25px;
    cursor: pointer;
    margin: 0; /* Entfernt zusätzlichen Abstand */
    position: relative;
    z-index: 1001; /* soll über dem Sidebar-Layer liegen */
}

#hamburger-btn span {
    background: #2c3e50;
    display: block;
    height: 3px;
    margin: 4px 0; /* Geringerer Abstand zwischen den Balken */
    transition: 0.3s;
}

/* ============================================================
   Responsive Breakpoints
   ============================================================ */
@media (max-width: 768px) {

    /* Für mobile: Body als flexbox, damit Footer unten bleibt */
    body {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }
    
    .admin-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        margin-top: 60px;
    }
    
    .admin-main {
        flex: 1;
    }

    #hamburger-btn {
        display: flex; /* Nur sichtbar auf Mobile */
        width: 30px;
        height: 25px;
        cursor: pointer;
        position: fixed; /* Button fixiert, immer sichtbar */
        top: 15px;
        right: 15px; /* Rechts positioniert */
        z-index: 1001; /* Über Sidebar und Inhalt */
        flex-direction: column; /* Vertikale Anordnung der Balken */
        justify-content: center; /* Zentrierung der Balken */
    }

    #hamburger-btn span {
        background: #ecf0f1; /* Farbe angepasst für bessere Sichtbarkeit im Header */
        display: block;
        height: 3px;
        margin: 4px 0; /* Geringerer Abstand zwischen den Balken */
        transition: 0.3s;
    }

    #main-header {
        justify-content: space-between;
        padding: 0 15px;
        height: 60px; /* Feste Höhe bleibt gleich */
    }

    .header-content .logo {
        flex: 1;
        text-align: center;
    }

    .header-content .logo a {
        font-size: 1.1rem;
    }

    .header-content .logo img {
        height: 35px; /* Kleinere Höhe für mobile */
    }

    /* Mobile: Off-canvas Sidebar (standardmäßig verborgen). Wird durch
       die Klasse .open sichtbar (Hamburger toggled .open). */
    .admin-sidebar {
        position: fixed;
        top: 60px; /* Platz für fixierten Header */
        right: -240px; /* Sidebar kommt von rechts, ausgeblendet */
        left: auto; /* Entfernt die linke Positionierung */
        width: 240px !important; /* Auf Mobile immer volle Breite */
        bottom: 0;                     /* Footer ist nicht fixiert auf Mobile */
        transition: right 0.3s ease; /* Übergang für rechte Position */
        z-index: 1000;
        overflow: auto !important; /* Auf Mobile immer scrollbar */
    }

    .admin-sidebar.open {
        right: 0; /* Sidebar sichtbar */
    }

    /* Entferne Wrapper-Top-Abstand und setze Admin-Main unter dem fixierten Header */
    .admin-wrapper {
        margin-top: 0 !important;
    }

    .admin-main {
        margin-left: 0; /* Kein Platz mehr für Sidebar */
        margin-top: 60px !important; /* Platz unter dem fixierten Header */
        padding: 20px;
    }

    /* Content bleibt standardmäßig ohne Sidebar-Platz, da Sidebar overlayed.
       Wenn Sidebar offen ist, Nutzer kann den Inhalt scrollen oder Sidebar
       schließen via Hamburger. */
    .admin-main {
        margin-left: 0;
    }

    /* Verberge den internen Sidebar-Toggle innerhalb der Sidebar auf Mobile
       (der Hamburger rechts bleibt, aber ist in unserer UX inaktiv).
       So verschwindet der Menü-Punkt "Menü" in der Sidebar. */
    .admin-sidebar #sidebar-toggle {
        display: none !important;
    }

    /* Falls serverseitig die Session 'collapsed' gesetzt ist und die Klasse
       .collapsed vorhanden ist, dann neutralisieren wir diese auf Mobile:
       Sidebar bleibt breit, Labels sichtbar und Submenu-Pfeile aktiv. */
    .admin-sidebar.collapsed .nav-label {
        display: inline-block !important;
    }

    .admin-sidebar.collapsed .sidebar-nav a {
        justify-content: flex-start !important;
        padding: 12px 20px !important;
    }

    .admin-sidebar.collapsed .submenu-toggle {
        display: inline-block !important;
        transform: none !important;
    }

    .admin-footer {
        position: static;
        margin-top: auto;
    }

    /* --- Mobile: content adjustments - ensure correct rendering --- */
    /* Reduce padding and use full-width content boxes */
    .admin-main {
        padding: 14px;
        box-sizing: border-box;
    }

    .content-box {
        margin: 12px auto;
        padding: 12px;
        max-width: calc(100% - 24px);
        box-sizing: border-box;
    }

    /* Tables: allow horizontal scroll instead of breaking layout */
    .admin-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent internal table cells from forcing overflow on mobile */
    .admin-table th,
    .admin-table td {
        white-space: nowrap;
        vertical-align: top;
    }

    /* Forms: make container and inputs full-width for mobile */
    .form-container,
    .admin-form .form-group,
    .login-container {
        width: 100%;
        padding: 0;
    }

    .form-container input,
    .form-container button,
    .admin-form input,
    .admin-form textarea,
    .btn-primary,
    .btn-details {
        width: 100%;
        box-sizing: border-box;
    }

    /* Make images inside content responsive */
    .admin-main img,
    .content-box img {
        max-width: 100%;
        height: auto;
    }

    /* Code / preformatted blocks: horizontal scroll if needed */
    .admin-main pre,
    .admin-main code,
    .content-box pre,
    .content-box code {
        overflow-x: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    /* Slightly smaller headings for mobile to save vertical space */
    .admin-main h2 {
        font-size: 1.1rem;
        margin-top: 0;
        margin-bottom: 16px;      /* Konsistenter Abstand nach unten */
    }

    /* Remove remaining left-gaps introduced by desktop collapsed rules */
    .admin-sidebar + .admin-main .content-box,
    .admin-sidebar.collapsed + .admin-main .content-box,
    .admin-sidebar.open + .admin-main .content-box {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }
    .sidebar-nav a {
        font-size: 1.1rem;
        padding: 14px;
    }
    #hamburger-btn {
        margin: 0;
    }

    .header-content .logo a {
        font-size: 1rem;
    }

    .header-content .logo img {
        height: 35px; /* Kleinere Höhe für sehr kleine Bildschirme */
    }
}

/* ============================================================
   Tabellen Styling
   ============================================================ */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 1rem;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

.admin-table th {
    background-color: #f2f2f2;
}

.admin-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.admin-table tr:hover {
    background-color: #f1f1f1;
}

.admin-table a {
    color: #003055;
    text-decoration: none;
}

.admin-table a:hover {
    text-decoration: underline;
}

/* Abstand für Aktions-Region oberhalb Tabellen */
.admin-actions {
    margin-bottom: 12px;
}

/* Einheitliches, kontrastreiches Styling für Aktions-Buttons in Tabellen/Listen */
.admin-table a,
.admin-table .btn-details,
.admin-table .btn-edit,
.admin-table .btn-delete,
.table a,
.table .btn {
    display: inline-block;
    vertical-align: middle;
    color: #ffffff !important;    /* Sicherstellen, dass der Text sichtbar ist */
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1;
}

/* Farbhintergründe beibehalten, nur Textfarbe erzwingen */
.admin-table .btn-details { background-color: var(--primary-color); }
.admin-table .btn-details:hover { background-color: var(--primary-hover); }

.admin-table .btn-edit { background-color: #f1c40f; color: #ffffff; }
.admin-table .btn-edit:hover { background-color: #d4ac0d; }

.admin-table .btn-delete { background-color: #e74c3c; color: #ffffff; }
.admin-table .btn-delete:hover { background-color: #c0392b; }

/* Zusätzliche Sicherheits-Regel: Buttons innerhalb Tabellenzellen sollen nicht positioniert überlappen */
.admin-table td > .btn,
.admin-table td > a.btn,
.admin-table td > a {
    position: relative;
    margin: 0 4px 4px 0;
}

/* Falls Buttons in einer Zeile überlappen: Zellenhöhe etwas erhöhen */
.admin-table td {
    vertical-align: middle;
}

/* Buttons für Aktionen */
.btn-details {
    background-color: #003055;
    color: #fff;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-details:hover {
    background-color: #00243f;
}

.btn-edit {
    background-color: #f1c40f;
    color: #fff;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

/* ============================================================
   Produktliste – Übersicht & Toolbar
   ============================================================ */
.product-list-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.product-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.product-list-header .lead {
    margin: 0;
    color: #4a4a4a;
}

.product-list-header-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.product-list-header-actions .btn-icon {
    font-size: 1.2rem;
}

.product-list-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.product-meta-card {
    background: #f8fafc;
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-meta-card .label {
    font-size: 0.85rem;
    color: #6c7a8a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-meta-card strong {
    font-size: 1.4rem;
    color: #0b2540;
}

.product-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.product-list-toolbar .toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.product-list-toolbar .toolbar-field.compact {
    min-width: auto;
}

.product-list-toolbar label {
    font-weight: 600;
    color: #2e3c4d;
}

.product-list-toolbar input[type="search"],
.product-list-toolbar select {
    padding: 10px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    font-size: 0.95rem;
}

.product-list-toolbar .search-field {
    position: relative;
}

.product-list-toolbar .search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #768395;
    pointer-events: none;
}

.product-list-toolbar .search-field input {
    padding-left: 36px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.product-list-table .cell-id {
    font-weight: 600;
    color: #0b2540;
}

.product-list-table .product-name {
    font-weight: 600;
    color: #0b2540;
    margin-bottom: 4px;
}

.product-list-table .product-meta {
    font-size: 0.85rem;
    color: #4f5d75;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-list-table .product-sku {
    font-weight: 600;
}

.product-list-table .product-short-desc {
    margin-top: 4px;
    color: #5e6a7d;
    font-size: 0.9rem;
}

.product-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.product-status-badge.status-active {
    background-color: rgba(37, 161, 75, 0.12);
    color: #1e824c;
}

.product-status-badge.status-inactive {
    background-color: rgba(255, 193, 7, 0.15);
    color: #9c640c;
}

.product-status-badge.status-archived {
    background-color: rgba(108, 117, 125, 0.2);
    color: #495057;
}

.product-list-table .actions-col {
    width: 190px;
}

.product-list-table .btn-compact {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.product-list-empty {
    text-align: center;
    padding: 40px 20px;
    border: 2px dashed #d7dee7;
    border-radius: 10px;
    background: #fdfefe;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 768px) {
    .product-list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .product-list-toolbar .toolbar-field,
    .product-list-toolbar .toolbar-field.compact {
        width: 100%;
        min-width: 100%;
    }

    .product-list-table .actions-col {
        width: auto;
    }
}

.btn-edit:hover {
    background-color: #d4ac0d;
}

.btn-delete {
    background-color: #e74c3c;
    color: #fff;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-delete:hover {
    background-color: #c0392b;
}

/* Buttons für das Formular */
.btn-primary {
    background-color: #003055;
    color: #fff;
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #00243f;
}

/* Sicherstellen, dass primäre Buttons immer weißen Text haben */
.btn-primary,
.btn-primary * {
    color: #ffffff !important; /* zwingend weißen Text erzwingen */
}

/* Falls .btn-primary Links oder Inline-Elemente enthält, korrekt zentrieren */
.btn-primary {
    display: inline-block;
    vertical-align: middle;
    line-height: 1.2;
    text-decoration: none;
}

/* ============================================================
   Login-Seite Styling
   ============================================================ */
.login-container {
    max-width: 400px;
    margin: 100px auto; /* Abstand vom Header */
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-container h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #333;
}

.error-message {
    color: #e74c3c;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.login-form .form-group {
    margin-bottom: 15px;
    text-align: left;
}

.login-form label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    border-color: #003055;
    outline: none;
    box-shadow: 0 0 4px rgba(0, 48, 85, 0.5);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    background-color: #003055;
    color: #fff;
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #00243f;
}

/* ============================================================
   Registrieren-Link
   ============================================================ */
.register-link {
    margin-top: 20px;
    font-size: 0.9rem;
}
.register-link a {
    color: #003055;
    text-decoration: none;
}
.register-link a:hover {
    color: #00243f;
    text-decoration: underline;
}

/* ============================================================
   Sidebar Navigation - Active State
   ============================================================ */
.sidebar-nav li.active > a,
.sidebar-nav li > a.active {
    background-color: #34495e;
    color: #fff;
}

.sidebar-nav li.active {
    background-color: #34495e;
}

.sidebar-nav li.active a {
    color: #fff;
}

/* ============================================================
   Zusätzliche Styles für Produktformular (oder generische Admin-Forms)
   ============================================================ */
.admin-form .form-group {
    margin-bottom: 15px;
    text-align: left;
}

.admin-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.admin-form input,
.admin-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.admin-form input:focus,
.admin-form textarea:focus {
    border-color: #003055;
    outline: none;
    box-shadow: 0 0 4px rgba(0, 48, 85, 0.3);
}

.admin-form button.btn {
    background-color: var(--primary-color);
    color: #fff;
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.admin-form button.btn:hover {
    background-color: var(--primary-hover);
}

/* Anpassung: Login/Registrierungsseiten zentrieren (keine feste left-margin durch Sidebar) */
.admin-main.login-page {
    margin-left: 0;                  /* Kein Platz für die Sidebar reservieren */
    margin-right: 0;
    max-width: 480px;               /* Begrenzte Breite wie vorher */
    margin: 80px auto 20px;         /* Abstand oben (Header), zentriert horizontal */
    padding: 20px;                  /* Innenabstand für das Box-Layout */
    padding-bottom: 20px;           /* Entferne den großen unteren Abstand */
    min-height: auto;               /* Entferne die Mindesthöhe für Login-Seiten */
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    background: #fff;
    border-radius: 6px;
}

/* Optional: kleinere Bildschirme weiterhin korrekt behandeln */
@media (max-width: 768px) {
    .admin-main.login-page {
        max-width: 100%;
        margin: 70px 10px 20px;     /* Füge unteren Margin hinzu */
        padding: 16px;
        padding-bottom: 16px;       /* Entferne großen unteren Abstand auf Mobile */
        min-height: auto;           /* Entferne Mindesthöhe auf Mobile */
    }
}

/* === Projektweite Primärfarbe (Buttons + Links) === */
:root {
    --primary-color: #003055;
    --primary-hover: #00243f;
    --admin-footer-height: 28px;
}

/* Buttons: primär */
.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Optional: Buttons, die als Links ausgeführt sind (z.B. .btn-details) */
.btn-details,
.btn-edit,
.btn-delete {
    color: #fff;
}

/* Links innerhalb des Hauptinhalts / Login-Box / Register-Link / Tabellen */
.admin-main a,
.login-box a,
.register-link a,
.admin-table a {
    color: var(--primary-color);
    text-decoration: none;
}
.admin-main a:hover,
.login-box a:hover,
.register-link a:hover,
.admin-table a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Input-Fokus passend zur Primärfarbe */
.login-form input:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.login-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 6px rgba(0,48,85,0.12);
    outline: none;
}

/* Content-Box für Admin-Seiten (nicht Login/Register)
   steht näher an der Sidebar und nutzt die verfügbare Breite */
.content-box {
    background: #fff;
    padding: 18px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    /* Abstand zur Sidebar: kein negativer Versatz mehr */
    margin: 16px 16px 24px 16px; /* top right bottom left */
    max-width: none; /* volle Breite innerhalb admin-main */
}

/* Falls Überlappung sichtbar wird, auf größeren Bildschirmen leicht zurückziehen */
@media (min-width: 1200px) {
    .content-box {
        margin-left: -8px; /* weniger aggressiv auf großen Screens */
    }
}

/* Kleinere Anpassung: Formulare auf Admin-Seiten */
.admin-form .form-group {
    margin-bottom: 12px;
}

.admin-main h2 {
    margin-top: 0;
    margin-bottom: 16px;      /* Konsistenter Abstand nach unten */
}

/* Spezifisches Styling: Toggle-Button für HTML-Ansicht soll grau sein (kein primary-Button) */
#toggle-html {
    background-color: #95a5a6; /* graues Medium */
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#toggle-html:hover,
#toggle-html:focus {
    background-color: #7f8c8d; /* dunkleres Grau beim Hover/Focus */
    outline: none;
}

/* --- Änderung: btn-secondary soll neutral-grau sein, nicht primary --- */
.btn-secondary,
.btn-secondary * {
    background-color: #95a5a6 !important;
    color: #ffffff !important;
    border: none !important;
}

/* Optional: Hover für btn-secondary */
.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #7f8c8d !important;
}

/* Erfolgsmeldung: grün mit Rahmen */
.success-message {
    border: 1px solid #2ecc71;
    background-color: #e9f9ef;
    color: #1e7a35;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

/* Einheitliches Styling für Admin-Formulareingabefelder */
.admin-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 1rem;
    color: #111827;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,48,85,0.06);
}

/* Sicherstellen, dass primäre Buttons die Primärfarbe haben */
.btn-primary,
.btn-primary * {
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
    border: none !important;
}

/* Make `.primary` buttons (used in views) match the site's primary style */
.primary,
button.primary,
.banner-actions .primary {
    background: #003055;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 48, 85, 0.12);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.primary:hover,
.primary:focus,
button.primary:hover,
button.primary:focus {
    background: #00243f;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 48, 85, 0.16);
    outline: none;
}

/* Subtle disabled state */
.primary:disabled,
button.primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Custom checkbox styling to match the admin look */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #fff;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    position: relative;
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0,48,85,0.06);
}

input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Larger clickable label area: ensure label aligns nicely */
label > input[type="checkbox"] { margin-right: 10px; }

/* Sidebar: collapsed (nur Icons) */
.admin-sidebar {
    transition: width 0.22s ease, left 0.22s ease, right 0.22s ease;
}

/* Visually hidden für Screenreader */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* Collapsed Sidebar: enge Breite, Labels ausblenden */
.admin-sidebar.collapsed {
    width: 60px !important;
}

/* Icon + Label Layout */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Icon Box styling - zwingend sichtbar */
.nav-icon {
    width: 28px;
    text-align: center;
    font-size: 1.2rem;
    display: inline-block;
    color: #ecf0f1;
}

/* Label sichtbar im normalen Zustand */
.nav-label {
    display: inline-block;
    white-space: nowrap;
}

/* Wenn collapsed: Labels ausblenden und Icons zentrieren */
.admin-sidebar.collapsed .nav-label {
    display: none !important;
}
.admin-sidebar.collapsed .sidebar-nav a {
    justify-content: center !important;
    padding: 12px 8px !important;
}

/* Collapsed Sidebar: Popup-Subnav als absolute, animiertes Panel */
.admin-sidebar.collapsed .has-submenu > .sub-nav {
    /* sichtbarkeitssteuerung via opacity/visibility, top per JS */
    display: block;
    position: absolute;
    left: 60px;              /* rechts neben die schmale Sidebar */
    top: 0;                  /* wird per JS angepasst */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    background-color: #2c3e50;
    border: 1px solid #34495e;
    min-width: 220px;
    max-height: 60vh;
    overflow: auto;
    z-index: 2200;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    padding: 6px 0;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

/* Bei Hover / JS-Klasse hover-open öffnen */
.admin-sidebar.collapsed .has-submenu:hover > .sub-nav,
.admin-sidebar.collapsed .has-submenu.hover-open > .sub-nav {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Popup-Einträge: Label sicher sichtbar */
.admin-sidebar.collapsed .has-submenu > .sub-nav a .nav-label,
.admin-sidebar.collapsed .has-submenu > .sub-nav li .nav-label {
    display: inline-block !important;
    color: #ecf0f1;
    white-space: normal;
    padding-left: 6px;
}

/* Pfeile (Submenu-Toggles) im collapsed Zustand ausblenden */
.admin-sidebar.collapsed .submenu-toggle {
    display: none !important;
}

/* Stelle sicher, dass die Sidebar über anderen Content liegt */
.admin-sidebar {
    z-index: 1200; /* über dem Header/Content */
    /* behalte scroll für normalen Zustand */
    overflow-y: auto;
}

/* Wenn eingeklappt: erlauben, dass Popup außerhalb der Sidebar sichtbar wird */
.admin-sidebar.collapsed {
    width: 60px;
    overflow: visible; /* wichtig: sonst wird das absolute Popup abgeschnitten */
}

/* Subnav / Popup soll ganz oben im Stack liegen */
.admin-sidebar .sub-nav {
    z-index: 2500;
}

/* ============================================================
   CRITICAL OVERRIDE: Desktop Sidebar Collapsed State
   Diese Regel muss NACH allen Media-Queries kommen um
   Mobile-Overrides zu überschreiben
   ============================================================ */
@media (min-width: 769px) {
    .admin-sidebar.collapsed {
        width: 60px !important;
        overflow: visible !important;
    }
}

/* Produktformular-Layout */
.product-form-wrapper {
    max-width: 1200px;
}

.product-form .form-section {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 20px;
    background: #fafbfc;
}

.product-form .form-section-header {
    margin-bottom: 16px;
}

.product-form .section-hint {
    margin: 4px 0 0 0;
    font-size: 0.9rem;
    color: #6b7280;
}

.product-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.product-form .form-field label {
    display: flex;
    gap: 6px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #111827;
}

.product-form .form-field .required {
    color: #d14343;
    font-weight: 700;
}

.product-form input[type="text"],
.product-form input[type="number"],
.product-form select,
.product-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-form textarea {
    min-height: 120px;
    resize: vertical;
}

.product-form .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.product-form .field-help,
.product-form .field-comment {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 6px 0 0 0;
}

.product-form .field-comment {
    color: #94a3b8;
}

.product-form .form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.alert-success {
    background: #e9f9ef;
    border: 1px solid #2ecc71;
    color: #137a3e;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #f87171;
    color: #b91c1c;
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}

