@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Playfair+Display:wght@700;800&display=swap');

/* =========================================
   CSS VARIABLES & THEMING
   ========================================= */
:root {
  /* Brand */
  --accent: #E8973E;
  --accent-dark: #C97A28;
  --accent-light: #FBD38D;
  --accent-subtle: rgba(232,151,62,0.12);

  /* Light theme */
  --bg-root: #F5F3EF;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1A1C2E;
  --bg-sidebar-hover: rgba(232,151,62,0.12);
  --bg-sidebar-active: rgba(232,151,62,0.2);
  --bg-input: #FFFFFF;
  --bg-table-stripe: #FAF9F7;
  --bg-tooltip: #1A1C2E;

  --text-primary: #14121A;
  --text-secondary: #6B6880;
  --text-muted: #A09DB5;
  --text-sidebar: #D4D0E8;
  --text-sidebar-active: #FFFFFF;

  --border: #E8E5DE;
  --border-input: #D5D1C8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --shadow-accent: 0 4px 20px rgba(232,151,62,0.25);

  --sidebar-width: 260px;
  --header-height: 64px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-root: #0E0F19;
  --bg-card: #16192A;
  --bg-sidebar: #0B0D1A;
  --bg-sidebar-hover: rgba(232,151,62,0.1);
  --bg-sidebar-active: rgba(232,151,62,0.18);
  --bg-input: #1E2135;
  --bg-table-stripe: #1A1D30;
  --bg-tooltip: #FFFFFF;

  --text-primary: #EEECf6;
  --text-secondary: #9B98B8;
  --text-muted: #5E5C75;
  --text-sidebar: #8E8BAA;
  --text-sidebar-active: #FFFFFF;

  --border: #252840;
  --border-input: #2E3150;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.6);
  --shadow-accent: 0 4px 20px rgba(232,151,62,0.2);
}

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

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

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  transition: background 0.3s ease, color 0.3s ease;
  line-height: 1.6;
  overflow-x: hidden;
}

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

img { max-width: 100%; display: block; }
::selection { background: var(--accent-light); color: var(--text-primary); }

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-root);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(232,151,62,0.15) 0%, transparent 70%);
  top: -200px; left: -200px;
  border-radius: 50%;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(232,151,62,0.08) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  border-radius: 50%;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  font-family: 'Playfair Display', serif;
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  box-shadow: var(--shadow-accent);
}

.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

/* =========================================
   FORM CONTROLS (Global)
   ========================================= */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,151,62,0.15);
}

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

.input-group { position: relative; }
.input-group .input-icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1rem; pointer-events: none;
}
.input-group .form-control { padding-left: 2.75rem; }

.input-group .toggle-pw {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer; background: none; border: none;
  font-size: 1rem; padding: 0;
}
.input-group .toggle-pw:hover { color: var(--accent); }

/* =========================================
   BUTTONS (Global)
   ========================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; border: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent); color: white; border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark); border-color: var(--accent-dark);
  box-shadow: var(--shadow-accent); transform: translateY(-1px);
}

.btn-outline {
  background: transparent; color: var(--accent); border-color: var(--accent);
}
.btn-outline:hover { background: var(--accent-subtle); }

.btn-ghost {
  background: transparent; color: var(--text-secondary); border-color: transparent;
}
.btn-ghost:hover { background: var(--border); color: var(--text-primary); }

.btn-danger {
  background: #EF4444; color: white; border-color: #EF4444;
}
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }

.btn-success {
  background: #10B981; color: white; border-color: #10B981;
}
.btn-success:hover { background: #059669; border-color: #059669; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; border-radius: 8px; }

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

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 0.875rem;
}

.brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  color: white; font-size: 1rem; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(232,151,62,0.3);
}

.brand-text .name {
  font-size: 0.78rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.brand-text .tagline {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
}

.sidebar-section { padding: 1.25rem 0; }

.sidebar-section-label {
  padding: 0 1.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  margin-bottom: 0.5rem;
}

.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: var(--text-sidebar);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
  cursor: pointer;
}

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: #FFFFFF;
  border-left-color: rgba(232,151,62,0.5);
}

.sidebar-link.active {
  background: var(--bg-sidebar-active);
  color: #FFFFFF;
  border-left-color: var(--accent);
}

.sidebar-link .icon {
  width: 20px; height: 20px; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; opacity: 0.75;
}

.sidebar-link.active .icon,
.sidebar-link:hover .icon { opacity: 1; }

.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0.5rem 1.5rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex; align-items: center; gap: 0.75rem;
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, #A855F7 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}

.user-info .user-name {
  font-size: 0.8rem; font-weight: 600; color: white; line-height: 1.2;
}
.user-info .user-role {
  font-size: 0.68rem; color: rgba(255,255,255,0.4); text-transform: capitalize;
}

.user-logout {
  margin-left: auto; color: rgba(255,255,255,0.35); cursor: pointer;
  background: none; border: none; font-size: 1rem;
  transition: var(--transition);
}
.user-logout:hover { color: #EF4444; }

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

/* =========================================
   TOP HEADER
   ========================================= */
.topbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}

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

.sidebar-toggle {
  background: none; border: none; padding: 0.5rem;
  cursor: pointer; color: var(--text-secondary);
  border-radius: var(--radius-sm); display: none;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--border); color: var(--text-primary); }

.page-breadcrumb {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--text-muted);
}
.page-breadcrumb .current {
  color: var(--text-primary); font-weight: 600;
}
.page-breadcrumb .separator { opacity: 0.4; }

.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.topbar-action {
  width: 38px; height: 38px;
  background: var(--bg-root); border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: flex; align-items: center;
  justify-content: center; cursor: pointer;
  color: var(--text-secondary); font-size: 1rem;
  transition: var(--transition); position: relative;
}
.topbar-action:hover { border-color: var(--accent); color: var(--accent); }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: #EF4444; border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.theme-toggle-wrap {
  display: flex; align-items: center;
  background: var(--bg-root); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px;
  gap: 2px;
}

.theme-btn {
  width: 30px; height: 28px;
  background: none; border: none; cursor: pointer;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--text-muted); transition: var(--transition);
}
.theme-btn.active {
  background: var(--bg-card); color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* =========================================
   PAGE CONTENT
   ========================================= */
.page-body {
  flex: 1;
  padding: 2rem 1.75rem;
}

.page-header-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem; gap: 1rem;
}

.page-title-block .page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem; font-weight: 700;
  color: var(--text-primary); line-height: 1.2;
  margin-bottom: 0.25rem;
}

.page-title-block .page-subtitle {
  color: var(--text-muted); font-size: 0.85rem;
}

.page-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: var(--transition);
}

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

.stat-card-inner { display: flex; align-items: flex-start; justify-content: space-between; }

.stat-info .label {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem;
}

.stat-info .value {
  font-size: 2rem; font-weight: 700;
  font-family: 'Playfair Display', serif;
  color: var(--text-primary); line-height: 1;
}

.stat-info .change {
  font-size: 0.78rem; margin-top: 0.4rem;
  display: flex; align-items: center; gap: 0.3rem;
}
.change.up { color: #10B981; }
.change.down { color: #EF4444; }

.stat-icon-wrap {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}

.stat-card.orange .stat-icon-wrap { background: rgba(232,151,62,0.15); color: var(--accent); }
.stat-card.green .stat-icon-wrap { background: rgba(16,185,129,0.12); color: #10B981; }
.stat-card.blue .stat-icon-wrap { background: rgba(59,130,246,0.12); color: #3B82F6; }
.stat-card.purple .stat-icon-wrap { background: rgba(168,85,247,0.12); color: #A855F7; }
.stat-card.red .stat-icon-wrap { background: rgba(239,68,68,0.12); color: #EF4444; }
.stat-card.teal .stat-icon-wrap { background: rgba(20,184,166,0.12); color: #14B8A6; }

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  opacity: 0; transition: opacity 0.2s ease;
}
.stat-card:hover::after { opacity: 1; }
.stat-card.orange::after { background: var(--accent); }
.stat-card.green::after { background: #10B981; }
.stat-card.blue::after { background: #3B82F6; }
.stat-card.purple::after { background: #A855F7; }
.stat-card.red::after { background: #EF4444; }
.stat-card.teal::after { background: #14B8A6; }

/* =========================================
   CARDS
   ========================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-size: 0.95rem; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 0.5rem;
}

.card-title .icon { color: var(--accent); }

.card-body { padding: 1.5rem; }
.card-body.no-pad { padding: 0; }

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-table-stripe);
}

/* =========================================
   DATA TABLE
   ========================================= */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-table-stripe);
}

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

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

.data-table tbody tr {
  transition: background 0.15s ease;
}
.data-table tbody tr:hover { background: var(--bg-table-stripe); }

.data-table .actions-cell {
  display: flex; align-items: center; gap: 0.4rem;
}

/* =========================================
   BADGES / PILLS
   ========================================= */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
}

.badge-success { background: rgba(16,185,129,0.12); color: #10B981; }
.badge-warning { background: rgba(245,158,11,0.12); color: #D97706; }
.badge-danger  { background: rgba(239,68,68,0.12); color: #EF4444; }
.badge-info    { background: rgba(59,130,246,0.12); color: #3B82F6; }
.badge-purple  { background: rgba(168,85,247,0.12); color: #A855F7; }
.badge-muted   { background: var(--border); color: var(--text-muted); }
.badge-orange  { background: rgba(232,151,62,0.12); color: var(--accent-dark); }

.badge::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
}

/* =========================================
   SEARCH / FILTER BAR
   ========================================= */
.filter-bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-wrap .search-icon {
  position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.9rem; pointer-events: none;
}
.search-wrap input {
  padding-left: 2.5rem; padding-right: 1rem;
  height: 38px; background: var(--bg-root);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.875rem; color: var(--text-primary);
  width: 100%; outline: none; transition: var(--transition);
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.search-wrap input::placeholder { color: var(--text-muted); }

.filter-select {
  height: 38px; padding: 0 0.9rem;
  background: var(--bg-root); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit;
  font-size: 0.875rem; color: var(--text-primary); cursor: pointer;
  outline: none; transition: var(--transition); min-width: 140px;
}
.filter-select:focus { border-color: var(--accent); }

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

.gallery-admin-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  transition: var(--transition);
  position: relative;
}

.gallery-admin-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.gallery-admin-img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: var(--border);
}

.gallery-admin-info {
  padding: 0.75rem;
}

.gallery-admin-info .title {
  font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
  margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.gallery-admin-info .meta {
  font-size: 0.72rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between;
}

.gallery-admin-actions {
  display: flex; gap: 0.4rem; margin-top: 0.5rem;
}

.gallery-add-placeholder {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  aspect-ratio: 4/3;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.5rem;
  color: var(--text-muted); cursor: pointer;
  transition: var(--transition);
  background: var(--bg-root);
}

.gallery-add-placeholder:hover {
  border-color: var(--accent); color: var(--accent); background: var(--accent-subtle);
}

.gallery-add-placeholder .add-icon { font-size: 2rem; opacity: 0.5; }
.gallery-add-placeholder .add-text { font-size: 0.8rem; font-weight: 600; }

/* =========================================
   MODAL
   ========================================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.25rem;
  padding: 0.25rem; border-radius: 6px; transition: var(--transition);
}
.modal-close:hover { color: #EF4444; background: rgba(239,68,68,0.1); }

.modal-body { padding: 1.5rem; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
.toast-container {
  position: fixed; top: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.75rem;
}

.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; gap: 0.75rem;
  min-width: 300px; max-width: 380px;
  animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.removing { animation: slideOutRight 0.25s ease forwards; }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

.toast-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: #10B981; }
.toast.error .toast-icon { color: #EF4444; }
.toast.warning .toast-icon { color: #F59E0B; }
.toast.info .toast-icon { color: #3B82F6; }

.toast-body { flex: 1; }
.toast-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.15rem; }
.toast-msg { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 0.9rem; padding: 0;
  flex-shrink: 0; transition: var(--transition);
}
.toast-close:hover { color: var(--text-primary); }

/* =========================================
   IMAGE UPLOAD ZONE
   ========================================= */
.upload-zone {
  border: 2px dashed var(--border-input);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center; cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--accent); background: var(--accent-subtle);
}

.upload-zone .upload-icon { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.upload-zone .upload-text { font-size: 0.875rem; color: var(--text-secondary); }
.upload-zone .upload-text strong { color: var(--accent); }
.upload-zone .upload-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.upload-preview {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem; margin-top: 1rem;
}

.upload-preview-item {
  position: relative; border-radius: 8px; overflow: hidden;
  aspect-ratio: 1;
}

.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }

.upload-preview-item .remove {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.2rem;
  opacity: 0; transition: opacity 0.2s;
  cursor: pointer; border: none;
}

.upload-preview-item:hover .remove { opacity: 1; }

/* =========================================
   DASHBOARD CHARTS PLACEHOLDER
   ========================================= */
.chart-area {
  width: 100%; height: 240px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.85rem;
}

/* =========================================
   ACTIVITY FEED
   ========================================= */
.activity-feed { display: flex; flex-direction: column; }

.activity-item {
  display: flex; gap: 1rem; padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}

.activity-content .activity-text {
  font-size: 0.85rem; color: var(--text-primary); line-height: 1.4;
}

.activity-content .activity-time {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem;
}

/* =========================================
   EMPTY STATE
   ========================================= */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}

.empty-state .empty-icon {
  font-size: 3.5rem; color: var(--border); line-height: 1;
}

.empty-state .empty-title {
  font-size: 1rem; font-weight: 600; color: var(--text-primary);
}

.empty-state .empty-desc {
  font-size: 0.85rem; color: var(--text-muted); max-width: 320px;
}

/* =========================================
   PAGINATION
   ========================================= */
.pagination {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 1rem 1.5rem;
}

.page-link {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); background: var(--bg-card);
}

.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-link:disabled { opacity: 0.4; cursor: not-allowed; }

/* =========================================
   MISC UTILS
   ========================================= */
.separator { height: 1px; background: var(--border); margin: 1.5rem 0; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--text-secondary);
  flex-shrink: 0; overflow: hidden;
}
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

.amount-text { font-weight: 700; font-variant-numeric: tabular-nums; }

.progress-bar-wrap {
  height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.4);
  }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 199; display: none;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 768px) {
  .page-body { padding: 1.25rem 1rem; }
  .topbar { padding: 0 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-header-row { flex-direction: column; }
  .gallery-admin-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 2rem 1.5rem; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* =========================================
   TRANSITIONS for theme switch
   ========================================= */
*, *::before, *::after {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}
/* Exclude transforms so animations still work */
.btn, .stat-card, .sidebar-link, .toast, .modal, .gallery-admin-item {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
