/* =====================
   Admin Dashboard CSS
   ===================== */

/* Theme Variables */
:root {
  --bg: #0b0c10;
  --card: #121318;
  --card-elevated: #1a1b22;
  --muted: #8a8f98;
  --fg: #f5f7fb;
  --accent: #229e41;
  --accent-hover: #1d8838;
  --accent-light: rgba(34, 158, 65, 0.15);
  --border: #2b2e39;
  --border-light: #3a3e4a;
  --danger: #ff6b6b;
  --ok: #2ecc71;
  --warning: #f2c94c;
  --info: #3498db;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
  --shadow-sm: 0 4px 12px rgba(0,0,0,.15);
  
  --sidebar-width: 260px;
  --mobile-header-height: 60px;
  
  color-scheme: dark;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Utilities */
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hr { height: 1px; background: var(--border); margin: 12px 0; }

/* ==================== LOGIN ==================== */
#loginScreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.3s ease;
}
#loginScreen.hidden {
  opacity: 0;
  pointer-events: none;
}
.login-container {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.login-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.login-title { text-align: center; }
.login-title h1 { font-size: 24px; font-weight: 600; margin: 0 0 8px 0; }
.login-title p { font-size: 14px; color: var(--muted); margin: 0; }
.login-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.login-card label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.login-pin-input {
  width: 100%;
  padding: 16px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 8px;
  text-align: center;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--fg);
  transition: all 0.2s ease;
}
.login-pin-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.login-pin-input::placeholder { letter-spacing: 4px; color: var(--muted); opacity: 0.5; }
.login-message { min-height: 20px; margin-top: 12px; font-size: 13px; text-align: center; color: var(--muted); }
.login-message.error { color: var(--danger); }
.login-message.success { color: var(--ok); }
.login-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.login-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.login-btn-primary { background: var(--accent); color: #fff; }
.login-btn-primary:hover { filter: brightness(1.1); }
.login-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.login-btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.login-btn-ghost:hover { background: var(--bg); color: var(--fg); }
.login-footer { text-align: center; font-size: 12px; color: var(--muted); }
.login-footer a { color: var(--muted); text-decoration: none; }
.login-footer a:hover { color: var(--fg); }
.login-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}
.login-btn-primary.loading .login-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-2fa-section { display: none; }
.login-2fa-section.active { display: block; }
.login-pin-section.hidden { display: none; }

/* ==================== LAYOUT ==================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ==================== MOBILE HEADER ==================== */
.admin-mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-header-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  gap: 12px;
}
.sidebar-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sidebar-toggle:hover { background: var(--card-elevated); }
.sidebar-toggle span {
  width: 20px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
}
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.mobile-brand .brand-icon { font-size: 20px; }
.btn-save-mobile {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== SIDEBAR OVERLAY ==================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active { 
  opacity: 1; 
  pointer-events: auto;
}

/* ==================== SIDEBAR ==================== */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.brand-info { display: flex; flex-direction: column; gap: 2px; }
.brand-info strong { font-size: 15px; }
.sidebar-close {
  display: none;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}
.sidebar-close:hover { background: var(--card-elevated); color: var(--fg); }

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-section { margin-bottom: 12px; }
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 12px;
  margin-bottom: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: var(--card-elevated);
  border-color: var(--border);
}
.nav-item.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; }
.nav-text { flex: 1; }
.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-badge 2s ease-in-out infinite;
}
.nav-badge.update-badge { background: var(--warning); }
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-info { display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.logout-btn {
  width: 100%;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}
.logout-btn:hover { opacity: 1; }

/* ==================== MAIN CONTENT ==================== */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ==================== PAGE HEADER ==================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}
.page-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-subtitle {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==================== PAGE TOOLBAR ==================== */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--card-elevated);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar-search {
  flex: 1;
  min-width: 200px;
  max-width: 500px;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-size: 14px;
  transition: all 0.2s ease;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.search-input::placeholder { color: var(--muted); }
.toolbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Action Buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.action-btn:hover {
  background: var(--border);
}
.action-icon { font-size: 13px; }

/* ==================== PAGE CONTENT ==================== */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-elevated);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--card-elevated); }
.btn.ghost { background: transparent; }
.btn.danger { background: #c0392b; border-color: transparent; color: #fff; }
.btn.icon { width: 42px; padding: 0; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-new { background: #7a5cff !important; border-color: transparent !important; color: #fff !important; }

/* ==================== FORM ELEMENTS ==================== */
.input, select, textarea {
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-size: 14px;
  transition: all 0.2s ease;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
textarea { min-height: 80px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 6px; }
label.f > span { font-size: 12px; color: var(--muted); font-weight: 500; }
label.f.f-row { flex-direction: row; align-items: center; gap: 10px; }
label.f .chk { display: flex; align-items: center; gap: 8px; }
.fullwidth { grid-column: 1 / -1; }

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
}
.toast {
  display: inline-block;
  min-width: 180px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}
.toast:not(:empty) { opacity: 1; transform: translateY(0); }
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }

/* ==================== PRODUCTS GRID ==================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.products-grid:has(> :only-child) { grid-template-columns: 1fr; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 16px;
  text-align: center;
}
.empty-icon { font-size: 48px; opacity: 0.6; }
.empty-text { font-size: 16px; color: var(--muted); }

/* ==================== PRODUCT CARD ==================== */
.prod {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.prod:hover { border-color: var(--border-light); }
.prod.flash { box-shadow: 0 0 0 3px var(--accent); }

/* Section Accordion */
.prod details.sec { border-bottom: 1px solid var(--border); }
.prod details.sec:last-child { border-bottom: none; }
.prod details.sec > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card-elevated);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
}
.prod details.sec > summary::-webkit-details-marker { display: none; }
.prod details.sec > summary::after {
  content: "▾";
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.prod details.sec[open] > summary::after { transform: rotate(180deg); }
.prod details.sec > summary:hover { background: var(--border); }
.sec-title { flex: 1; }
.sec-meta { font-size: 11px; color: var(--muted); font-weight: 400; margin-right: 10px; }
.sec-body { padding: 14px; }

/* Base Grid */
.base {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

/* Sizes */
.sizes { display: flex; flex-direction: column; gap: 12px; }
.sizes-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.sizes-wrap { display: flex; flex-direction: column; gap: 10px; }
.size {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  padding: 12px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.size-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.size-chip {
  font-size: 10px;
  padding: 3px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.size-actions { grid-column: 1 / -1; justify-content: flex-end; }

/* Media Grid */
.media-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.media-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.media-head { font-size: 12px; font-weight: 600; }
.media-head code { font-size: 10px; color: var(--muted); background: var(--bg); padding: 2px 5px; border-radius: 4px; margin-left: 4px; }
.media-preview {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ==================== DASHBOARD ==================== */

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.info { border-left: 3px solid var(--info); }
.stat-card.danger { border-left: 3px solid var(--danger); }
.stat-icon { font-size: 28px; }
.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 24px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--muted); }

/* Dashboard Section */
.dashboard-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}
.section-header {
  margin-bottom: 16px;
}
.section-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* Size Stats */
.size-stats { display: flex; flex-direction: column; gap: 12px; }
.size-stat { display: flex; align-items: center; gap: 12px; }
.size-label { width: 60px; font-size: 13px; font-weight: 600; }
.size-bar {
  flex: 1;
  height: 24px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
}
.size-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  border-radius: 6px;
  transition: width 0.5s ease;
}
.size-value { width: 50px; font-size: 14px; font-weight: 700; text-align: right; }

/* Issues Grid */
.issues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.issue-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.issue-card:hover { border-color: var(--warning); }
.issue-icon { font-size: 20px; }
.issue-value { font-size: 18px; font-weight: 700; }
.issue-label { font-size: 11px; color: var(--muted); }

/* Quick Links */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}
.quick-link:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.quick-icon { font-size: 20px; }

/* ==================== DIALOGS ==================== */
.dlg {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
}
.dlg::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.dlg-card {
  width: min(800px, 92vw);
  max-height: 90vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dlg-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.dlg-body { flex: 1; overflow-y: auto; padding: 18px; }
.dlg-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
  .products-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-mobile-header { display: flex; }
  .admin-sidebar {
    transform: translateX(-100%);
    border-right: none;
    box-shadow: var(--shadow);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay { display: block; }
  .admin-main {
    margin-left: 0;
    padding-top: var(--mobile-header-height);
  }
  /* Page Header ausblenden - Mobile Header zeigt alles */
  .page-header {
    display: none !important;
  }
  .page-toolbar {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-search { max-width: none; }
  .toolbar-actions { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .action-text { display: none; }
  .page-content { padding: 16px; }
  .media-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .page-actions .txt { display: none; }
  .page-actions .btn { flex: 0; width: 44px; padding: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .base { grid-template-columns: 1fr; }
  .size { grid-template-columns: 1fr; }
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
  .admin-mobile-header {
    padding-top: max(0px, env(safe-area-inset-top));
    height: calc(var(--mobile-header-height) + env(safe-area-inset-top));
  }
  .admin-sidebar { padding-top: env(safe-area-inset-top); }
}

/* Prevent iOS zoom */
@media (max-width: 900px) {
  input, select, textarea, button { font-size: 16px !important; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ==================== COLLAPSIBLE SIDEBAR SECTIONS ==================== */
.nav-section.collapsible .nav-section-title {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-section-toggle {
  font-size: 10px;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.nav-section.collapsed .nav-section-toggle {
  transform: rotate(-90deg);
}

.nav-section-items {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 500px;
  opacity: 1;
}

.nav-section.collapsed .nav-section-items {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.nav-section-title.clickable:hover {
  color: var(--accent);
}

/* ==================== UPDATE SECTION IM DASHBOARD ==================== */
.update-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.update-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.update-section h2 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.update-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.update-status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.update-status-badge.current {
  background: rgba(46, 204, 113, 0.15);
  color: var(--ok);
}

.update-status-badge.outdated {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  animation: pulse 2s infinite;
}

.update-status-badge.checking {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
}

.update-info {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
}

.update-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.update-info-label {
  font-size: 12px;
  color: var(--muted);
}

.update-info-value {
  font-size: 16px;
  font-weight: 600;
}

.update-available-card {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  display: none;
}

.update-available-card.show {
  display: block;
}

.update-available-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.update-available-version {
  font-size: 18px;
  font-weight: 700;
  color: var(--warning);
}

.update-changes {
  margin: 12px 0;
  padding-left: 20px;
}

.update-changes li {
  margin: 6px 0;
  font-size: 14px;
  color: var(--fg);
}

.update-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.update-actions .btn {
  flex: 1;
}

.update-message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 14px;
}

.update-message.success {
  background: rgba(46, 204, 113, 0.15);
  color: var(--ok);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.update-message.error {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.update-message.info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.update-changes-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}

/* ==================== CHANGELOG SECTION ==================== */
.changelog-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.changelog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}

.changelog-header:hover {
  color: var(--accent);
}

.changelog-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.changelog-toggle {
  font-size: 12px;
  opacity: 0.6;
  transition: transform 0.2s;
}

.changelog-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.changelog-content.expanded {
  max-height: 2000px;
  overflow-y: auto;
}

.changelog-entry {
  padding: 16px;
  margin: 12px 0;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.changelog-entry.version-current {
  border-color: var(--accent);
  background: rgba(34, 158, 65, 0.05);
}

.changelog-version-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.changelog-version {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}

.version-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
}

.changelog-date {
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}

.changelog-changes {
  margin: 0;
  padding: 0;
  list-style: none;
}

.changelog-changes li {
  padding: 6px 0;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--fg);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.changelog-changes li:last-child {
  border-bottom: none;
}

.change-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

/* Change Type Colors */
.change-new { color: var(--ok); }
.change-fix { color: var(--info); }
.change-improve { color: #f59e0b; }
.change-change { color: var(--muted); }
.change-remove { color: var(--danger); }
.change-security { color: #8b5cf6; }
.change-major { color: var(--accent); font-weight: 600; }
.change-initial { color: var(--ok); }

/* Scrollbar für Changelog */
.changelog-content.expanded::-webkit-scrollbar {
  width: 6px;
}

.changelog-content.expanded::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 3px;
}

.changelog-content.expanded::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.changelog-content.expanded::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ==================== UPDATE BANNER ==================== */
.update-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  margin-bottom: 20px;
  animation: banner-pulse 3s ease-in-out infinite;
}

@keyframes banner-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 20px 5px rgba(245, 158, 11, 0.15); }
}

.update-banner-icon {
  font-size: 24px;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.update-banner-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--warning);
}

.update-banner-link {
  padding: 6px 14px;
  background: var(--warning);
  color: #000;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.update-banner-link:hover {
  background: #fbbf24;
  transform: translateY(-1px);
}

/* ==================== BACKUP STATUS ==================== */
.backup-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.backup-status-text {
  flex: 1;
  font-size: 14px;
  color: var(--ok);
}

.backup-status-text strong {
  color: var(--fg);
}

/* ==================== BADGE FIX - Gelb für Update ==================== */
.nav-badge.update-badge {
  background: var(--warning) !important;
  color: #000 !important;
}

/* ==================== BACKUP SECTION ==================== */
.backup-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.backup-actions {
  margin-bottom: 16px;
}

.backup-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.backup-list-container h3 {
  font-size: 14px;
  color: var(--muted);
  margin: 16px 0 12px 0;
  font-weight: 500;
}

.backup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backup-loading,
.backup-empty,
.backup-error {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.backup-error {
  color: var(--danger);
}

.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 12px;
  transition: all 0.2s;
}

.backup-item:hover {
  border-color: var(--accent);
  background: rgba(34, 158, 65, 0.03);
}

.backup-item.restoring {
  opacity: 0.7;
  pointer-events: none;
}

.backup-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.backup-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  word-break: break-all;
}

.backup-item-meta {
  font-size: 12px;
  color: var(--muted);
}

.backup-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.backup-item-actions .btn {
  padding: 6px 10px;
  font-size: 14px;
}

.restoring-text {
  font-size: 13px;
  color: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

/* Backup Status in Backup Section */
.backup-section .backup-status {
  margin-bottom: 16px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .backup-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .backup-item-actions {
    justify-content: flex-end;
  }
}

/* ==================== UPDATE SUCCESS BANNER ==================== */
.update-success-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.2), rgba(46, 204, 113, 0.05));
  border: 1px solid rgba(46, 204, 113, 0.5);
  border-radius: 12px;
  margin-bottom: 20px;
  animation: success-glow 2s ease-in-out infinite;
}

@keyframes success-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.2); }
  50% { box-shadow: 0 0 20px 5px rgba(46, 204, 113, 0.15); }
}

.update-success-icon {
  font-size: 24px;
}

.update-success-text {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--ok);
}
