/* ================================================================
   PSYCHOCODE — Cabinet Premium Override
   Applied AFTER cabinet.css. Glassmorphism sidebar + cards upgrade.
   ================================================================ */

:root {
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --glass-bg: rgba(8, 10, 28, 0.55);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-blur: blur(24px) saturate(180%);
}

/* Grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23grain)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* Ambient background gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 10% 20%, rgba(123, 47, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(0, 240, 255, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 0, 229, 0.03) 0%, transparent 60%);
}

/* ─── HEADER UPGRADE ─────────────────────────────────────────── */
.cab-header {
  background: rgba(3, 4, 15, 0.8) !important;
  backdrop-filter: blur(32px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(32px) saturate(200%) !important;
  border-bottom: 1px solid rgba(123, 47, 255, 0.15) !important;
  box-shadow: 0 1px 40px rgba(0, 0, 0, 0.3) !important;
}

/* ─── SIDEBAR UPGRADE ────────────────────────────────────────── */
.cab-sidebar {
  background: rgba(5, 7, 20, 0.6) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border-right: 1px solid rgba(123, 47, 255, 0.1) !important;
  padding: 28px 16px !important;
}

.cab-nav-item {
  border-radius: 12px !important;
  transition: all 0.25s var(--spring) !important;
  position: relative !important;
  overflow: hidden !important;
}
.cab-nav-item:hover {
  background: rgba(123, 47, 255, 0.1) !important;
  color: #fff !important;
  transform: translateX(4px) !important;
}
.cab-nav-item.active {
  background: linear-gradient(135deg, rgba(123, 47, 255, 0.2), rgba(0, 240, 255, 0.08)) !important;
  border: 1px solid rgba(123, 47, 255, 0.25) !important;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(123, 47, 255, 0.15) !important;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.cab-btn-primary {
  background: linear-gradient(135deg, #7B2FFF, #5B1FCC) !important;
  box-shadow: 0 4px 20px rgba(123, 47, 255, 0.4) !important;
  transition: all 0.25s var(--spring) !important;
  border-radius: 12px !important;
}
.cab-btn-primary:hover {
  transform: translateY(-3px) scale(1.03) !important;
  box-shadow: 0 10px 32px rgba(123, 47, 255, 0.6) !important;
}
.cab-btn-ghost {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(123, 47, 255, 0.25) !important;
  transition: all 0.2s var(--spring) !important;
  border-radius: 10px !important;
}
.cab-btn-ghost:hover {
  border-color: rgba(123, 47, 255, 0.5) !important;
  background: rgba(123, 47, 255, 0.1) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}
.cab-btn-sm {
  background: rgba(123, 47, 255, 0.12) !important;
  border: 1px solid rgba(123, 47, 255, 0.25) !important;
  transition: all 0.2s var(--spring) !important;
  border-radius: 8px !important;
}
.cab-btn-sm:hover {
  background: rgba(123, 47, 255, 0.25) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 16px rgba(123, 47, 255, 0.3) !important;
}

/* ─── SECTION HEADERS ────────────────────────────────────────── */
.sec-title {
  font-size: clamp(24px, 3vw, 36px) !important;
  font-weight: 800 !important;
  letter-spacing: -0.8px !important;
  color: #ffffff !important;
  background: none !important;
  -webkit-text-fill-color: unset !important;
}

/* ─── FORM INPUTS ────────────────────────────────────────────── */
.cab-content input[type="text"],
.cab-content input[type="email"],
.cab-content input[type="password"],
.cab-content textarea,
.cab-content select {
  background: rgba(8, 10, 28, 0.6) !important;
  border: 1px solid rgba(123, 47, 255, 0.2) !important;
  border-radius: 12px !important;
  color: #E0E0F0 !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  backdrop-filter: blur(8px) !important;
}
.cab-content input:focus,
.cab-content textarea:focus,
.cab-content select:focus {
  outline: none !important;
  border-color: rgba(123, 47, 255, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(123, 47, 255, 0.1) !important;
}

/* ─── TABLES ─────────────────────────────────────────────────── */
.cab-content th {
  background: rgba(123, 47, 255, 0.08) !important;
  border-bottom: 1px solid rgba(123, 47, 255, 0.15) !important;
  padding: 14px 16px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
}
.cab-content td {
  padding: 14px 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  transition: background 0.15s !important;
}
.cab-content tr:hover td { background: rgba(123, 47, 255, 0.04) !important; }

/* ─── MOBILE DRAWER ──────────────────────────────────────────── */
.mob-drawer {
  background: rgba(5, 7, 20, 0.97) !important;
  backdrop-filter: blur(40px) !important;
  -webkit-backdrop-filter: blur(40px) !important;
  border-right: 1px solid rgba(123, 47, 255, 0.15) !important;
}
.mob-overlay {
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(4px) !important;
}

/* ─── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #03040f; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #7B2FFF, #00F0FF); border-radius: 3px; }

/* ─── SECTION ENTRY — spring bounce ─────────────────────────── */
.cab-section.active {
  animation: sectionIn 0.45s var(--spring) !important;
}

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ─── STAT CARDS — glow pulse ────────────────────────────────── */
.stat-card {
  background: rgba(10, 14, 39, 0.7) !important;
  border: 1px solid rgba(123, 47, 255, 0.15) !important;
  border-radius: 18px !important;
  padding: 24px !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--spring), box-shadow 0.3s !important;
}

.stat-card:hover {
  transform: translateY(-4px) scale(1.02) !important;
  box-shadow: 0 12px 40px rgba(123, 47, 255, 0.2) !important;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(123, 47, 255, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.stat-value {
  animation: statPulse 3s ease-in-out infinite !important;
}

@keyframes statPulse {
  0%, 100% { text-shadow: 0 0 20px rgba(0, 240, 255, 0.3); }
  50%       { text-shadow: 0 0 40px rgba(0, 240, 255, 0.6), 0 0 80px rgba(0, 240, 255, 0.15); }
}

/* ─── CARD BLOCKS — premium glass ───────────────────────────── */
.card-block {
  background: rgba(8, 10, 28, 0.55) !important;
  border: 1px solid rgba(123, 47, 255, 0.12) !important;
  border-radius: 20px !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.2) !important;
  transition: border-color 0.3s, box-shadow 0.3s !important;
}

.card-block:hover {
  border-color: rgba(123, 47, 255, 0.2) !important;
}

/* ─── BLOCK TITLE — accent gradient ──────────────────────────── */
.block-title {
  color: #B8B5FF !important;
  background: none !important;
  -webkit-text-fill-color: unset !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: -0.2px !important;
}

/* ─── NAV ICON WRAPPER ───────────────────────────────────────── */
.nav-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  background: rgba(123, 47, 255, 0.08) !important;
  flex-shrink: 0 !important;
  transition: background 0.25s var(--spring), box-shadow 0.25s !important;
}

.cab-nav-item:hover .nav-icon {
  background: rgba(123, 47, 255, 0.18) !important;
}

.cab-nav-item.active .nav-icon {
  background: linear-gradient(135deg, rgba(123, 47, 255, 0.3), rgba(0, 240, 255, 0.15)) !important;
  box-shadow: 0 2px 12px rgba(123, 47, 255, 0.25) !important;
}

.cab-nav-item.admin-only .nav-icon {
  background: rgba(123, 47, 255, 0.08) !important;
}

.cab-nav-item.admin-only:hover .nav-icon,
.cab-nav-item.admin-only.active .nav-icon {
  background: linear-gradient(135deg, rgba(123, 47, 255, 0.28), rgba(0, 240, 255, 0.12)) !important;
  box-shadow: 0 2px 10px rgba(123, 47, 255, 0.2) !important;
}

/* ─── PROFILE CARDS ─────────────────────────────────────────── */
.profile-card {
  transition: transform 0.3s var(--spring), border-color 0.25s, box-shadow 0.3s !important;
}

.profile-card:hover {
  transform: translateY(-4px) scale(1.01) !important;
  border-color: rgba(123, 47, 255, 0.4) !important;
  box-shadow: 0 8px 32px rgba(123, 47, 255, 0.15) !important;
}

/* ─── MODAL UPGRADE ─────────────────────────────────────────── */
.modal-overlay {
  backdrop-filter: blur(12px) saturate(150%) !important;
}

.modal-card {
  animation: modalSpring 0.45s var(--spring) !important;
}

@keyframes modalSpring {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── REPORT ROW ────────────────────────────────────────────── */
.report-row {
  transition: transform 0.25s var(--spring), border-color 0.2s, background 0.2s !important;
}

.report-row:hover {
  transform: translateX(4px) !important;
  border-color: rgba(123, 47, 255, 0.3) !important;
}

/* ─── ADMIN NAV BLOCK ────────────────────────────────────────── */
.admin-nav-divider {
  margin-top: 16px !important;
  padding: 8px 12px !important;
  background: rgba(7, 10, 28, 0.55) !important;
  border: 1px solid rgba(123, 47, 255, 0.15) !important;
  border-bottom: none !important;
  border-radius: 12px 12px 0 0 !important;
  overflow: visible !important;
}

.admin-nav-divider::before { display: none !important; }

.cab-nav-item.admin-only {
  border-left: 1px solid rgba(123, 47, 255, 0.12) !important;
  border-right: 1px solid rgba(123, 47, 255, 0.12) !important;
  border-top: none !important;
  border-bottom: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  background: rgba(5, 7, 20, 0.25) !important;
}

.cab-nav-item.admin-only:hover {
  background: rgba(123, 47, 255, 0.1) !important;
  transform: none !important;
}

.cab-nav-item.admin-only.active {
  background: linear-gradient(135deg, rgba(123, 47, 255, 0.18), rgba(0, 240, 255, 0.06)) !important;
  border: none !important;
  border-left: 1px solid rgba(123, 47, 255, 0.12) !important;
  border-right: 1px solid rgba(123, 47, 255, 0.12) !important;
  box-shadow: inset 3px 0 0 rgba(123, 47, 255, 0.5) !important;
}

#nav-admin-segments {
  border-bottom: 1px solid rgba(123, 47, 255, 0.12) !important;
  border-radius: 0 0 12px 12px !important;
  margin-bottom: 4px !important;
}

/* ─── SIDEBAR SCROLLBAR ─────────────────────────────────────── */
.cab-sidebar::-webkit-scrollbar { width: 3px; }
.cab-sidebar::-webkit-scrollbar-track { background: transparent; }
.cab-sidebar::-webkit-scrollbar-thumb { background: rgba(123, 47, 255, 0.3); border-radius: 2px; }

/* ─── REDUCED MOTION ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
