/* ================================================================
   ADMIN.CSS - KOMPLETT BEREINIGT
   ================================================================ */

/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
  --sidebar-width: 240px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Light Mode */
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --bg-input: #f8fafc;
  --bg-modal: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-success: #dcfce7;
  --bg-error: #fee2e2;
  --bg-warning: #fef3c7;
  --bg-info: #dbeafe;
  
  --text-primary: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #64748b;
  --text-sidebar: #94a3b8;
  --text-sidebar-hover: #f1f5f9;
  --text-success: #166534;
  --text-error: #991b1b;
  --text-warning: #b45309;
  
  --border-color: #e2e8f0;
  --border-dark: #334155;
  
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.10);
  
  --transition: 0.2s;
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg-body: #0a0f1a;
  --bg-card: #1a2332;
  --bg-hover: #243041;
  --bg-input: #1a2332;
  --bg-modal: #1a2332;
  --bg-sidebar: #0a0f1a;
  --bg-sidebar-hover: #1a2332;
  --bg-success: #064e3b;
  --bg-error: #7f1d1d;
  --bg-warning: #451a03;
  --bg-info: #1e3a5f;
  
  --text-primary: #f1f5f9;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-sidebar: #94a3b8;
  --text-sidebar-hover: #f1f5f9;
  --text-success: #86efac;
  --text-error: #fca5a5;
  --text-warning: #fcd34d;
  
  --border-color: #2a3a4f;
  --border-dark: #334155;
  
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.4);
}

/* ============================================================
   BASE
   ============================================================ */
* { box-sizing: border-box; }

body {
  background: var(--bg-body);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-nav {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  min-height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 16px;
  border-right: 1px solid var(--border-dark);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  text-decoration: none;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
}

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-hover);
}

.sidebar-link.active {
  background: #3b82f6;
  color: white;
}

.sidebar-link .icon {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border-dark);
  margin: 8px 0;
}

.sidebar-logo-container {
  margin-bottom: 20px;
  text-align: center;
  padding: 8px 0;
}

.sidebar-logo {
  max-width: 100%;
  max-height: 50px;
  object-fit: contain;
}

.cms-logo {
  font-size: 22px;
  font-weight: 700;
  color: #3b82f6;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #3b82f6;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: #3b82f6;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card .stat-border {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}
.stat-border.blue { background: #3b82f6; }
.stat-border.green { background: #22c55e; }
.stat-border.amber { background: #f59e0b; }
.stat-border.purple { background: #8b5cf6; }
.stat-border.red { background: #ef4444; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  padding: 8px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn:active { transform: translateY(0); }

.btn-blue { background: #3b82f6; color: white; }
.btn-blue:hover { background: #2563eb; }

.btn-green { background: #22c55e; color: white; }
.btn-green:hover { background: #16a34a; }

.btn-red { background: #ef4444; color: white; }
.btn-red:hover { background: #dc2626; }

.btn-purple { background: #8b5cf6; color: white; }
.btn-purple:hover { background: #7c3aed; }

.btn-amber { background: #f59e0b; color: white; }
.btn-amber:hover { background: #d97706; }

.btn-pink { background: #ec4899; color: white; }
.btn-pink:hover { background: #db2777; }

.btn-teal { background: #14b8a6; color: white; }
.btn-teal:hover { background: #0d9488; }

.btn-gray { background: #e2e8f0; color: #1e293b; }
.btn-gray:hover { background: #cbd5e1; }

.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

[data-theme="dark"] .btn-gray {
  background: #2a3a4f;
  color: #f1f5f9;
}
[data-theme="dark"] .btn-gray:hover { background: #3a4a5f; }

/* ============================================================
   INPUTS
   ============================================================ */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  transition: all var(--transition);
  outline: none;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
}

.input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.modal-overlay.active { display: flex !important; }
.modal-overlay.show { display: flex !important; }

.modal-box {
  background: var(--bg-modal);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  animation: modalFade 0.2s ease;
}

@keyframes modalFade {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.dashboard-item {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  overflow: hidden;
}

.dashboard-item:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #3b82f6;
}

.dashboard-item .widget-body {
  padding: 12px 16px 16px 16px;
  height: 100%;
  overflow-y: auto;
}

/* ============================================================
   EDIT MODE
   ============================================================ */
.edit-mode-indicator {
  display: none;
  padding: 4px 12px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.edit-mode-indicator.active { display: inline-block; }

[data-theme="dark"] .edit-mode-indicator {
  background: #1e3a5f;
  color: #60a5fa;
}

.dashboard-item.edit-mode {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 18px;
  padding: 0 4px;
}

.drag-handle:active { cursor: grabbing; }

/* ============================================================
   WIDGET PICKER
   ============================================================ */
.widget-picker {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.widget-picker.active { display: flex; }

.widget-picker-content {
  background: var(--bg-modal);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

.widget-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--bg-hover);
  transition: all var(--transition);
}

.widget-option:hover {
  border-color: #3b82f6;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.widget-option .widget-icon { font-size: 24px; }
.widget-option .widget-info { flex: 1; }
.widget-option .widget-name { font-weight: 600; }
.widget-option .widget-desc { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   GALLERY
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: #3b82f6;
}

.gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.gallery-item .info {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 40px;
  cursor: zoom-out;
}

.gallery-lightbox.active { display: flex; }

.gallery-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  cursor: default;
}

.gallery-lightbox .close-lightbox {
  position: absolute;
  top: 24px;
  right: 32px;
  color: white;
  font-size: 40px;
  cursor: pointer;
  background: none;
  border: none;
  opacity: 0.7;
  transition: transform var(--transition);
}

.gallery-lightbox .close-lightbox:hover {
  transform: scale(1.2);
  opacity: 1;
}

.gallery-lightbox .lightbox-info {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  font-weight: 500;
  background: rgba(0,0,0,0.6);
  padding: 10px 24px;
  border-radius: 30px;
  backdrop-filter: blur(8px);
  text-align: center;
  max-width: 80%;
}

/* ============================================================
   PREVIEW
   ============================================================ */
.preview-frame {
  width: 100% !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: all 0.3s;
  background: var(--bg-card);
}

.preview-desktop { height: 700px !important; }
.preview-tablet { max-width: 768px !important; height: 700px !important; margin: 0 auto; }
.preview-mobile { max-width: 375px !important; height: 750px !important; margin: 0 auto; }

/* ============================================================
   LOGS
   ============================================================ */
.log-entry {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  color: var(--text-primary);
}

.log-entry .line-num {
  color: var(--text-muted);
  min-width: 40px;
  flex-shrink: 0;
}

.log-entry.error {
  border-left: 3px solid #ef4444;
  background: var(--bg-error);
}

.log-entry.warn {
  border-left: 3px solid #f59e0b;
  background: var(--bg-warning);
}

.log-entry.success {
  border-left: 3px solid #22c55e;
  background: var(--bg-success);
}

/* ============================================================
   FILE LIST
   ============================================================ */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  color: var(--text-primary);
}

.file-item:hover {
  border-color: var(--border-color);
  background: var(--bg-card);
}

.file-item .file-icon { font-size: 18px; }
.file-item .file-name { font-weight: 500; }
.file-item .file-type {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 8px;
}
.file-item .file-size {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}
.file-item .file-modified {
  font-size: 11px;
  color: var(--text-muted);
}
.file-item.folder-item .file-name { color: #3b82f6; }

/* ============================================================
   USER TABLE
   ============================================================ */
.user-table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.user-table-modern th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

.user-table-modern td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.user-table-modern tr:hover td { background: var(--bg-hover); }

.user-table-modern .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.user-table-modern .user-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-table-modern .user-name .username { font-weight: 600; }
.user-table-modern .user-name .current-badge {
  font-size: 10px;
  background: var(--bg-info);
  color: #1d4ed8;
  padding: 1px 8px;
  border-radius: 10px;
}

.user-table-modern .role-badge-sm {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.user-table-modern .role-badge-sm.admin {
  background: #fef3c7;
  color: #b45309;
}
.user-table-modern .role-badge-sm.moderator {
  background: #dbeafe;
  color: #1d4ed8;
}

[data-theme="dark"] .user-table-modern .role-badge-sm.admin {
  background: #451a03;
  color: #fcd34d;
}
[data-theme="dark"] .user-table-modern .role-badge-sm.moderator {
  background: #1e3a5f;
  color: #60a5fa;
}

.user-table-modern .actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.user-table-modern .actions button {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
  color: var(--text-muted);
}

.user-table-modern .actions .btn-edit:hover {
  background: var(--bg-info);
  color: #1d4ed8;
}
.user-table-modern .actions .btn-delete:hover {
  background: var(--bg-error);
  color: #dc2626;
}
.user-table-modern .actions .btn-force-logout:hover {
  background: var(--bg-warning);
  color: #d97706;
}

/* ============================================================
   PROFIL HEADER
   ============================================================ */
.profile-header {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.profile-header .avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.profile-header .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  font-weight: 700;
  overflow: hidden;
  border: 3px solid var(--border-color);
  transition: all var(--transition);
}

.profile-header .avatar:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
}

.profile-header .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  border: 2px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.avatar-upload-btn:hover {
  background: #2563eb;
  transform: scale(1.1);
}

.avatar-remove-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: 2px solid var(--bg-card);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.avatar-remove-btn.visible { display: flex; }
.avatar-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.profile-header .info h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.profile-header .info .role-badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.profile-header .info .role-badge.admin {
  background: #fef3c7;
  color: #b45309;
}
.profile-header .info .role-badge.moderator {
  background: #dbeafe;
  color: #1d4ed8;
}

[data-theme="dark"] .profile-header .info .role-badge.admin {
  background: #451a03;
  color: #fcd34d;
}
[data-theme="dark"] .profile-header .info .role-badge.moderator {
  background: #1e3a5f;
  color: #60a5fa;
}

.profile-header .meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================================
   SETTINGS GRID
   ============================================================ */
.settings-grid-modern {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .settings-grid-modern { grid-template-columns: 1fr; }
}

.setting-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}

.setting-card:hover {
  border-color: #3b82f6;
  box-shadow: var(--shadow-card-hover);
}

.setting-card .card-icon {
  font-size: 20px;
  margin-right: 10px;
}

.setting-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}

.setting-card .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.setting-card .form-group {
  margin-bottom: 12px;
}

.setting-card .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.setting-card .form-group input,
.setting-card .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition);
  outline: none;
}

.setting-card .form-group input:focus,
.setting-card .form-group select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ============================================================
   TOTP STATUS
   ============================================================ */
.totp-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
}

.totp-status .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.totp-status .status-dot.active { background: #22c55e; }
.totp-status .status-dot.inactive { background: #94a3b8; }

.totp-status .status-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.totp-qr-container {
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border-color);
}

.totp-qr-container .qr-wrapper {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

.totp-qr-container .qr-wrapper img {
  max-width: 180px;
  border-radius: 8px;
  background: white;
  padding: 8px;
}

/* ============================================================
   PERMISSION CARDS
   ============================================================ */
.perm-card {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.perm-card:hover {
  border-color: #3b82f6;
  box-shadow: var(--shadow-card);
}

.perm-card.perm-allowed { border-left: 3px solid #22c55e; }
.perm-card.perm-denied { border-left: 3px solid #ef4444; }
.perm-card.perm-changed {
  border-color: #f59e0b;
  background: var(--bg-warning);
}

.perm-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.perm-action-icon { font-size: 16px; }
.perm-action-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.perm-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.perm-role-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 12px;
}

.perm-changed-badge { font-size: 12px; color: #f59e0b; }
.perm-locked-badge { font-size: 12px; color: #94a3b8; }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cbd5e1;
  transition: 0.3s;
  border-radius: 22px;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider { background: #22c55e; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

[data-theme="dark"] .toggle-slider { background: #475569; }

/* ============================================================
   NAVIGATION CARDS
   ============================================================ */
.nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: grab;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}

.nav-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59,130,246,0.12);
}

.nav-card.dragging {
  opacity: 0.4;
  transform: scale(0.97);
  cursor: grabbing;
}

.nav-card.drag-over {
  border-color: #3b82f6;
  background: rgba(59,130,246,0.08);
  transform: scale(1.01);
}

.nav-card .drag-handle {
  color: var(--text-muted);
  font-size: 18px;
  cursor: grab;
  padding: 4px 6px;
  opacity: 0.4;
  transition: opacity var(--transition);
}

.nav-card:hover .drag-handle { opacity: 1; }
.nav-card .drag-handle:active { cursor: grabbing; }

.nav-card .nav-position {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 28px;
  text-align: center;
}

.nav-card .nav-icon {
  font-size: 18px;
  width: 30px;
  text-align: center;
  color: var(--text-primary);
}

.nav-card .nav-info { flex: 1; min-width: 0; }
.nav-card .nav-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.nav-card .nav-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.nav-card .badge {
  font-size: 9px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.badge-active {
  background: var(--bg-success);
  color: var(--text-success);
}
.badge-inactive {
  background: var(--bg-error);
  color: var(--text-error);
}
.badge-link {
  background: var(--bg-info);
  color: #1d4ed8;
}
.badge-js {
  background: #ede9fe;
  color: #7c3aed;
}
.badge-divider {
  background: var(--bg-hover);
  color: var(--text-muted);
}
.badge-target-blank {
  background: var(--bg-info);
  color: #1d4ed8;
}

.nav-card .nav-actions { display: flex; gap: 2px; }
.nav-card .nav-actions button {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}
.nav-card .nav-actions .btn-edit:hover {
  background: var(--bg-info);
  color: #1d4ed8;
}
.nav-card .nav-actions .btn-delete:hover {
  background: var(--bg-error);
  color: #dc2626;
}

.nav-card.divider-card {
  background: var(--bg-hover);
  border-style: dashed;
  padding: 10px 18px;
}

[data-theme="dark"] .nav-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .nav-card:hover {
  border-color: #60a5fa !important;
}
[data-theme="dark"] .nav-card .badge-link {
  background: #1e3a5f !important;
  color: #60a5fa !important;
}
[data-theme="dark"] .nav-card .badge-js {
  background: #2d1b4e;
  color: #a78bfa;
}

/* ============================================================
   CSS EDITOR – KLASSEN
   ============================================================ */
.class-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.class-item:hover {
  border-color: #3b82f6;
  box-shadow: var(--shadow-card-hover);
}

.class-item .class-name {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.class-item .class-css {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--bg-input);
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 8px;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

/* ============================================================
   CSS PROPERTY ROWS
   ============================================================ */
.prop-row {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.prop-row input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition);
  outline: none;
}

.prop-row input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.prop-row .prop-remove-btn {
  background: var(--bg-error);
  color: var(--text-error);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}

.prop-row .prop-remove-btn:hover {
  background: #ef4444;
  color: white;
}

/* ============================================================
   CSS EDITOR CONTAINER
   ============================================================ */
.css-editor-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.css-editor-container textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  resize: vertical;
  line-height: 1.6;
}

.css-editor-container textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.css-editor-container .editor-status {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}

.css-editor-container .editor-status.success {
  display: block;
  background: var(--bg-success);
  color: var(--text-success);
}
.css-editor-container .editor-status.error {
  display: block;
  background: var(--bg-error);
  color: var(--text-error);
}
.css-editor-container .editor-status.info {
  display: block;
  background: var(--bg-info);
  color: #1d4ed8;
}
.css-editor-container .editor-status.warning {
  display: block;
  background: var(--bg-warning);
  color: var(--text-warning);
}

/* ============================================================
   DUAL CSS EDITOR
   ============================================================ */
.dual-editor-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .dual-editor-container { grid-template-columns: 1fr; }
}

.editor-column {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  max-height: 700px;
  transition: all 0.3s ease;
}

.editor-column.expanded {
  max-height: none;
  grid-column: 1 / -1;
}

.editor-column .column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
  flex-shrink: 0;
}

.editor-column .column-header .column-icon { font-size: 18px; }
.editor-column .column-header .column-title { font-size: 14px; color: var(--text-primary); }

.editor-column .column-header .column-badge {
  font-size: 10px;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.editor-column .column-header .column-expand-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--transition);
}

.editor-column .column-header .column-expand-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Light Spalte */
.light-column { border-top: 3px solid #f59e0b; }
.light-column .column-header {
  background: #fffbeb;
  border-bottom-color: #fcd34d;
}
.light-column .column-header .column-badge {
  background: #fef3c7;
  color: #b45309;
}

/* Dark Spalte */
.dark-column { border-top: 3px solid #6366f1; }
.dark-column .column-header {
  background: #1e293b;
  border-bottom-color: #334155;
}
.dark-column .column-header .column-title { color: #e2e8f0; }
.dark-column .column-header .column-badge {
  background: #334155;
  color: #94a3b8;
}

.column-content {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-input);
  min-height: 200px;
}

.column-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-hover);
  flex-shrink: 0;
}

/* ============================================================
   KLASSEN-KARTEN IN SPALTEN
   ============================================================ */
.class-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.class-card:hover {
  border-color: #3b82f6;
  box-shadow: var(--shadow-card);
}

.class-card.light-card { border-left: 3px solid #f59e0b; }
.class-card.dark-card {
  border-left: 3px solid #6366f1;
  background: #1a2332;
}

.class-card .class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.class-card .class-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.class-card .class-actions { display: flex; gap: 4px; }

.class-card .class-actions .btn-edit-small,
.class-card .class-actions .btn-delete-small {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  color: var(--text-muted);
}

.class-card .class-actions .btn-edit-small:hover {
  background: var(--bg-info);
  color: #1d4ed8;
}
.class-card .class-actions .btn-delete-small:hover {
  background: var(--bg-error);
  color: #dc2626;
}

.class-card .class-properties {
  font-size: 12px;
  font-family: 'Courier New', monospace;
  margin-bottom: 6px;
}

.class-card .class-properties .prop-line {
  padding: 2px 0;
  color: var(--text-secondary);
}
.class-card .class-properties .prop-line .prop-key { color: #7c3aed; }
.class-card .class-properties .prop-line .prop-value { color: #16a34a; }
.class-card .class-properties .prop-line.empty {
  color: var(--text-muted);
  font-style: italic;
}

.class-card .class-css-preview {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  background: var(--bg-input);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
  max-height: 80px;
  overflow-y: auto;
}

.dark-card .class-css-preview {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

/* ============================================================
   KLASSEN-ÜBERSICHT (LISTE)
   ============================================================ */
.class-list-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.class-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  transition: all var(--transition);
}

.class-list-item:hover {
  border-color: #3b82f6;
  background: var(--bg-card);
}

.class-list-item .list-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.class-list-item .class-name-sm {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
}

.class-list-item .badge {
  font-size: 10px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}
.class-list-item .badge-light {
  background: #fef3c7;
  color: #b45309;
}
.class-list-item .badge-dark {
  background: #1e293b;
  color: #94a3b8;
}

.class-list-item .list-item-right { display: flex; gap: 4px; }
.class-list-item .list-item-right button {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  color: var(--text-muted);
}
.class-list-item .list-item-right .btn-edit-small:hover {
  background: var(--bg-info);
  color: #1d4ed8;
}
.class-list-item .list-item-right .btn-delete-small:hover {
  background: var(--bg-error);
  color: #dc2626;
}

[data-theme="dark"] .class-list-item .badge-dark {
  background: #334155;
  color: #94a3b8;
}
[data-theme="dark"] .class-list-item .badge-light {
  background: #451a03;
  color: #fcd34d;
}
[data-theme="dark"] .class-list-item {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .class-list-item:hover {
  border-color: #60a5fa;
  background: #2d3a4f;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}
.empty-state .empty-sub { font-size: 13px; margin-top: 4px; }

/* ============================================================
   SQL EDITOR
   ============================================================ */
.sql-editor-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  resize: vertical;
  line-height: 1.6;
}

.sql-editor-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.sql-status {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}

.sql-status.success {
  display: block;
  background: var(--bg-success);
  color: var(--text-success);
}
.sql-status.error {
  display: block;
  background: var(--bg-error);
  color: var(--text-error);
}
.sql-status.info {
  display: block;
  background: var(--bg-info);
  color: #1d4ed8;
}

/* ============================================================
   SQL RESULT TABLE
   ============================================================ */
.sql-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sql-result-table th {
  background: var(--bg-hover);
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sql-result-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.sql-result-table tr:hover td { background: var(--bg-hover); }
.sql-result-table .null-value { color: var(--text-muted); font-style: italic; }

/* ============================================================
   TABLE ITEMS
   ============================================================ */
.table-item {
  display: inline-block;
  padding: 4px 12px;
  margin: 2px 4px;
  background: var(--bg-hover);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.table-item:hover {
  background: var(--bg-info);
  border-color: #3b82f6;
  color: #1d4ed8;
}

.table-item.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

[data-theme="dark"] .table-item:hover {
  background: #1e3a5f;
  color: #60a5fa;
  border-color: #3b82f6;
}
[data-theme="dark"] .table-item.active {
  background: #3b82f6;
  color: white;
}

/* ============================================================
   MESSAGE / TOAST
   ============================================================ */
.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: none;
}

.message.success {
  display: block;
  background: var(--bg-success);
  color: var(--text-success);
}
.message.error {
  display: block;
  background: var(--bg-error);
  color: var(--text-error);
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 12px 0;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading-spinner {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.loading-spinner::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   EXPANDED MODE
   ============================================================ */
.dual-editor-container.expanded { display: block; }
.dual-editor-container.expanded .editor-column { max-height: none; }
.dual-editor-container.expanded .editor-column:not(.expanded) { display: none !important; }
.dual-editor-container.expanded .editor-column.expanded { display: flex !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar-nav {
    width: 56px;
    padding: 8px;
  }
  .sidebar-nav .label { display: none; }
  .sidebar-nav .sidebar-link { justify-content: center; padding: 10px; }
  .sidebar-logo-container { display: none; }
  
  .dashboard-grid { gap: 12px; }
  .card { padding: 14px; }
  .modal-box { margin: 10px; padding: 16px; }
  .stat-number { font-size: 22px; }
  
  .editor-column { max-height: 500px; }
  .class-card .class-card-header { flex-wrap: wrap; gap: 4px; }
}

@media (max-width: 640px) {
  .nav-card {
    flex-wrap: wrap;
    padding: 12px 14px;
    gap: 8px;
  }
  .nav-card .nav-info { flex: 1 1 100%; order: 3; }
  .nav-card .nav-url { max-width: 100%; }
  .nav-card .nav-badges { order: 4; }
  .nav-card .nav-actions { order: 5; margin-left: auto; }
  
  .gallery-lightbox .lightbox-info {
    font-size: 13px;
    padding: 6px 16px;
    max-width: 90%;
    white-space: normal;
    bottom: 16px;
  }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }