/* =============================================
   XOX ADMIN DASHBOARD STYLES
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --magenta: #CC1A7A;
  --magenta-dark: #A31462;
  --magenta-pale: rgba(204,26,122,0.08);
  --black: #0A0A0A;
  --near-black: #111;
  --dark: #1A1A1A;
  --mid: #242424;
  --border: rgba(255,255,255,0.08);
  --grey: #666;
  --light: rgba(255,255,255,0.7);
  --white: #fff;
  --sidebar-w: 260px;
  --font: 'Inter', 'Space Grotesk', sans-serif;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
}
html, body { height: 100%; font-family: var(--font); background: var(--black); color: var(--white); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, textarea, select { font-family: var(--font); }

/* ---- LOGIN ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  top: -30%; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(204,26,122,0.1) 0%, transparent 65%);
  pointer-events: none;
}
.login-box {
  background: var(--near-black);
  border: 1px solid var(--border);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 40px; margin: 0 auto 12px; }
.login-logo p { font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--grey); }
.login-box h2 { font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--grey); }
.form-field input, .form-field textarea, .form-field select {
  background: var(--dark);
  border: 1px solid var(--border);
  color: var(--white);
  padding: 11px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--magenta); }
.form-field textarea { resize: vertical; min-height: 90px; }
.form-field select option { background: var(--dark); }
.btn-login {
  background: var(--magenta);
  color: var(--white);
  border: none;
  padding: 13px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
  width: 100%;
}
.btn-login:hover { background: var(--magenta-dark); }
.login-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #ef4444; padding: 10px 14px; font-size: 0.83rem; text-align: center; }

/* ---- DASHBOARD LAYOUT ---- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--near-black);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img { height: 28px; margin-bottom: 6px; }
.sidebar-brand p { font-size: 0.65rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--grey); }
.sidebar-nav { padding: 16px 0; flex: 1; }
.nav-section-label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey);
  padding: 8px 20px 6px;
  margin-top: 8px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.83rem;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  transition: color 0.2s, background 0.2s;
  border-left: 2px solid transparent;
}
.sidebar-nav a i { width: 16px; text-align: center; font-size: 0.85rem; }
.sidebar-nav a:hover { color: var(--white); background: rgba(255,255,255,0.04); }
.sidebar-nav a.active { color: var(--magenta); border-left-color: var(--magenta); background: var(--magenta-pale); }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--grey);
  transition: color 0.2s;
}
.sidebar-footer a:hover { color: var(--white); }

/* ---- ADMIN MAIN ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  height: 56px;
  background: var(--near-black);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar h1 { font-size: 1rem; font-weight: 700; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.admin-content { padding: 32px; flex: 1; }

/* ---- CARDS + TABLE ---- */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  margin-bottom: 32px;
  border: 1px solid var(--border);
}
.dash-stat {
  background: var(--near-black);
  padding: 24px 20px;
}
.dash-stat .num { font-size: 2rem; font-weight: 800; color: var(--magenta); line-height: 1; }
.dash-stat .lbl { font-size: 0.72rem; color: var(--grey); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 6px; }
.section-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.section-actions h2 { font-size: 1.1rem; font-weight: 700; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: var(--magenta); color: var(--white); }
.btn-primary:hover { background: var(--magenta-dark); }
.btn-secondary { background: transparent; color: var(--white); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--magenta); color: var(--magenta); }
.btn-danger { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 6px 12px; font-size: 0.72rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey); padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-weight: 600; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; font-size: 0.85rem; color: rgba(255,255,255,0.7); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table .actions { display: flex; gap: 8px; }
.thumb { width: 60px; height: 40px; object-fit: cover; background: var(--mid); }
.thumb-placeholder { width: 60px; height: 40px; background: var(--mid); display: flex; align-items: center; justify-content: center; color: var(--grey); font-size: 0.9rem; }
.tag { display: inline-block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; background: var(--magenta-pale); color: var(--magenta); border: 1px solid rgba(204,26,122,0.2); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--near-black);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--near-black);
  z-index: 1;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--grey); font-size: 1.2rem; cursor: pointer; padding: 4px; transition: color 0.2s; line-height: 1; }
.modal-close:hover { color: var(--white); }
.modal-body { padding: 24px; }
.modal-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--near-black);
}

/* ---- IMAGE UPLOAD ---- */
.img-upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.img-upload-slot {
  aspect-ratio: 4/3;
  background: var(--dark);
  border: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.img-upload-slot:hover { border-color: var(--magenta); }
.img-upload-slot .slot-preview {
  position: absolute;
  inset: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
}
.img-upload-slot .slot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.img-upload-slot:hover .slot-overlay { opacity: 1; }
.img-upload-slot .slot-label { font-size: 0.7rem; color: var(--grey); text-align: center; }
.img-upload-slot i { font-size: 1.4rem; color: var(--grey); }
.img-upload-slot input[type=file] { display: none; }
.img-url-input { margin-top: 6px; }

/* ---- TOAST ---- */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  border: 1px solid transparent;
}
.toast.success { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.3); color: #22c55e; }
.toast.error { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #ef4444; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
