/* ============================================
   CariJodoh Admin - Clean Minimalist Design
   ============================================ */

/* ---- Design Tokens ---- */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --surface: #ffffff;
  --surface-hover: #f8fafc;

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

  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-subtle: #f1f5f9;

  --accent: #3b82f6;
  --accent-soft: #eff6ff;
  --accent-hover: #2563eb;

  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;

  --sidebar-bg: #ffffff;
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;

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

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.04), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.04), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.04), 0 8px 10px -6px rgb(0 0 0 / 0.04);

  --transition-fast: 0.12s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  letter-spacing: -0.01em;
  min-height: 100vh;
}

/* ---- Admin Shell ---- */
.admin-shell {
  background: var(--bg-primary);
}

.admin-shell #app {
  background: transparent;
}

/* ---- Sidebar ---- */
.sidebar-base {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  width: var(--sidebar-width);
  transition: width var(--transition-base);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 64px;
}

.brand-block > .flex {
  align-items: center;
}

.brand-block .block:first-child {
  color: var(--text-primary) !important;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-block .block:last-child {
  color: var(--text-tertiary) !important;
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

.sidebar-toggle {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--border);
}

.sidebar-base nav {
  padding: 12px 10px !important;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary) !important;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

.nav-link:active {
  transform: scale(0.98);
}

.nav-link.bg-slate-900,
.nav-link.bg-slate-800,
.nav-link[class*="bg-slate-900"],
.nav-link[class*="bg-slate-800"] {
  background: var(--text-primary) !important;
  color: white !important;
  border-color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm);
}

.nav-link.bg-slate-900 svg,
.nav-link.bg-slate-800 svg,
.nav-link[class*="bg-slate-900"] svg,
.nav-link[class*="bg-slate-800"] svg,
.nav-link.bg-slate-900 [stroke],
.nav-link.bg-slate-800 [stroke],
.nav-link[class*="bg-slate-900"] [stroke],
.nav-link[class*="bg-slate-800"] [stroke] {
  color: white !important;
  stroke: white !important;
}

.nav-link.bg-slate-900 span,
.nav-link[class*="bg-slate-900"] span {
  color: white !important;
}

.sidebar-status {
  margin: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  font-size: 12px;
  font-weight: 500;
}

/* ---- Header ---- */
.admin-header {
  background: rgba(248, 250, 252, 0.8) !important;
  border-bottom: 1px solid var(--border) !important;
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  min-height: 64px;
  padding: 0 32px !important;
  position: sticky;
  top: 0;
  z-index: 30;
}

.admin-header h1 {
  color: var(--text-primary) !important;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ---- Main Content Area ---- */
main > div.flex-1 {
  background: transparent !important;
}

main > div.flex-1 > div {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

/* ---- Cards ---- */
.card,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
}

.card-header h2 {
  color: var(--text-primary) !important;
  font-size: 14px !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-card {
  padding: 24px;
}

.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.stat-card .p-2 {
  background: var(--bg-secondary) !important;
  border-radius: var(--radius-md) !important;
  padding: 10px !important;
}

.stat-card p.text-2xl {
  color: var(--text-primary) !important;
  font-size: 28px !important;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.stat-card p.text-xs,
.stat-card p.text-\[11px\] {
  color: var(--text-tertiary) !important;
  font-weight: 500;
}

/* ---- Tables ---- */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

thead {
  background: var(--bg-secondary);
}

.th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.td {
  padding: 14px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

tbody tr {
  transition: background var(--transition-fast);
}

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

tbody tr:hover {
  background: var(--bg-secondary) !important;
}

code {
  background: var(--bg-secondary) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ---- Inputs ---- */
.input-field {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  font-size: 13px;
  padding: 9px 13px;
  border-radius: var(--radius-md) !important;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: inherit;
}

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

.input-field:hover {
  border-color: var(--border-strong) !important;
}

.input-field:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.input-field option {
  background: var(--surface);
  color: var(--text-primary);
}

/* ---- Buttons ---- */
button, a {
  -webkit-tap-highlight-color: transparent;
}

.icon-btn,
.page-btn {
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

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

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--text-primary) !important;
  color: white !important;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.primary-btn:hover {
  background: var(--text-secondary) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.primary-btn:active {
  transform: translateY(0);
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 600;
  transition: all 0.16s ease;
}

.secondary-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--surface-subtle);
}

.settings-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.settings-tab:hover {
  color: var(--text-primary);
  background: var(--surface-subtle);
}

.settings-tab-active {
  color: white !important;
  background: var(--text-primary) !important;
  box-shadow: var(--shadow-sm);
}

/* ---- Status Badges ---- */
span[class*="bg-emerald-500/10"] {
  background: var(--success-soft) !important;
  color: #059669 !important;
  border: 1px solid #a7f3d0;
}

span[class*="bg-amber-500/10"] {
  background: var(--warning-soft) !important;
  color: #d97706 !important;
  border: 1px solid #fde68a;
}

span[class*="bg-red-500/10"] {
  background: var(--danger-soft) !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca;
}

span[class*="bg-blue-500/10"] {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border: 1px solid #bfdbfe;
}

span[class*="bg-violet-500/10"] {
  background: #f5f3ff !important;
  color: #7c3aed !important;
  border: 1px solid #ddd6fe;
}

span[class*="bg-rose-500/10"] {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border: 1px solid #fecdd3;
}

span[class*="rounded-full"] {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

/* ---- Action Buttons in Tables ---- */
button[class*="bg-blue-500/10"],
button[class*="bg-emerald-500/10"],
button[class*="bg-red-500/10"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

button[class*="bg-blue-500/10"] {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

button[class*="bg-blue-500/10"]:hover {
  background: #dbeafe !important;
}

button[class*="bg-red-500/10"] {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
}

button[class*="bg-red-500/10"]:hover {
  background: #fee2e2 !important;
}

button[class*="bg-emerald-500/10"] {
  background: var(--success-soft) !important;
  color: var(--success) !important;
}

/* ---- Modals ---- */
.fixed.inset-0.z-50 {
  background: rgba(15, 23, 42, 0.4) !important;
  backdrop-filter: blur(8px);
}

.fixed.inset-0.z-50 > div[class*="bg-surface-900"],
.fixed.inset-0.z-50 .bg-surface-900 {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-xl) !important;
}

.fixed.inset-0.z-50 h3 {
  color: var(--text-primary) !important;
}

.fixed.inset-0.z-50 label {
  color: var(--text-tertiary) !important;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}

/* ---- Broadcast Section Specific ---- */
.bg-\[\#15151F\] {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.bg-\[\#15151F\] .border-b.border-white\/5 {
  border-bottom-color: var(--border-subtle) !important;
}

.bg-\[\#1A1A24\] {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.bg-\[\#0A0A12\] {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* ---- Toggle Switches ---- */
button.w-11.h-6.rounded-full {
  transition: background var(--transition-base);
}

button.w-11.h-6.rounded-full span {
  box-shadow: var(--shadow-sm);
}

/* ---- Progress Bars ---- */
.h-1\.5.bg-\[\#0A0A12\] {
  background: var(--bg-secondary) !important;
  border-radius: 999px;
  overflow: hidden;
}

.h-1\.5.bg-\[\#0A0A12\] > div {
  border-radius: 999px;
}

/* ---- Dashboard Line Chart ---- */
.chartjs-box {
  position: relative;
  height: 260px;
  min-height: 220px;
}

.chartjs-box canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ---- Bottom Tab Bar (Mobile) ---- */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  min-width: 48px;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), transform 0.1s ease;
  user-select: none;
  color: var(--text-tertiary);
}

.bottom-tab:active {
  transform: scale(0.94);
}

.bottom-tab.text-rose-400 {
  color: var(--accent) !important;
}

/* ---- Animations ---- */
.animate-in {
  animation: animateIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes animateIn {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ---- Safe Area ---- */
.safe-top {
  padding-top: max(12px, env(safe-area-inset-top, 12px));
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1023px) {
  main > div.flex-1 > div {
    padding: 24px;
  }
}

@media (max-width: 767px) {
  main > div.flex-1 > div {
    padding: 16px;
  }

  .admin-header {
    padding: 0 16px !important;
    min-height: 56px;
  }

  .card-header {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card p.text-2xl {
    font-size: 24px !important;
  }

  .th {
    padding: 10px 12px;
    font-size: 10px;
  }

  .td {
    padding: 10px 12px;
    font-size: 12px;
  }

  .fixed.inset-0.z-50 .max-w-2xl,
  .fixed.inset-0.z-50 .max-w-lg {
    max-width: 100% !important;
    margin: 0 !important;
    height: 100vh;
    border-radius: 0 !important;
  }

  .page-btn,
  .icon-btn {
    padding: 10px;
    min-width: 40px;
    min-height: 40px;
  }

  .input-field {
    padding: 10px 12px;
    font-size: 16px; /* Prevent iOS zoom */
  }

  textarea.input-field {
    font-size: 16px;
  }

  body {
    overscroll-behavior: none;
  }

  .bottom-tab-bar {
    display: flex;
  }

  a, button {
    -webkit-user-select: none;
    user-select: none;
  }
}

@media (max-width: 639px) {
  .grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Readable text on light theme ---- */
.text-slate-400,
.text-slate-500 {
  color: var(--text-tertiary) !important;
}

.text-slate-600 {
  color: var(--text-muted) !important;
}

.border-slate-800\\/60,
.border-slate-800\\/30,
.border-slate-800,
.border-slate-700\\/50 {
  border-color: var(--border) !important;
}

/* Sidebar nav inactive colors */
.sidebar-base .text-slate-400,
.sidebar-base .text-slate-500 {
  color: var(--text-secondary) !important;
}

/* Sidebar nav active text must stay white */
.sidebar-base .nav-link.bg-slate-900,
.sidebar-base .nav-link[class*="bg-slate-900"],
.sidebar-base .nav-link.bg-slate-900 .text-white,
.sidebar-base .nav-link.bg-slate-900 span,
.sidebar-base .nav-link[class*="bg-slate-900"] span,
.sidebar-base .nav-link[class*="bg-slate-800"] .text-white {
  color: #ffffff !important;
}

/* Broadcast message preview */
.whitespace-pre-wrap.text-slate-300 {
  color: var(--text-secondary) !important;
}

/* ---- VIP Price Colors ---- */
.text-amber-400 {
  color: #d97706 !important;
}

.text-rose-400 {
  color: #e11d48 !important;
}

.text-emerald-400 {
  color: #059669 !important;
}

.text-blue-400 {
  color: var(--accent) !important;
}

.text-violet-400 {
  color: #7c3aed !important;
}

/* ---- Gallery hover ---- */
.group:hover .group-hover\:scale-110 {
  transform: scale(1.05);
}

.group:hover .bg-gradient-to-t p,
.group:hover .bg-gradient-to-t span,
.group:hover [class*="from-black"] p,
.group:hover [class*="from-black"] span {
  color: #ffffff !important;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* ---- Photo lightbox ---- */
.fixed.inset-0.z-50.bg-black\/90 {
  background: rgba(15, 23, 42, 0.95) !important;
}

.fixed.inset-0.z-50.bg-black\/90 p,
.fixed.inset-0.z-50.bg-black\/90 span,
.fixed.inset-0.z-50.bg-black\/90 button,
.fixed.inset-0.z-50.bg-slate-950\/90 p,
.fixed.inset-0.z-50.bg-slate-950\/90 span,
.fixed.inset-0.z-50.bg-slate-950\/90 button {
  color: #ffffff !important;
}

.fixed.inset-0.z-50.bg-black\/90 p.text-slate-400,
.fixed.inset-0.z-50.bg-black\/90 .text-slate-400,
.fixed.inset-0.z-50.bg-slate-950\/90 p.text-slate-400,
.fixed.inset-0.z-50.bg-slate-950\/90 .text-slate-400 {
  color: rgba(255, 255, 255, 0.78) !important;
}

.fixed.inset-0.z-50.bg-black\/90 img {
  border-radius: var(--radius-lg);
}

/* ---- Light modals must keep dark readable text ---- */
.fixed.inset-0.z-50 > .bg-white,
.fixed.inset-0.z-50 .bg-white {
  color: var(--text-primary) !important;
}

.fixed.inset-0.z-50 > .bg-white p,
.fixed.inset-0.z-50 > .bg-white div,
.fixed.inset-0.z-50 > .bg-white span:not([class*="bg-"]):not([class*="text-white"]),
.fixed.inset-0.z-50 > .bg-white label,
.fixed.inset-0.z-50 .bg-white p,
.fixed.inset-0.z-50 .bg-white div,
.fixed.inset-0.z-50 .bg-white span:not([class*="bg-"]):not([class*="text-white"]),
.fixed.inset-0.z-50 .bg-white label {
  color: inherit;
}

.fixed.inset-0.z-50 .bg-white .text-slate-900 {
  color: var(--text-primary) !important;
}

.fixed.inset-0.z-50 .bg-white .text-slate-700,
.fixed.inset-0.z-50 .bg-white .text-slate-600 {
  color: var(--text-secondary) !important;
}

.fixed.inset-0.z-50 .bg-white .text-slate-500,
.fixed.inset-0.z-50 .bg-white .text-slate-400,
.fixed.inset-0.z-50 .bg-white .text-slate-300 {
  color: var(--text-tertiary) !important;
}

.fixed.inset-0.z-50 .bg-white button.text-white,
.fixed.inset-0.z-50 .bg-white button[class*="text-white"] {
  color: #ffffff !important;
}
