/* =====================================================
   ADMIN PANEL – Additional Styles
   ===================================================== */

:root {
  --sidebar-w: 252px;
  --admin-primary: #6366f1;
  --admin-dark: #1e1b4b;
}

/* Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--admin-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  transition: all .18s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(99,102,241,.25);
  color: #fff;
}
.sidebar-nav .nav-icon { width: 20px; font-size: 1rem; }
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: rgba(255,255,255,.5);
  transition: color .18s;
}
.sidebar-footer a:hover { color: #fff; }

/* Admin Main */
.admin-main {
  flex: 1;
  padding: 28px;
  overflow-x: hidden;
  min-width: 0;
}
.admin-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon-purple { background: #ede9fe; }
.stat-icon-green  { background: #dcfce7; }
.stat-icon-orange { background: #fff7ed; }
.stat-icon-blue   { background: #dbeafe; }

.stat-info { flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: #1e293b; line-height: 1.1; }
.stat-label { font-size: .8rem; color: #64748b; font-weight: 500; margin-top: 2px; }

/* Admin Table */
.admin-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.admin-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-card-title { font-size: 1rem; font-weight: 700; color: #1e293b; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  background: #f8fafc;
  padding: 10px 16px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.admin-table td {
  padding: 12px 16px;
  font-size: .9rem;
  color: #374151;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fafc; }

.admin-table-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
}

/* Admin Form */
.admin-form-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 28px;
  max-width: 700px;
}
.admin-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .admin-form-row { grid-template-columns: 1fr; } }

.admin-form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.admin-form-group label { font-size: .85rem; font-weight: 600; color: #374151; }
.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .92rem;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: #fff;
}
.admin-form-group textarea { resize: vertical; }

/* Checkbox toggle */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.toggle-group label {
  font-size: .88rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}
.toggle {
  width: 46px;
  height: 26px;
  background: #cbd5e1;
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  outline: none;
  border: none;
}
.toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(99,102,241,.3);
}
.toggle:checked { background: var(--admin-primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.toggle:checked::after { transform: translateX(20px); }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }

/* Actions */
.action-btns { display: flex; gap: 8px; align-items: center; }
.btn-icon-only {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  font-size: .85rem;
  transition: all .18s;
  cursor: pointer;
  text-decoration: none;
}
.btn-icon-only:hover        { background: #eff6ff; border-color: #3b82f6; color: #3b82f6; }
.btn-icon-only.btn-danger:hover { background: #fee2e2; border-color: #ef4444; color: #ef4444; }

/* Admin button styles */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
}
.btn-admin-primary { background: var(--admin-primary); color: #fff; }
.btn-admin-primary:hover { background: #4f46e5; transform: translateY(-1px); }
.btn-admin-danger  { background: #fee2e2; color: #b91c1c; }
.btn-admin-danger:hover  { background: #fecaca; }
.btn-admin-ghost   { background: transparent; color: #64748b; border: 1.5px solid #e2e8f0; }
.btn-admin-ghost:hover   { background: #f8fafc; }

/* Image preview */
.img-preview-wrap {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  border: 2px dashed #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 8px;
  cursor: pointer;
  transition: border-color .18s;
}
.img-preview-wrap:hover { border-color: var(--admin-primary); }
.img-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #94a3b8;
  font-size: .8rem;
}

/* Mobile sidebar overlay */
@media (max-width: 768px) {
  .admin-layout         { flex-direction: column; }
  .admin-sidebar        {
    width: 100%;
    height: auto;
    position: relative;
  }
  .admin-sidebar.collapsed { display: none; }
}

/* Responsive table */
@media (max-width: 640px) {
  .admin-table thead  { display: none; }
  .admin-table tr     { display: block; border-bottom: 2px solid #e2e8f0; padding: 12px 0; }
  .admin-table td     { display: flex; justify-content: space-between; padding: 6px 16px; border: none; }
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #94a3b8;
    font-size: .8rem;
  }
}
