/* Admin-Dashboard-spezifische Styles */
:root {
    --sidebar-width: 220px;
    --header-height: 60px;
    --nav-height: 50px;
    --primary-color: #3CB043; /* Grün des SC Grün-Weiß Paderborn */
    --primary-dark: #2C8032;
    --sidebar-bg: #2C3E50;
    --sidebar-active: #1A2530;
    --text-light: #8899AA;
}

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

.admin-header {
    background-color: #ffffff;
    border-bottom: 3px solid var(--primary-color);
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* NEW: Admin Navigation Bar - Fixed positioning to avoid overlap */
.admin-nav {
    position: fixed;
    top: calc(var(--header-height) + 5px); /* Added 5px gap for separation */
    left: 0;
    right: 0;
    height: var(--nav-height);
    background-color: var(--sidebar-bg);
    z-index: 980; /* Reduced z-index to stay below header dropdowns */
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    justify-content: space-between; /* Space between nav items and profile button */
}

/* User profile in navbar */
.admin-nav .user-profile {
    position: relative;
    margin-left: auto; /* Push to the right */
}

.admin-nav .admin-nav-container {
    display: flex;
    flex: 1;
}

/* Ensure user dropdown appears above navbar and other content */
#profileDropdown, .dropdown {
    z-index: 1050; /* Higher than admin-nav (980) and admin-header (1000) */
}

.admin-menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 4px;
    align-items: center;
    gap: 8px;
}

.admin-menu-toggle i {
    font-size: 18px;
}

.admin-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.admin-nav li {
    margin: 0;
    padding: 0;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: var(--nav-height);
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.admin-nav-item i {
    margin-right: 10px;
    font-size: 16px;
}

.admin-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.admin-nav-item.active {
    background-color: var(--sidebar-active);
    border-bottom: 3px solid var(--primary-color);
}

/* Admin Content Area */
.admin-content {
    margin-top: calc(var(--header-height) + var(--nav-height) + 5px); /* Added 5px to match the header-navbar gap */
    padding: 20px;
    background-color: #f5f7fa;
    min-height: calc(100vh - var(--header-height) - var(--nav-height) - 5px);
    position: relative; /* Establish a stacking context */
    z-index: 1;         /* Ensure it's below admin-nav (980) and admin-header (1000) */
}

.admin-view {
    display: none;
}

.admin-view.active {
    display: block;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #ffffff;
    position: fixed;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.admin-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-sidebar li {
    padding: 0;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ffffff;
    text-decoration: none;
    transition: background-color 0.2s;
}

.admin-nav-link i {
    margin-right: 10px;
    width: 20px;
}

.admin-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.admin-nav-link.active {
    background-color: var(--sidebar-active);
    border-left: 4px solid var(--primary-color);
}

/* Hauptbereich */
.admin-main {
    flex: 1;
    padding: 20px;
    margin-left: var(--sidebar-width);
    background-color: #f5f7fa;
    min-height: calc(100vh - var(--header-height));
}

.admin-view {
    display: none;
}

.admin-view.active {
    display: block;
}

/* Überschriften */
.admin-main h1 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

.admin-main h2 {
    font-size: 18px;
    margin: 15px 0;
}

/* Statistik-Karten */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-light);
    font-size: 14px;
}

/* Content-Boxen */
.admin-content-box {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

/* Tabellen */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #333;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background-color: #f5f5f5;
}

/* Aktionsleiste */
.action-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    flex-grow: 1;
    max-width: 300px;
}

.search-box input {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
}

.search-box button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
}

/* Toggle-Schalter für Einstellungen */
.toggle-container {
    display: flex;
    align-items: center;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-right: 10px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* Badges */
.badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 9px;
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    margin-left: 5px;
}

/* Formulare */
#settingsForm .form-group {
    margin-bottom: 20px;
}

/* Lade-Indikatoren */
.loading {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Buttons */
.btn-icon {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--primary-color);
    background-color: rgba(60, 176, 67, 0.1);
}

.edit-user {
    color: #3498db;
}

.delete-user {
    color: #e74c3c;
}

/* Responsive Design */
@media (max-width: 992px) {
    .admin-sidebar {
        width: 80px; /* Breiter gemacht für bessere Sichtbarkeit */
    }
    
    .admin-main {
        margin-left: 80px; /* Entsprechend angepasst */
    }
    
    .admin-nav-link span {
        display: none;
    }
    
    .admin-nav-link i {
        margin-right: 0;
        font-size: 22px; /* Größere Icons für Touchscreens */
    }

    .admin-nav-item {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .admin-header {
        padding: 0 10px;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    /* Admin-Sidebar immer sichtbar machen */
    .admin-sidebar {
        display: block;
        width: 80px;
        z-index: 1050;
    }

    .admin-menu-toggle {
        display: flex; /* Show on mobile */
    }
    
    .admin-nav {
        justify-content: space-between;
    }
    
    .admin-nav ul {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background-color: var(--sidebar-bg);
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
    }
    
    .admin-nav ul.expanded {
        max-height: 220px;
    }
    
    .admin-nav-item {
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* Admin navbar modified to always be visible */
    .admin-nav {
        display: flex !important;
        justify-content: center;
        padding: 0;
        height: auto;
        min-height: var(--nav-height);
    }
    
    /* Remove dropdown behavior */
    .admin-menu-toggle {
        display: none !important;
    }
    
    .admin-nav ul {
        position: static !important;
        display: flex !important;
        flex-direction: row !important;
        max-height: none !important;
        width: 100%;
        box-shadow: none;
        overflow: visible;
    }
    
    /* Make nav items more compact */
    .admin-nav-item {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 8px 0;
        height: var(--nav-height);
        width: 25%; /* 4 items = 25% each */
        border-bottom: none;
    }
    
    .admin-nav-item i {
        margin-right: 0;
        margin-bottom: 0; /* Remove bottom margin since there's no text */
        font-size: 24px; /* Make icons larger for better touch targets */
    }
    
    .admin-nav-item span {
        display: none !important; /* Hide text completely */
    }
    
    /* Admin navbar - optimized for smartphones */
    .admin-nav {
        display: flex !important;
        justify-content: space-between !important;
        padding: 0 !important;
        height: auto !important;
        min-height: var(--nav-height) !important;
        width: 100% !important;
    }
    
    /* Remove dropdown behavior */
    .admin-menu-toggle {
        display: none !important;
    }
    
    .admin-nav ul {
        position: static !important;
        display: flex !important;
        flex-direction: row !important;
        max-height: none !important;
        width: 100% !important;
        box-shadow: none !important;
        overflow: visible !important;
        justify-content: space-between !important;
    }
    
    .admin-nav li {
        flex: 1 !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    /* Make nav items use maximum available width */
    .admin-nav-item {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        height: 60px !important; /* Taller touch target */
        padding: 0 !important;
        margin: 0 !important;
        border-bottom: none !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    
    .admin-nav li:last-child .admin-nav-item {
        border-right: none !important;
    }
    
    .admin-nav-item i {
        margin: 0 !important;
        font-size: 26px !important; /* Larger icons */
    }
    
    .admin-nav-item span {
        display: none !important; /* Hide labels on mobile */
    }
    
    .admin-nav-item.active {
        background-color: var(--sidebar-active) !important;
        border-bottom: 3px solid var(--primary-color) !important;
    }
    
    /* Content needs to account for bottom navbar */
    .admin-content {
        margin-top: calc(var(--header-height) + var(--nav-height) + 5px); /* Added 5px to match the header-navbar gap */
        padding: 20px;
        background-color: #f5f7fa;
        min-height: calc(100vh - var(--header-height) - var(--nav-height) - 5px);
        position: relative; /* Establish a stacking context */
        z-index: 1;
    }
}

/* Responsive Design für mobile Geräte - Zusammengefasst und verbessert */
@media (max-width: 576px) {
    body .admin-container .admin-sidebar {
        position: fixed !important;
        top: var(--header-height) !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 70px !important;
        height: calc(100vh - var(--header-height)) !important;
        z-index: 1050 !important;
        display: flex !important;
        flex-direction: column !important;
        border-top: none !important;
        border-right: 2px solid var(--primary-color) !important;
        background-color: var(--sidebar-bg) !important;
        overflow-y: auto !important;
    }
    
    body .admin-container .admin-sidebar ul {
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: center !important;
        width: 100% !important;
        height: auto !important;
        padding-top: 15px !important;
        margin: 0 !important;
    }
    
    body .admin-container .admin-sidebar li {
        display: block !important;
        width: 100% !important;
        margin: 5px 0 !important;
    }
    
    body .admin-container .admin-sidebar .admin-nav-link {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 15px 5px !important;
        text-align: center !important;
        height: auto !important;
        min-height: 80px !important;
        width: 100% !important;
    }
    
    body .admin-container .admin-sidebar .admin-nav-link i {
        margin-right: 0 !important;
        margin-bottom: 8px !important;
        font-size: 24px !important;
        display: block !important;
    }
    
    body .admin-container .admin-sidebar .admin-nav-link span {
        display: block !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        text-align: center !important;
        width: 100% !important;
    }
    
    body .admin-container .admin-sidebar .admin-nav-link.active {
        border-left: 4px solid var(--primary-color) !important;
        border-top: none !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    body .admin-container .admin-main {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
        padding: 15px 10px !important;
    }
    
    /* Tabellen horizontal scrollbar für kleine Screens */
    .admin-table {
        min-width: 500px;
    }
    
    .admin-content-box {
        overflow-x: auto;
    }
}

/* Landscape-Modus für kleine Tablets */
@media (max-width: 768px) and (orientation: landscape) {
    .admin-sidebar {
        height: auto;
    }
    
    .admin-nav-link {
        height: 60px;
        padding: 8px 5px;
    }
    
    .admin-main {
        padding-bottom: 70px;
    }
}

/* Landscape-Modus für kleine Tablets - auch vertikale Navigation beibehalten */
@media (max-width: 768px) and (orientation: landscape) {
    .admin-sidebar {
        height: calc(100vh - var(--header-height));
    }
    
    .admin-nav-link {
        height: auto;
        min-height: 70px;
        padding: 10px 5px;
    }
    
    .admin-main {
        padding-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .admin-header .logo {
        font-size: 16px;
    }
    
    .admin-content {
        padding: 15px 10px;
    }
    
    /* Even more compact navbar for very small screens */
    .admin-nav-item i {
        font-size: 20px;
    }
    
    .admin-nav-item span {
        font-size: 10px;
    }
    
    /* Even larger icons for very small screens since there's no text */
    .admin-nav-item i {
        font-size: 26px;
    }
    
    /* Even larger icons for smallest screens for better touch */
    .admin-nav-item i {
        font-size: 28px !important;
    }
    
    /* Higher navbar for better touch on small screens */
    .admin-nav-item {
        height: 65px !important;
    }
}

/* Make sure dropdown is properly positioned relative to navbar */
.admin-nav .user-profile .dropdown {
    top: calc(100% + 5px);
    right: 0;
}
