@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Sans:wght@300;400;500;600;700&display=swap");

/* ── Google Fonts ─────────────────────────────────────────── */
/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg-primary: #020b18;
  --bg-secondary: #070f1b;
  --bg-card: #0b111c;
  --bg-hover: #172134;
  --text-primary: #f0ede8;
  --text-secondary: rgba(240, 237, 232, 0.65);
  --text-muted: rgba(240, 237, 232, 0.35);
  --gold: #c9a84cef;
  --gold-light: #a49163;
  --gold-dark: #9a7a2e;
  --gold-glow: rgba(162, 135, 58, 0.15);
  --red: #e05252;
  --green: #3db88a;
  --blue: #4f8ef7;
  --purple: #9f7aea;
  --border: rgba(201, 168, 76, 0.08);
  --border-light: rgba(201, 168, 76, 0.16);
  --border-hover: rgba(201, 168, 76, 0.28);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 4px 20px rgba(201, 168, 76, 0.2);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 220ms var(--ease);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --sidebar-w: 252px;
  --topbar-h: 64px;
}
[data-theme="light"] {
  --bg-primary: #f6f0f0dd;
  --bg-secondary: #c2b2989e;
  --bg-card: #ffffff;
  --bg-hover: #b0b0b0;
  --text-primary: #7a562a;
  --text-secondary: rgba(69, 55, 2, 0.874);
  --text-muted: rgba(27, 15, 2, 0.38);
  --border: rgba(31, 26, 14, 0.742);
  --border-light: rgba(160, 120, 40, 0.858);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.468);
}
/* ── Reset ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition:
    background var(--transition),
    color var(--transition);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: var(--font-body);
  cursor: pointer;
}
input,
textarea {
  font-family: var(--font-body);
}
/* ── Reading Progress ───────────────────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--gold-dark),
    var(--gold),
    var(--gold-light)
  );
  z-index: 1000;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--gold);
}
/* ── Skip Link ──────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 9999;
  padding: 10px 20px;
  background: var(--gold);
  color: var(--bg-primary);
  font-weight: 600;
  border-radius: var(--radius);
}
.skip-link:focus {
  left: 12px;
}
/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}
/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.animate-fade-up {
  animation: fadeUp 0.4s var(--ease) both;
}
.animate-fade-in {
  animation: fadeIn 0.3s var(--ease) both;
}
.animate-slide-right {
  animation: slideInRight 0.35s var(--ease) both;
}
/* ── Mobile Sidebar Drawer ──────────────────────────────────── */
/* Overlay that dims the page when drawer is open */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 149;
  animation: fadeIn 0.2s var(--ease);
}
.sidebar-overlay.open {
  display: block;
}
/* The sidebar itself — slides in from left on mobile */
.sidebar-drawer {
  transition: transform 0.3s var(--ease);
}
/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar-drawer,
  .topbar,
  .chat-widget,
  .a11y-toolbar,
  .reading-progress,
  .toast-container,
  .sidebar-overlay,
  .mobile-menu-btn {
    display: none !important;
  }
  .dash-main {
    max-width: 100% !important;
    padding: 0 !important;
  }
  body {
    background: white;
    color: black;
  }
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.modal-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: 12px;
  width: 420px;
  max-width: 90%;
  border: 1px solid var(--border);
}
.modal-card h2 {
  margin-bottom: 16px;
}
/* ── Responsive Breakpoints ─────────────────────────────────── */
/* Large desktop — shrink sidebar slightly */
@media (max-width: 1200px) {
  :root {
    --sidebar-w: 220px;
  }
}
/* Tablet — sidebar becomes a slide-in drawer */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 260px; /* keep a good drawer width */
    --topbar-h: 60px;
  }

  /* Sidebar is off-screen by default, slides in when .open */
  .sidebar-drawer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    z-index: 150 !important;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-drawer.open {
    transform: translateX(0);
    animation: slideInLeft 0.3s var(--ease);
  }

  /* Main content takes full width */
  .dash-main {
    padding: 20px 16px !important;
  }
}
/* Mobile — tighter spacing and font scaling */
@media (max-width: 600px) {
  :root {
    --topbar-h: 56px;
  }

  body {
    font-size: 14px;
  }

  .dash-main {
    padding: 16px 12px !important;
  }

  /* Stats grid: 2 columns on mobile */
  .stats-grid-4 {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Cards take full width */
  .grid-2-1,
  .grid-2 {
    grid-template-columns: 1fr !important;
  }

  /* Messages layout stacks vertically */
  .messages-grid {
    grid-template-columns: 1fr !important;
  }

  /* Solicitors cards single column */
  .solicitors-grid {
    grid-template-columns: 1fr !important;
  }

  /* Resource cards 2 columns */
  .resources-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Tables scroll horizontally instead of breaking */
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Auth cards — full width with less padding */
  .auth-card {
    padding: 28px 20px !important;
    border-radius: var(--radius-lg) !important;
  }

  /* Chat widget closer to edge 
  .chat-widget {
    bottom: 12px !important;
    right: 12px !important;
  }

  /* A11y toolbar closer to edge */
  .a11y-toolbar {
    bottom: 12px !important;
    left: 12px !important;
  }

  /* Topbar brand text hidden on very small screens */
  .topbar-brand-text {
    display: none;
  }

  /* Search bar hidden on mobile — accessible via search icon instead */
  .topbar-search {
    display: none;
  }
}
/* Extra small — phones under 400px */
@media (max-width: 400px) {
  :root {
    --topbar-h: 52px;
  }

  .dash-main {
    padding: 12px 10px !important;
  }

  .stats-grid-4 {
    grid-template-columns: 1fr !important;
  }
}
/* Hidden on desktop by default */
.sidebar-mobile-header {
  display: none !important;
}
/* Shown only on tablet/mobile, matching the hamburger breakpoint */
@media (max-width: 900px) {
  .sidebar-mobile-header {
    display: flex !important;
  }
}
.mobile-menu-btn {
  display: none !important;
}
.mobile-search-btn {
  display: none !important;
}
@media (max-width: 900px) {
  /* Show hamburger on tablet and mobile */
  .mobile-menu-btn {
    display: flex !important;
  }
  /* Show mobile search icon */
  .mobile-search-btn {
    display: flex !important;
  }
  /* Hide desktop search bar */
  .topbar-search {
    display: none !important;
  }
}
@media (max-width: 600px) {
  /* Hide brand text on small phones — logo only */
  .topbar-brand-text {
    display: none !important;
  }
}
/* ── Tab content responsive helpers ─────────────────────────── */
/* Used by tab components via inline style overrides */
@media (max-width: 900px) {
  /* Two-column grids collapse to single column */
  [style*="gridTemplateColumns: 2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="gridTemplateColumns: 280px 1fr"],
  [style*="grid-template-columns: 280px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 600px) {
  /* Four-column stat grids → 2 columns */
  [style*="repeat(4,1fr)"],
  [style*="repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* Solicitor cards → single column */
  [style*="minmax(300px, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* Resource cards → 2 columns */
  [style*="minmax(220px, 1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }
  /* Tables get horizontal scroll wrapper */
  table {
    min-width: 480px;
  }
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
/* Admin mobile menu button — hidden on desktop */
.admin-menu-btn {
  display: none;
}
/* Responsive: sidebar becomes a fixed drawer on mobile */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex !important;
  }
  .topbar-search {
    display: none !important;
  }
  .mobile-search-btn {
    display: flex !important;
  }
  .topbar-brand-text {
    display: none;
  }

  /* Sidebar becomes a full-screen drawer */
  .sidebar-drawer {
    position: fixed !important;
    top: var(--topbar-h) !important;
    left: 0 !important;
    height: calc(100vh - var(--topbar-h)) !important;
    z-index: 100;
    transform: translateX(-100%);
    transition:
      transform 0.3s var(--ease),
      box-shadow 0.3s var(--ease);
    box-shadow: none;
    overflow-y: auto;
  }
  .sidebar-drawer.open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.5);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
  }
  .sidebar-overlay.open {
    display: block;
  }

  /* Admin mobile menu */
  .admin-menu-btn {
    display: flex !important;
  }

  /* Stack message layout on mobile */
  .messages-grid {
    grid-template-columns: 1fr !important;
  }
}
/* Responsive grid helpers */
@media (max-width: 600px) {
  /* Stats grid single column */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Tables: allow horizontal scroll */
  table {
    min-width: 480px;
  }
}
/* AdminPortal.css */
select {
  background-color: var(--bg-dark, #050b15);
  color: var(--text-light, #f0ede8);
  border: none;
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
}
option {
  background-color: var(--bg-dark, #0c1a30);
  color: var(--text-light, #f0ede8);
  padding: 8px;
  border-radius: 2em;
  border: none;
  outline: none;
}
option:checked {
  background: #060931cf;
  color: #2f405b;
  border: none;
  outline: none;
  offset: none;
}
