/* ========================================
   Admin Panel — Modern Sidebar Layout
======================================== */

:root {
  --primary: #C75B1E;
  --secondary: #1A2B5F;
  --bg-dark: #0f172a;
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 10px;
  --shadow: 0 2px 16px rgba(0,0,0,.08);
  --transition: .2s ease;
  --font: 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button { cursor: pointer; border: none; font-family: inherit; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 12px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: .85rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.sidebar-logo-text small { color: #94a3b8; font-weight: 400; font-size: .75rem; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

.nav-section {
  padding: 12px 16px 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 1px 8px;
  border-radius: 8px;
  color: #64748b;
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: .95rem; }
.nav-item:hover { background: #f8fafc; color: #0f172a; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
}
.nav-item.active .badge { background: rgba(255,255,255,.3); }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid #f1f5f9;
}
.sidebar-footer .nav-item { color: #94a3b8; }
.sidebar-footer .nav-item:hover { color: #ef4444; background: #fef2f2; }

/* ── MAIN ── */
.admin-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.admin-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.admin-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-header-title span {
  font-weight: 400;
  color: #94a3b8;
  font-size: .85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: .85rem;
  font-weight: 600;
  color: #475569;
}
.header-user-avatar {
  width: 30px; height: 30px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
}

/* ── PAGE CONTENT ── */
.page-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ── CARDS ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-card-icon.orange { background: rgba(199,91,30,.1); color: var(--primary); }
.stat-card-icon.blue { background: rgba(26,43,95,.1); color: var(--secondary); }
.stat-card-icon.green { background: rgba(22,163,74,.1); color: #16a34a; }
.stat-card-icon.purple { background: rgba(124,58,237,.1); color: #7c3aed; }

.stat-card-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-lbl {
  font-size: .78rem;
  color: #94a3b8;
  font-weight: 500;
}

/* ── PANEL / CARD ── */
.panel {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
}
.panel-title {
  font-size: .95rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title i { color: var(--primary); }
.panel-body { padding: 24px; }

/* ── FORM ELEMENTS ── */
.form-grid { display: grid; gap: 20px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-label i { color: #94a3b8; font-size: .75rem; }

.field-input, .field-textarea, .field-select {
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .875rem;
  font-family: var(--font);
  color: #1e293b;
  background: #fff;
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.field-input:focus, .field-textarea:focus, .field-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(199,91,30,.1);
}
.field-textarea { resize: vertical; min-height: 100px; }
.field-color {
  width: 48px; height: 38px;
  padding: 2px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  background: none;
}
.color-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-hex {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .875rem;
  font-family: monospace;
  outline: none;
  transition: var(--transition);
}
.color-hex:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(199,91,30,.1); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-ghost { background: #f1f5f9; color: #475569; border: 1.5px solid #e2e8f0; }
.btn-ghost:hover { background: #e2e8f0; filter: none; }
.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: .9rem;
}

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }

.table-img {
  width: 48px; height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* ── BADGE / STATUS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-new { background: #fef3c7; color: #92400e; }

/* ── ALERTS ── */
.alert {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: .875rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ── IMAGE UPLOAD ── */
.img-upload-area {
  border: 2px dashed #e2e8f0;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.img-upload-area:hover, .img-upload-area.dragging {
  border-color: var(--primary);
  background: rgba(199,91,30,.03);
}
.img-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.img-upload-icon { font-size: 2rem; color: #cbd5e1; margin-bottom: 12px; }
.img-upload-text { font-size: .875rem; color: #64748b; }
.img-upload-text strong { color: var(--primary); }
.img-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  margin-top: 16px;
  display: none;
}

/* ── LOGIN ── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--secondary) 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 12px;
}
.login-title { font-size: 1.3rem; font-weight: 800; color: #0f172a; }
.login-subtitle { font-size: .875rem; color: #64748b; margin-top: 4px; }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  color: #64748b;
  transition: var(--transition);
  background: none;
  text-align: center;
}
.tab-btn.active { background: #fff; color: #0f172a; box-shadow: var(--shadow); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(20px);
  transition: var(--transition);
  box-shadow: 0 30px 80px rgba(0,0,0,.2);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; color: #0f172a; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: .9rem;
  transition: var(--transition);
}
.modal-close:hover { background: #fee2e2; color: #dc2626; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── ICON PICKER ── */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}
.icon-opt {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  color: #64748b;
}
.icon-opt:hover { border-color: var(--primary); color: var(--primary); }
.icon-opt.selected { border-color: var(--primary); background: rgba(199,91,30,.08); color: var(--primary); }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-wrap { margin-left: 0; }
  .stat-cards { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
