/* ============================================================
   NEXUS COMMERCE - Admin Panel CSS
   Premium Dark Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --bg-primary:    #0f1117;
  --bg-secondary:  #161a24;
  --bg-card:       #1c2130;
  --bg-hover:      #232b3e;
  --border:        #2a3245;
  --border-light:  #3a4560;

  --text-primary:  #e8eaf3;
  --text-secondary:#8b92a9;
  --text-muted:    #5a6180;

  --accent:        #6366f1;
  --accent-hover:  #4f52d8;
  --accent-light:  rgba(99,102,241,.12);
  --accent-glow:   0 0 20px rgba(99,102,241,.35);

  --success:       #10b981;
  --success-light: rgba(16,185,129,.12);
  --warning:       #f59e0b;
  --warning-light: rgba(245,158,11,.12);
  --danger:        #ef4444;
  --danger-light:  rgba(239,68,68,.12);
  --info:          #3b82f6;
  --info-light:    rgba(59,130,246,.12);

  --sidebar-w:     260px;
  --header-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;

  --shadow:        0 4px 24px rgba(0,0,0,.35);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.5);

  --transition:    all .2s cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   LIGHT THEME VARIABLES
   ============================================================ */
[data-theme="light"],
body.theme-light {
  --bg-primary:    #f8fafc;
  --bg-secondary:  #ffffff;
  --bg-card:       #ffffff;
  --bg-hover:      #f1f5f9;
  --border:        #e2e8f0;
  --border-light:  #cbd5e1;

  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;

  --accent:        #4f46e5;
  --accent-hover:  #4338ca;
  --accent-light:  rgba(79,70,229,.08);
  --accent-glow:   0 0 20px rgba(79,70,229,.18);

  --shadow:        0 4px 20px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.1);
}

[data-theme="light"] .sidebar,
body.theme-light .sidebar {
  background: #ffffff;
  border-right-color: #e2e8f0;
}

[data-theme="light"] .topbar,
body.theme-light .topbar {
  background: #ffffff;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .form-control,
body.theme-light .form-control {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
[data-theme="light"] .form-control:focus,
body.theme-light .form-control:focus {
  background: #ffffff;
  border-color: var(--accent);
}

[data-theme="light"] .table,
body.theme-light .table {
  color: #0f172a;
}
[data-theme="light"] .table th,
body.theme-light .table th {
  background: #f8fafc;
  color: #475569;
  border-bottom-color: #e2e8f0;
}
[data-theme="light"] .table td,
body.theme-light .table td {
  border-bottom-color: #f1f5f9;
}
[data-theme="light"] .table tbody tr:hover,
body.theme-light .table tbody tr:hover {
  background: #f8fafc;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 16px;
}
.theme-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* Sidebar Collapsed State (Desktop) */
.admin-layout.sidebar-collapsed .sidebar {
  width: 72px;
}
.admin-layout.sidebar-collapsed .sidebar-brand {
  padding: 18px 16px;
  justify-content: center;
}
.admin-layout.sidebar-collapsed .sidebar-brand > div:last-child,
.admin-layout.sidebar-collapsed .nav-section-label,
.admin-layout.sidebar-collapsed .nav-chevron,
.admin-layout.sidebar-collapsed .user-mini-info,
.admin-layout.sidebar-collapsed .sidebar-footer svg,
.admin-layout.sidebar-collapsed .nav-badge {
  display: none !important;
}
.admin-layout.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px;
  font-size: 0;
}
.admin-layout.sidebar-collapsed .nav-item .nav-icon {
  margin: 0;
  width: 20px;
  height: 20px;
}
.admin-layout.sidebar-collapsed .nav-submenu {
  display: none !important;
}
.admin-layout.sidebar-collapsed .main-content {
  margin-left: 72px;
}
.admin-layout.sidebar-collapsed .sidebar:hover {
  width: var(--sidebar-w);
  box-shadow: var(--shadow-lg);
}
.admin-layout.sidebar-collapsed .sidebar:hover .sidebar-brand > div:last-child,
.admin-layout.sidebar-collapsed .sidebar:hover .nav-section-label,
.admin-layout.sidebar-collapsed .sidebar:hover .nav-chevron,
.admin-layout.sidebar-collapsed .sidebar:hover .user-mini-info,
.admin-layout.sidebar-collapsed .sidebar:hover .nav-badge {
  display: block !important;
}
.admin-layout.sidebar-collapsed .sidebar:hover .nav-item {
  justify-content: flex-start;
  font-size: 13.5px;
  padding: 10px 12px;
}
.admin-layout.sidebar-collapsed .sidebar:hover .nav-item.has-sub.open + .nav-submenu {
  display: block !important;
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
}

.sidebar-brand .brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand .brand-version {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

/* NAV */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 15%; bottom: 15%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .8;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* Submenu */
.nav-submenu {
  display: none;
  padding: 4px 0 4px 28px;
}

.nav-item.has-sub.open + .nav-submenu { display: block; }

.nav-submenu .nav-item {
  font-size: 13px;
  padding: 8px 12px;
}

.nav-chevron {
  margin-left: auto;
  transition: transform .2s;
  font-size: 12px;
}

.nav-item.has-sub.open .nav-chevron { transform: rotate(90deg); }

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.user-mini:hover { background: var(--bg-hover); }

.user-avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-mini-info { flex: 1; overflow: hidden; }
.user-mini-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-role { font-size: 11px; color: var(--text-muted); }

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

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-nav span:last-child { color: var(--text-primary); font-weight: 500; }
.breadcrumb-sep { opacity: .4; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }

.topbar-btn .badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 240px;
  transition: var(--transition);
}

.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  flex: 1;
  font-family: inherit;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }

.page-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}

.card:hover { border-color: var(--border-light); }

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color, var(--accent)), transparent);
}

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

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--icon-bg, var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); margin: 4px 0 2px; line-height: 1; }
.stat-change { font-size: 12px; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); border-color: var(--border-light); }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.btn-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-color: var(--warning);
}

.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-icon { padding: 9px; width: 38px; height: 38px; }
.btn-icon.btn-sm { width: 32px; height: 32px; padding: 6px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
  appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control-sm { padding: 7px 11px; font-size: 13px; }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b92a9' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; }

.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Checkbox / Radio */
.form-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  display: inline-block;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-light);
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   TABLE
   ============================================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.table tbody tr:hover { background: var(--bg-hover); }

.table-actions { display: flex; gap: 6px; align-items: center; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-gray    { background: rgba(100,116,139,.15); color: #94a3b8; }
.badge-accent  { background: var(--accent-light); color: var(--accent); }

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border-left: 3px solid transparent;
  margin-bottom: 20px;
}

.alert-success { background: var(--success-light); color: var(--success); border-left-color: var(--success); }
.alert-danger   { background: var(--danger-light); color: var(--danger); border-left-color: var(--danger); }
.alert-warning  { background: var(--warning-light); color: var(--warning); border-left-color: var(--warning); }
.alert-info     { background: var(--info-light); color: var(--info); border-left-color: var(--info); }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }

.tab {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

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

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; transition: var(--transition); }
.modal-close:hover { color: var(--text-primary); }

/* ============================================================
   CHARTS / WIDGETS
   ============================================================ */
.chart-container { position: relative; height: 220px; }

/* ============================================================
   IMAGE UPLOAD
   ============================================================ */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-primary);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-area .upload-icon { font-size: 36px; margin-bottom: 12px; opacity: .6; }
.upload-area p { font-size: 13.5px; color: var(--text-muted); }
.upload-area strong { color: var(--accent); }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.image-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.image-thumb img { width: 100%; height: 100%; object-fit: cover; }

.image-thumb .thumb-remove {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: var(--transition);
}

.image-thumb:hover .thumb-remove { opacity: 1; }

/* ============================================================
   SEO BOX
   ============================================================ */
.seo-preview {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: Arial, sans-serif;
  margin-top: 12px;
}

.seo-preview-title { color: #1a0dab; font-size: 18px; cursor: pointer; }
.seo-preview-title:hover { text-decoration: underline; }
.seo-preview-url { color: #006621; font-size: 14px; margin: 2px 0; }
.seo-preview-desc { color: #545454; font-size: 13px; }

.seo-score-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.seo-score-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.seo-score-dot.good { background: var(--success); }
.seo-score-dot.ok { background: var(--warning); }
.seo-score-dot.poor { background: var(--danger); }

.char-counter { font-size: 11.5px; color: var(--text-muted); text-align: right; margin-top: 4px; }
.char-counter.over { color: var(--danger); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 20px; }

.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.pagination a:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  min-width: 280px;
  max-width: 400px;
  animation: toast-in .3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 20px; }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .topbar { padding: 0 16px; }
  .search-bar { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 14px; }
}

/* ============================================================
   EDITOR (Rich Text)
   ============================================================ */
.editor-toolbar {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 8px 10px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.editor-btn {
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

.editor-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.editor-btn.active { background: var(--accent-light); color: var(--accent); }

.editor-sep { width: 1px; background: var(--border); margin: 4px 4px; }

.editor-area {
  min-height: 300px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 16px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.7;
  outline: none;
}

.editor-area:focus { border-color: var(--accent); }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 52px; margin-bottom: 16px; opacity: .5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 13.5px; margin-bottom: 20px; }
