/* ============================================================
   Zentrales Admin-Theme-CSS (aus includes/admin_theme.php extrahiert)
   Dynamische Config-Farben kommen weiterhin inline via :root (getAdminThemeCSS).
   ============================================================ */
    /* Reset */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    /* Base */
    html { font-size: 15px; }
    body {
        font-family: var(--font);
        background: var(--bg);
        color: var(--text);
        line-height: 1.5;
        min-height: 100vh;
    }

    /* ========== HEADER (Mobile/Tablet) ========== */
    .admin-header {
        display: none; /* Versteckt auf Desktop */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--primary);
        border-bottom: none;
        z-index: 1000;
        padding: 0 1rem;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 2px 8px var(--c-rgba-0-0-0-0-1);
    }
    .admin-header-logo {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .admin-header-logo img {
        height: 36px;
        width: auto;
    }
    .admin-header-title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--white);
    }

    /* Hamburger Button */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        border-radius: var(--radius);
        transition: background 0.2s;
    }
    .hamburger-btn:hover {
        background: var(--c-rgba-255-255-255-0-1);
    }
    .hamburger-btn span {
        display: block;
        width: 24px;
        height: 3px;
        background: var(--white);
        border-radius: 2px;
        transition: all 0.3s;
    }
    .hamburger-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }
    .hamburger-btn.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    /* Layout */
    .admin-container {
        display: flex;
        min-height: 100vh;
    }

    /* ========== SIDEBAR ========== */
    .sidebar {
        width: var(--sidebar-width);
        background: var(--text);
        color: var(--white);
        padding: 1.5rem 0;
        position: fixed;
        height: 100vh;
        overflow-y: auto;
        z-index: 999;
        transition: transform 0.3s ease;
    }
    .sidebar-header {
        padding: 1.5rem 1rem;
        display: flex;
        flex-direction: column; /* Logo oben, Titel darunter (untereinander) */
        align-items: center;
        justify-content: center;
        gap: 0.65rem;
        text-align: center;
        background: var(--primary);
        color: var(--white);
        margin-bottom: 1rem;
    }
    .sidebar-header img {
        height: 84px; /* deutlich groesser = klar erkennbar */
        width: auto;
        max-width: 92%;
        padding: 2px;
        /* enger dunkler Outline + weicher Schatten -> weisses Logo poppt auf Rot */
        filter: drop-shadow(0 0 1px rgba(0,0,0,0.6)) drop-shadow(0 2px 3px rgba(0,0,0,0.4));
    }
    .sidebar-header span {
        line-height: 1.25;
        font-weight: 600;
    }
    .sidebar h2 {
        padding: 0 1.25rem 0.75rem;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        opacity: 0.6;
        margin-top: 1rem;
    }
    .sidebar h2:first-of-type {
        margin-top: 0;
    }
    .sidebar ul { list-style: none; }
    .sidebar li a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1.25rem;
        color: var(--c-rgba-255-255-255-0-8);
        text-decoration: none;
        font-size: 0.9rem;
        border-left: 3px solid transparent;
        transition: all 0.15s;
    }
    .sidebar li a:hover {
        background: var(--c-rgba-255-255-255-0-1);
        color: var(--white);
    }
    .sidebar li a.active {
        background: var(--primary);
        color: var(--white);
        border-left-color: var(--white);
    }
    .sidebar .icon {
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0.9;
    }
    .sidebar .icon svg {
        width: 18px;
        height: 18px;
        fill: currentColor;
    }
    .sidebar-footer {
        margin-top: auto;
        padding: 1rem 1.25rem;
        border-top: 1px solid var(--c-rgba-255-255-255-0-1);
    }
    .sidebar-footer a {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: var(--c-rgba-255-255-255-0-6);
        text-decoration: none;
        font-size: 0.85rem;
        padding: 0.5rem 0;
    }
    .sidebar-footer a:hover {
        color: var(--white);
    }

    /* Overlay für Mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        /* Fallback für ältere Browser (Safari < 14.1) */
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        /* Moderne Browser */
        inset: 0;
        background: var(--c-rgba-0-0-0-0-5);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s;
        -webkit-transition: opacity 0.3s;
        pointer-events: none;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Main */
    .main {
        flex: 1;
        min-width: 0; /* erlaubt Schrumpfen im Flex-Layout statt Overflow */
        padding: 2rem;
        margin-left: var(--sidebar-width);
        max-width: 1200px;
        box-sizing: border-box;
    }
    /* Overflow-Schutz: Bilder/Tabellen/Code nie breiter als der Content */
    .main img { max-width: 100%; height: auto; }
    .image-preview-container, .image-preview { max-width: 100%; overflow: hidden; }
    .main table { max-width: 100%; }
    .main td, .main th { overflow-wrap: anywhere; word-break: break-word; }
    .main pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
    /* Einfarbige Status-Glyphen (statt bunter Emoji) */
    .diag-check { font-weight: 700; font-size: 1.05em; line-height: 1; }
    .diag-check.ok { color: var(--c-16a34a, #16a34a); }
    .diag-check.err { color: var(--c-dc2626, #dc2626); }
    .success-icon { color: var(--c-16a34a, #16a34a); text-align: center; margin: 0 auto 0.5rem; }
    .success-icon svg { width: 48px; height: 48px; }

    /* ========== RESPONSIVE: Tablet ========== */
    @media (max-width: 1024px) {
        .admin-header {
            display: flex;
        }
        .sidebar {
            transform: translateX(-100%);
            box-shadow: 4px 0 20px var(--c-rgba-0-0-0-0-2);
        }
        .sidebar.active {
            transform: translateX(0);
        }
        .sidebar-overlay {
            display: block;
        }
        .main {
            margin-left: 0;
            padding-top: calc(60px + 1.5rem);
        }
    }

    /* ========== RESPONSIVE: Mobile ========== */
    @media (max-width: 600px) {
        .admin-header-title {
            display: none;
        }
        .main {
            padding: 1rem;
            padding-top: calc(60px + 1rem);
        }
        .sidebar {
            width: 280px;
        }
    }

    /* ========== LAYOUT A: durchgehende Top-Leiste (Kundenwahl) ==========
       Nur Desktop; Tablet/Mobile bleibt fuer beide Layouts identisch (Hamburger). */
    @media (min-width: 1025px) {
        .admin-layout-a .admin-header { display: flex; }               /* volle rote Top-Leiste */
        .admin-layout-a .admin-header .hamburger-btn { display: none; } /* Sidebar immer sichtbar */
        .admin-layout-a .sidebar-header { display: none; }             /* roter Streifen entfaellt */
        .admin-layout-a .sidebar {
            top: 60px;
            height: calc(100vh - 60px);
            padding-top: 1rem;
        }
        .admin-layout-a .main { margin-top: 60px; }
    }

    /* Typography */
    h1 {
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 1.5rem;
    }
    h3 {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border);
    }
    h4 {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text);
        margin: 1.25rem 0 0.75rem;
    }
    p { color: var(--text-light); }

    /* Cards */
    .card {
        background: var(--white);
        border-radius: var(--radius);
        padding: 1.5rem;
        margin-bottom: 1.25rem;
        box-shadow: 0 1px 3px var(--c-rgba-0-0-0-0-08);
    }

    /* Forms */
    .form-group {
        margin-bottom: 1.25rem;
    }
    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--text);
    }
    .form-group input,
    .form-group textarea,
    .form-group select {
        width: 100%;
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
        font-family: var(--font);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--white);
        color: var(--text);
        transition: border-color 0.15s;
    }
    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }
    .form-group textarea {
        min-height: 100px;
        resize: vertical;
    }
    .help-text {
        font-size: 0.8rem;
        color: var(--text-light);
        margin-top: 0.375rem;
    }

    /* Grid */
    .form-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1rem;
    }

    /* ========== BUTTONS - Einheitlich, gut lesbar ========== */
    .btn,
    button[type='submit'],
    input[type='submit'] {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.625rem;
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
        font-weight: 500;
        font-family: var(--font);
        line-height: 1.2;
        border: 2px solid transparent;
        border-radius: var(--radius);
        cursor: pointer;
        text-decoration: none;
        transition: all 0.2s;
        min-height: 44px;
        white-space: nowrap;
    }
    .btn-primary,
    .btn-success,
    .btn,
    button[type='submit'],
    input[type='submit'] {
        background: var(--primary);
        color: var(--white);
        border-color: var(--primary);
    }
    .btn-primary:hover,
    .btn-success:hover,
    .btn:hover,
    button[type='submit']:hover,
    input[type='submit']:hover {
        background: var(--primary-hover);
        border-color: var(--primary-hover);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px var(--c-rgba-0-0-0-0-15);
    }
    .btn-secondary {
        background: var(--white);
        color: var(--text);
        border-color: var(--border);
    }
    .btn-secondary:hover {
        background: var(--bg);
        border-color: var(--text-light);
    }
    .btn-outline {
        background: transparent;
        color: var(--primary);
        border-color: var(--primary);
    }
    .btn-outline:hover {
        background: var(--primary);
        color: var(--white);
    }
    .btn-danger {
        background: var(--white);
        color: var(--c-cc0000);
        border-color: var(--c-cc0000);
    }
    .btn-danger:hover {
        background: var(--c-cc0000);
        color: var(--white);
    }
    .btn-small {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
        min-height: 36px;
    }
    .btn-large {
        padding: 1rem 2rem;
        font-size: 1rem;
        min-height: 52px;
    }
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    /* Toggle-Switch - Funktionale Version */
    .toggle-group {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 12px 16px !important;
        background: var(--c-f5f5f5) !important;
        border-radius: 6px !important;
        margin-bottom: 8px !important;
    }
    .toggle-group > span,
    .toggle-group > label:first-child {
        font-size: 14px !important;
        font-weight: 500 !important;
        color: var(--c-333333) !important;
        flex: 1;
    }
    /* Toggle als Label - klickbar */
    label.toggle,
    .toggle {
        position: relative !important;
        display: inline-block !important;
        width: 50px !important;
        height: 26px !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
    }
    label.toggle input,
    .toggle input {
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        position: absolute !important;
    }
    label.toggle .slider,
    .toggle .slider {
        position: absolute !important;
        cursor: pointer !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background-color: var(--c-cccccc) !important;
        border-radius: 26px !important;
        transition: 0.3s !important;
    }
    label.toggle .slider:before,
    .toggle .slider:before {
        position: absolute !important;
        content: '' !important;
        height: 20px !important;
        width: 20px !important;
        left: 3px !important;
        bottom: 3px !important;
        background-color: white !important;
        border-radius: 50% !important;
        transition: 0.3s !important;
        box-shadow: 0 2px 4px var(--c-rgba-0-0-0-0-2) !important;
    }
    label.toggle input:checked + .slider,
    .toggle input:checked + .slider {
        background-color: var(--c-8b0000) !important;
    }
    label.toggle input:checked + .slider:before,
    .toggle input:checked + .slider:before {
        transform: translateX(24px) !important;
    }
    label.toggle:hover .slider,
    .toggle:hover .slider {
        background-color: var(--c-bbbbbb) !important;
    }
    label.toggle input:checked + .slider:hover,
    .toggle input:checked + .slider:hover {
        background-color: var(--c-a00000) !important;
    }

    /* Messages */
    .success {
        background: var(--c-e8f5e9);
        color: var(--c-2e7d32);
        padding: 0.875rem 1rem;
        border-radius: var(--radius);
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
    .error {
        background: var(--c-ffebee);
        color: var(--c-c62828);
        padding: 0.875rem 1rem;
        border-radius: var(--radius);
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }

    /* Back Link */
    .back-link {
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        color: var(--primary);
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        margin-bottom: 1.25rem;
    }
    .back-link:hover {
        text-decoration: underline;
    }

    /* Tabs */
    .tabs {
        display: flex;
        gap: 0.25rem;
        border-bottom: 2px solid var(--border);
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }
    .tab {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--text-light);
        text-decoration: none;
        border-bottom: 2px solid transparent;
        margin-bottom: -2px;
        transition: all 0.15s;
        background: none;
        border-left: none;
        border-right: none;
        border-top: none;
        cursor: pointer;
    }
    .tab:hover {
        color: var(--primary);
    }
    .tab.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
    }
    .tab svg {
        width: 16px;
        height: 16px;
        fill: currentColor;
    }

    /* Stats */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    .stat-box {
        background: var(--white);
        padding: 1.25rem;
        border-radius: var(--radius);
        text-align: center;
        box-shadow: 0 1px 3px var(--c-rgba-0-0-0-0-08);
    }
    .stat-number {
        font-size: 2rem;
        font-weight: 700;
        color: var(--primary);
    }
    .stat-label {
        font-size: 0.8rem;
        color: var(--text-light);
        margin-top: 0.25rem;
    }

    /* Quick Actions */
    .quick-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }
    .quick-action {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        background: var(--white);
        border-radius: var(--radius);
        text-decoration: none;
        color: var(--text);
        box-shadow: 0 1px 3px var(--c-rgba-0-0-0-0-08);
        transition: all 0.15s;
    }
    .quick-action:hover {
        box-shadow: 0 4px 12px var(--c-rgba-0-0-0-0-1);
        transform: translateY(-1px);
    }
    .quick-action-icon {
        width: 40px;
        height: 40px;
        background: var(--primary);
        color: var(--white);
        border-radius: var(--radius);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .quick-action-icon svg {
        width: 20px;
        height: 20px;
        fill: currentColor;
    }
    .quick-action-text h4 {
        margin: 0 0 0.125rem;
        font-size: 0.875rem;
        border: none;
        padding: 0;
    }
    .quick-action-text p {
        margin: 0;
        font-size: 0.75rem;
        color: var(--text-light);
    }

    /* Room/Item Lists */
    .room-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .room-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.875rem 1rem;
        background: var(--bg);
        border-radius: var(--radius);
    }
    .room-item-info {
        display: flex;
        align-items: center;
        gap: 0.875rem;
    }
    .room-item-thumb {
        width: 50px;
        height: 32px;
        object-fit: cover;
        border-radius: 4px;
    }
    .room-item-name {
        font-weight: 500;
        font-size: 0.9rem;
    }
    .room-item-meta {
        font-size: 0.75rem;
        color: var(--text-light);
    }
    .room-item-actions {
        display: flex;
        gap: 0.5rem;
    }

    /* Hotspot badges */
    .hotspot-type {
        display: inline-block;
        padding: 0.125rem 0.5rem;
        background: var(--primary);
        color: var(--white);
        border-radius: 3px;
        font-size: 0.7rem;
        text-transform: uppercase;
        font-weight: 600;
    }

    /* Color inputs */
    .color-input {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
    .color-input input[type='color'] {
        width: 40px;
        height: 36px;
        padding: 2px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        cursor: pointer;
    }
    .color-input input[type='text'] {
        flex: 1;
    }

    /* QR Preview */
    .qr-preview {
        background: var(--bg);
        padding: 1.25rem;
        border-radius: var(--radius);
        text-align: center;
        margin-top: 1rem;
    }
    .qr-preview img {
        max-width: 150px;
        border-radius: var(--radius);
    }

    /* Download items */
    .download-item {
        background: var(--bg);
        padding: 1rem;
        border-radius: var(--radius);
        margin-bottom: 0.75rem;
    }
    .download-grid {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 1rem;
    }

    /* ========== RESPONSIVE: Form Grid ========== */
    @media (max-width: 600px) {
        .form-grid {
            grid-template-columns: 1fr;
        }
        .stats-grid {
            grid-template-columns: repeat(2, 1fr);
        }
        .quick-actions {
            grid-template-columns: 1fr;
        }
        .room-item {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.75rem;
        }
        .room-item-actions {
            width: 100%;
        }
        .room-item-actions .btn {
            flex: 1;
        }
        .download-grid {
            grid-template-columns: 1fr;
        }
    }
