* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1f2937;
    --sidebar-bg: #111827;
    --text-light: #f9fafb;
    --text-dark: #1f2937;
    --border-color: #e5e7eb;
}

/* Dark Mode Variables */
body.dark-mode {
    --dark-bg: #0f172a;
    --sidebar-bg: #1e293b;
    --text-light: #f1f5f9;
    --text-dark: #f1f5f9;
    --border-color: #334155;
    background: #0f172a !important;
    color: #f1f5f9;
}

body.dark-mode .sidebar {
    background: #1e293b;
    border-right: 1px solid #334155;
}

body.dark-mode .sidebar-header {
    background: #0f172a;
    border-bottom: 1px solid #334155;
}

body.dark-mode .nav-menu a {
    color: #cbd5e1;
}

body.dark-mode .nav-menu a:hover,
body.dark-mode .nav-menu a.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-left: 3px solid #60a5fa;
}

body.dark-mode .dropdown-submenu li a {
    color: #94a3b8;
}

body.dark-mode .dropdown-submenu li a:hover,
body.dark-mode .dropdown-submenu li a.active {
    color: #60a5fa;
}

body.dark-mode .card,
body.dark-mode .login-box,
body.dark-mode .top-bar,
body.dark-mode .modal-content,
body.dark-mode .stat-card,
body.dark-mode .category-nav,
body.dark-mode .vorschrift-item {
    background: #1e293b !important;
    color: #f1f5f9;
    border-color: #334155;
}

body.dark-mode .top-bar {
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

body.dark-mode .main-content {
    background: #0f172a;
}

body.dark-mode table {
    color: #f1f5f9;
}

body.dark-mode table th {
    background: #334155 !important;
    color: #f1f5f9;
    border-bottom: 2px solid #475569;
}

body.dark-mode table td {
    border-bottom: 1px solid #334155;
}

body.dark-mode table tr:hover {
    background: #334155 !important;
}

body.dark-mode .info-text,
body.dark-mode .vorschrift-item p {
    color: #cbd5e1 !important;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark-mode .category-btn {
    background: #334155;
    color: #cbd5e1;
    border-color: #475569;
}

body.dark-mode .category-btn:hover {
    background: #475569;
    border-color: #60a5fa;
    color: #60a5fa;
}

body.dark-mode .alert-success {
    background: #065f46;
    color: #d1fae5;
}

body.dark-mode .alert-error {
    background: #991b1b;
    color: #fee2e2;
}

body.dark-mode .badge-admin {
    background: #1e3a8a;
    color: #dbeafe;
}

body.dark-mode .badge-user {
    background: #374151;
    color: #e5e7eb;
}

body.dark-mode .stat-card h3 {
    color: #94a3b8;
}

body.dark-mode .dropdown-menu {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .dropdown-menu a:hover {
    background: #334155;
}

body.dark-mode .user-info:hover {
    background: #334155;
}

body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode h3, 
body.dark-mode h4 {
    color: #f1f5f9;
}

body.dark-mode .card h2 {
    color: #60a5fa;
}

body.dark-mode .section-header h3 {
    color: #60a5fa;
}

body.dark-mode .message-username {
    color: #60a5fa;
}

body.dark-mode .abteilung-tag {
    background: #1e3a8a;
    color: #dbeafe;
}

body.dark-mode .multi-select-box {
    background: #334155;
    border-color: #475569;
}

body.dark-mode .multi-select-box label:hover {
    background: #475569;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f3f4f6;
    color: var(--text-dark);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Dark Mode Icon Toggle */
.dark-mode-icon-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 15px;
    color: #4b5563;
}

.dark-mode-icon-toggle:hover {
    background: #e5e7eb;
    transform: scale(1.1);
}

.dark-mode-icon-toggle svg {
    transition: transform 0.3s ease;
}

.dark-mode-icon-toggle:hover svg {
    transform: rotate(20deg);
}

body.dark-mode .dark-mode-icon-toggle {
    background: #334155;
    color: #fbbf24;
}

body.dark-mode .dark-mode-icon-toggle:hover {
    background: #475569;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 28px;
}

.login-box .subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 30px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
    transform: translateY(-2px);
}

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--text-light);
    padding: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 22px;
    margin-bottom: 5px;
    color: white;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.nav-menu {
    list-style: none;
    padding: 15px 0;
}

.nav-menu li {
    margin: 5px 0;
}

.nav-menu a {
    display: block;
    padding: 12px 20px;
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 15px;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
    border-left: 3px solid var(--secondary-color);
    padding-left: 17px;
}

/* Dropdown Navigation */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s;
}

.dropdown-toggle.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-submenu {
    display: none;
    list-style: none;
    padding-left: 15px;
    margin: 5px 0;
}

.dropdown-submenu li a {
    padding: 10px 20px;
    font-size: 14px;
    color: #9ca3af;
}

.dropdown-submenu li a:hover,
.dropdown-submenu li a.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--secondary-color);
    border-left: 2px solid var(--secondary-color);
    padding-left: 18px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    background: #f3f4f6;
}

.top-bar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h1 {
    font-size: 24px;
    color: var(--text-dark);
}

.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background 0.3s;
}

.user-info:hover {
    background: #f3f4f6;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.user-details {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.user-rank {
    font-size: 12px;
    color: #6b7280;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.3s;
    font-size: 14px;
}

.dropdown-menu a:hover {
    background: #f3f4f6;
}

.dropdown-menu a:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-menu a:last-child {
    border-radius: 0 0 8px 8px;
    color: var(--danger-color);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.3s;
    border-bottom: 1px solid #e5e7eb;
}

.dark-mode-toggle:hover {
    background: #f3f4f6;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 12px;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--primary-color);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(20px);
}

.content-area {
    padding: 30px;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
}

.card h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr:hover {
    background: #f9fafb;
}

table td {
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-user {
    background: #e5e7eb;
    color: #4b5563;
}

/* Rang Badges */
.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #374151;
}

.rank-badge.rank-high {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.rank-badge.rank-medium {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: #1e3a8a;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.rank-badge.rank-low {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: #1e293b;
}

.rank-level {
    background: rgba(0, 0, 0, 0.15);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.section {
    margin-bottom: 30px;
}

.section-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.section-header h3 {
    color: var(--primary-color);
    font-size: 20px;
}

.info-text {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 22px;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Rang und Leader Badges */
.leader-badge {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rank-badge .rank-level {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
}

.rank-badge.rank-high {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
}

.rank-badge.rank-medium {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.rank-badge.rank-low {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
}

body.dark-mode .rank-badge {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

