/* Global professional theme overrides for Dr Smart */

/* Typography */
html { font-size: 16px; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Color system */
:root {
  --brand-primary: #0c66ff;
  --brand-secondary: #111827;
  --brand-accent: #22c55e;
  --brand-warning: #f59e0b;
  --brand-danger: #ef4444;
  --surface-bg: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: #e2e8f0;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px rgba(16, 24, 40, 0.08);
}

[data-theme="dark"]:root, .dark-style:root {
  --surface-bg: #0b1220;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --border-color: #1f2937;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 12px rgba(0, 0, 0, 0.35);
}

/* Base */
body {
  color: var(--text-primary);
  background-color: var(--surface-bg);
}

/* Cards */
.card {
  border-radius: var(--radius-lg) !important;
  border-color: var(--border-color) !important;
  box-shadow: var(--shadow-sm);
}

.card .card-header {
  border-bottom-color: var(--border-color) !important;
}

/* Buttons */
.btn-primary {
  background-color: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 1px 2px rgba(12, 102, 255, 0.2);
}
.btn-primary:hover { filter: brightness(0.95); }
.btn-outline-primary { color: var(--brand-primary) !important; border-color: var(--brand-primary) !important; }

/* Forms */
.form-control, .form-select {
  border-radius: var(--radius-md) !important;
  border-color: var(--border-color) !important;
}
.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 3px rgba(12, 102, 255, 0.12) !important;
  border-color: var(--brand-primary) !important;
}

/* Tables */
.table thead th { color: var(--text-secondary); font-weight: 600; background: #f1f5f9; }
.table tbody tr + tr { border-top: 1px solid var(--border-color); }
.table tbody tr:hover { background: rgba(12, 102, 255, 0.03); }
.table td, .table th { vertical-align: middle; }
.col-num { text-align: right; font-variant-numeric: tabular-nums; }
.col-date { text-align: center; }
.col-actions { text-align: center; white-space: nowrap; }
.cell-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Navbar & Sidebar */
.bg-navbar-theme { box-shadow: var(--shadow-sm); }
.layout-menu .menu-inner .menu-item > .menu-link {
  border-radius: var(--radius-md);
}
.layout-menu .menu-inner .menu-item.active > .menu-link {
  background: rgba(12, 102, 255, 0.08);
  color: var(--brand-primary);
}

/* Utilities */
.text-muted { color: var(--text-secondary) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

/* KPI Cards */
.kpi-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  box-shadow: var(--shadow-md);
}
.kpi-card .kpi-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}
.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}
.kpi-accent-primary { background: linear-gradient(180deg, rgba(12,102,255,0.04), transparent); }
.kpi-accent-success { background: linear-gradient(180deg, rgba(34,197,94,0.06), transparent); }
.kpi-accent-warning { background: linear-gradient(180deg, rgba(245,158,11,0.08), transparent); }
.kpi-accent-danger  { background: linear-gradient(180deg, rgba(239,68,68,0.08), transparent); }

[data-theme="dark"] .kpi-card {
  background: linear-gradient(180deg, #0f172a, #0b1325);
  border-color: var(--border-color);
  box-shadow: none;
}
[data-theme="dark"] .kpi-accent-primary { background: linear-gradient(180deg, rgba(12,102,255,0.16), transparent); }
[data-theme="dark"] .kpi-accent-success { background: linear-gradient(180deg, rgba(34,197,94,0.18), transparent); }
[data-theme="dark"] .kpi-accent-warning { background: linear-gradient(180deg, rgba(245,158,11,0.20), transparent); }
[data-theme="dark"] .kpi-accent-danger  { background: linear-gradient(180deg, rgba(239,68,68,0.20), transparent); }

/* Profile form */
.profile-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}
.profile-sidebar {
  border-right: 1px solid var(--border-color);
}
.avatar-uploader input[type="file"] { display: block; }
.avatar-preview {
  width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border-color);
}
.help-subtle { color: var(--text-secondary); font-size: 12px; }

/* Branding */
.app-brand-title {
  font-size: 18px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dark mode component nuances */
[data-theme="dark"] .card { box-shadow: none; }
[data-theme="dark"] .table tbody tr + tr { border-top-color: var(--border-color); }
[data-theme="dark"] .btn-primary { box-shadow: none; }
[data-theme="dark"] .layout-menu .menu-inner .menu-item.active > .menu-link {
  background: rgba(12, 102, 255, 0.16);
  color: var(--brand-primary);
}
[data-theme="dark"] .bg-navbar-theme { box-shadow: none; }

/* Tables - Dark mode */
/* Bootstrap table selectors need stronger specificity in dark */
.dark-style .table thead th,
.dark-style .table > :not(caption) > * > th,
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table > :not(caption) > * > th {
  background-color: #0f172a !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}
.dark-style .table td,
.dark-style .table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th { border-color: var(--border-color) !important; }
.dark-style .table tbody tr:hover,
[data-theme="dark"] .table tbody tr:hover { background: rgba(12, 102, 255, 0.10) !important; }


