/*
  WhatMsg – Professional theme overrides
  - Unified, modern palette and component refinements
  - Loaded after base styles to safely override defaults
*/

:root {
  /* Brand */
  --brand-primary-700: #4338ca;
  --brand-primary-600: #4f46e5;
  --brand-primary-500: #6366f1;
  --brand-primary-400: #818cf8;

  /* Neutrals (Dark surface) */
  --surface-900: #0b1220;
  --surface-850: #0e1526;
  --surface-800: #111827;
  --surface-700: #1f2937;
  --surface-600: #273449;
  --surface-500: #334155;
  --surface-400: #475569;
  --surface-300: #64748b;
  --surface-200: #94a3b8;
  --surface-100: #cbd5e1;

  /* Text */
  --text-strong: #e5e7eb;
  --text: #d1d5db;
  --text-muted: #a1a1aa;
  --text-inverse: #0b1220;

  /* Feedback */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Effects */
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-lg: 0 20px 40px -20px rgba(0,0,0,.45);
  --shadow-md: 0 10px 24px -12px rgba(0,0,0,.4);
  --shadow-sm: 0 6px 14px -8px rgba(0,0,0,.35);
}

/* Typography & base */
body {
  font-family: "Inter", "Open Sans", Roboto, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-900) 0%, var(--surface-850) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.2px;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-strong);
}

.text-primary {
  color: var(--brand-primary-400) !important;
}

/* Layout containers */
.container, .container-fluid {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Navbar */
.navbar.bg-secondary.navbar-dark {
  background: linear-gradient(90deg, var(--surface-800), var(--surface-700)) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow-sm);
}

.navbar .nav-link,
.navbar .navbar-brand,
.navbar .dropdown-item,
.navbar .navbar-text {
  color: var(--text) !important;
}

.navbar .nav-link:hover,
.navbar .dropdown-item:hover {
  color: var(--text-strong) !important;
}

.dropdown-menu {
  background: var(--surface-800);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.dropdown-item {
  color: var(--text);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(99,102,241,0.12);
  color: var(--text-strong);
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--surface-800), var(--surface-900));
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar .navbar {
  background: transparent !important;
}

.sidebar .nav-link {
  color: var(--text);
  border-radius: var(--radius-sm);
  margin: 2px 8px;
  padding: 10px 12px;
  transition: background .2s ease, color .2s ease, transform .06s ease;
}

.sidebar .nav-link:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-strong);
}

.sidebar .nav-link.active,
.sidebar .nav-link:active {
  background: linear-gradient(90deg, rgba(79,70,229,0.22), rgba(79,70,229,0.12));
  color: #fff;
  border: 1px solid rgba(129,140,248,0.25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

/* Cards & blocks */
.card, .bg-secondary:not(.navbar) {
  background: linear-gradient(180deg, var(--surface-800), var(--surface-850)) !important;
  border: 1px solid rgba(255,255,255,0.06) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.card-title { color: var(--text-strong); }
.card-subtitle { color: var(--text-muted); }

/* Buttons */
.btn-primary {
  background: linear-gradient(180deg, var(--brand-primary-500), var(--brand-primary-600));
  border: 1px solid rgba(99,102,241,0.45);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px -10px rgba(99,102,241,.65);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(180deg, var(--brand-primary-600), var(--brand-primary-700));
  border-color: rgba(99,102,241,0.6);
}

.btn-outline-primary {
  color: var(--brand-primary-400);
  border-color: rgba(99,102,241,0.45);
}

.btn-outline-primary:hover {
  background: rgba(99,102,241,0.12);
  color: #fff;
}

.btn,
.form-control,
.form-select,
.input-group-text {
  border-radius: 12px;
}

/* Forms */
.form-control,
.form-select {
  background: var(--surface-850);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  background: var(--surface-850);
  color: var(--text-strong);
  border-color: rgba(129,140,248,0.45);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}

/* Tables */
.table {
  color: var(--text);
}

.table > :not(caption) > * > * {
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: rgba(255,255,255,0.02);
}

.table-hover > tbody > tr:hover > * {
  background: rgba(99,102,241,0.08);
}

/* Badges & pills */
.badge {
  border-radius: 999px;
  padding: 0.4rem 0.6rem;
}

.badge.bg-primary { background: var(--brand-primary-600) !important; }
.badge.bg-success { background: var(--success) !important; }
.badge.bg-warning { background: var(--warning) !important; color: #111; }
.badge.bg-danger { background: var(--danger) !important; }

/* Utilities */
.elevate-sm { box-shadow: var(--shadow-sm) !important; }
.elevate-md { box-shadow: var(--shadow-md) !important; }
.elevate-lg { box-shadow: var(--shadow-lg) !important; }

.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }

/* Links */
a { color: var(--brand-primary-400); text-decoration: none; }
a:hover { color: var(--brand-primary-500); text-decoration: underline; }

/* Inputs with icons alignment fix */
.input-group .form-control, .input-group .form-select { background-clip: padding-box; }

/* Small refinements */
hr { border-color: rgba(255,255,255,0.06); }
code, pre { color: #93c5fd; }

/* Light theme overrides */
:root[data-theme="light"] {
  --surface-900: #f6f8fc;
  --surface-850: #ffffff;
  --surface-800: #ffffff;
  --surface-700: #f8fafc;
  --surface-600: #eef2f7;
  --surface-500: #e7ecf3;
  --surface-400: #cbd5e1;
  --surface-300: #94a3b8;
  --surface-200: #64748b;
  --surface-100: #475569;

  --text-strong: #0b1220;
  --text: #111827;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;
}

:root[data-theme="light"] body {
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-900) 0%, var(--surface-850) 100%);
}

:root[data-theme="light"] .navbar.bg-secondary.navbar-dark {
  background: linear-gradient(90deg, #ffffff, #f8fafc) !important;
  border-bottom: 1px solid rgba(2, 6, 23, 0.08);
}

:root[data-theme="light"] .navbar .nav-link,
:root[data-theme="light"] .navbar .navbar-brand,
:root[data-theme="light"] .navbar .dropdown-item,
:root[data-theme="light"] .navbar .navbar-text {
  color: var(--text) !important;
}

:root[data-theme="light"] .dropdown-menu {
  background: #ffffff;
  border: 1px solid rgba(2, 6, 23, 0.08);
}

:root[data-theme="light"] .dropdown-item:hover,
:root[data-theme="light"] .dropdown-item:focus {
  background: rgba(99, 102, 241, 0.08);
}

:root[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff, #f6f8fc);
  border-right: 1px solid rgba(2, 6, 23, 0.08);
}

/* Sidebar links (light mode) */
:root[data-theme="light"] .sidebar .nav-link:hover {
  background: rgba(2, 6, 23, 0.04);
}

:root[data-theme="light"] .sidebar .nav-link.active,
:root[data-theme="light"] .sidebar .nav-link:active {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.12), rgba(79, 70, 229, 0.08));
  color: var(--text-strong);
  border: 1px solid rgba(79, 70, 229, 0.25);
  box-shadow: inset 0 0 0 1px rgba(2, 6, 23, 0.03);
}

/* Match specificity of base rules to override dark backgrounds from style.css in light mode */
:root[data-theme="light"] .sidebar .navbar .navbar-nav .nav-link:hover,
:root[data-theme="light"] .sidebar .navbar .navbar-nav .nav-link.active {
  color: var(--text-strong);
  background: #eef2f7; /* soft light surface instead of black */
  border-color: rgba(79, 70, 229, 0.4);
}

:root[data-theme="light"] .sidebar .navbar .navbar-nav .nav-link i {
  background: #f3f6fb;
}

:root[data-theme="light"] .sidebar .navbar .navbar-nav .nav-link:hover i,
:root[data-theme="light"] .sidebar .navbar .navbar-nav .nav-link.active i {
  background: #e2e8f0;
}

:root[data-theme="light"] .card, 
:root[data-theme="light"] .bg-secondary:not(.navbar) {
  background: linear-gradient(180deg, #ffffff, #f8fafc) !important;
  border: 1px solid rgba(2, 6, 23, 0.08) !important;
}

:root[data-theme="light"] .card-header {
  border-bottom: 1px solid rgba(2, 6, 23, 0.08);
}

:root[data-theme="light"] .form-control,
:root[data-theme="light"] .form-select {
  background: #ffffff;
  border: 1px solid rgba(2, 6, 23, 0.12);
  color: var(--text);
}

:root[data-theme="light"] .form-control:focus,
:root[data-theme="light"] .form-select:focus {
  background: #ffffff;
  color: var(--text-strong);
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

:root[data-theme="light"] .table > :not(caption) > * > * {
  border-bottom: 1px solid rgba(2, 6, 23, 0.06);
}

:root[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background: rgba(2, 6, 23, 0.02);
}

:root[data-theme="light"] hr { border-color: rgba(2, 6, 23, 0.08); }
:root[data-theme="light"] code, 
:root[data-theme="light"] pre { color: #374151; }

