/* Global UI theme for Finance Dashboard */

:root {
  --fd-bg: #0b1220;
  --fd-surface: rgba(255, 255, 255, 0.06);
  --fd-surface-2: rgba(255, 255, 255, 0.08);
  --fd-border: rgba(255, 255, 255, 0.10);
  --fd-text: rgba(255, 255, 255, 0.92);
  --fd-muted: rgba(255, 255, 255, 0.68);
  --fd-accent: #7c3aed; /* violet */
  --fd-accent-2: #06b6d4; /* cyan */
  --fd-danger: #ef4444;
  --fd-success: #22c55e;
}

html[data-theme="light"] {
  --fd-bg: #f6f7fb;
  --fd-surface: rgba(2, 6, 23, 0.04);
  --fd-surface-2: rgba(2, 6, 23, 0.06);
  --fd-border: rgba(2, 6, 23, 0.10);
  --fd-text: rgba(2, 6, 23, 0.92);
  --fd-muted: rgba(2, 6, 23, 0.62);
}

body {
  background: radial-gradient(1200px 700px at 20% 0%, rgba(124, 58, 237, 0.18), transparent 60%),
    radial-gradient(1200px 700px at 90% 20%, rgba(6, 182, 212, 0.16), transparent 55%),
    var(--fd-bg);
  color: var(--fd-text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

.fd-shell {
  min-height: 100vh;
}

.fd-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.78), rgba(11, 18, 32, 0.55));
  border-bottom: 1px solid var(--fd-border);
}

html[data-theme="light"] .fd-topbar {
  background: linear-gradient(180deg, rgba(246, 247, 251, 0.92), rgba(246, 247, 251, 0.78));
}

.fd-brand {
  letter-spacing: 0.2px;
}

.fd-card {
  background: linear-gradient(180deg, var(--fd-surface), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--fd-border);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.20);
}

html[data-theme="light"] .fd-card {
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.08);
}

.fd-card-header {
  border-bottom: 1px solid var(--fd-border);
  background: transparent;
}

.fd-muted {
  color: var(--fd-muted) !important;
}

.fd-pill {
  border: 1px solid var(--fd-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fd-text);
  border-radius: 999px;
}

html[data-theme="light"] .fd-pill {
  background: rgba(2, 6, 23, 0.04);
}

.fd-sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}

.fd-nav a {
  color: var(--fd-muted);
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fd-nav a:hover {
  color: var(--fd-text);
  background: var(--fd-surface-2);
}

.fd-nav a.active {
  color: var(--fd-text);
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.22), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(124, 58, 237, 0.20);
}

.fd-page-title {
  font-size: 1.35rem;
  letter-spacing: 0.2px;
}

.btn-fd-primary {
  background: linear-gradient(135deg, var(--fd-accent), var(--fd-accent-2));
  border: none;
  color: white;
}

.btn-fd-primary:hover {
  filter: brightness(1.05);
  color: white;
}

.btn-fd-outline {
  border: 1px solid var(--fd-border);
  color: var(--fd-text);
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .btn-fd-outline {
  background: rgba(2, 6, 23, 0.03);
}

.btn-fd-outline:hover {
  background: var(--fd-surface-2);
  color: var(--fd-text);
}

.table.fd-table {
  color: var(--fd-text);
  background-color: transparent;
}

.table.fd-table thead {
  background-color: rgba(15, 23, 42, 0.7);
}

.table.fd-table thead th {
  color: var(--fd-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--fd-border);
}

.table.fd-table tbody tr {
  background-color: transparent;
}

.table.fd-table tbody tr:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.65);
}

.table.fd-table tbody tr:nth-child(odd) {
  background-color: rgba(15, 23, 42, 0.55);
}

.table.fd-table tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.35);
}

.table.fd-table td,
.table.fd-table th {
  border-color: var(--fd-border);
}

/* Ensure Bootstrap table variables don't force white backgrounds in dark theme */
html[data-theme="dark"] .table {
  --bs-table-color: var(--fd-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--fd-border);
  --bs-table-striped-bg: rgba(15, 23, 42, 0.55);
  --bs-table-striped-color: var(--fd-text);
  --bs-table-active-bg: rgba(37, 99, 235, 0.22);
  --bs-table-active-color: var(--fd-text);
  --bs-table-hover-bg: rgba(37, 99, 235, 0.35);
  --bs-table-hover-color: var(--fd-text);
}

html[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--bs-table-bg);
  color: var(--bs-table-color);
}

html[data-theme="light"] .table.fd-table thead {
  background-color: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .table.fd-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.96);
}

html[data-theme="light"] .table.fd-table tbody tr:nth-child(odd) {
  background-color: rgba(248, 250, 252, 0.96);
}

html[data-theme="light"] .table.fd-table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.08);
}

.fd-empty {
  border: 1px dashed var(--fd-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.form-control, .form-select, .input-group-text {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--fd-border);
  color: var(--fd-text);
}

/* Native select dropdown (options list) */
html[data-theme="dark"] select,
html[data-theme="dark"] .form-select {
  color-scheme: dark;
}

html[data-theme="dark"] select option,
html[data-theme="dark"] select optgroup {
  background-color: #0b1220;
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] select,
html[data-theme="light"] .form-select {
  color-scheme: light;
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] .input-group-text {
  background-color: rgba(2, 6, 23, 0.03);
}

.form-control:focus, .form-select:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 0.25rem rgba(124, 58, 237, 0.18);
}

/* Bootstrap dropdown menus (if used anywhere) */
.dropdown-menu {
  border: 1px solid var(--fd-border);
  background: rgba(11, 18, 32, 0.95);
  backdrop-filter: blur(10px);
}

html[data-theme="light"] .dropdown-menu {
  background: rgba(246, 247, 251, 0.98);
}

.dropdown-item {
  color: var(--fd-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--fd-text);
  background: var(--fd-surface-2);
}

.dropdown-item.active,
.dropdown-item:active {
  color: white;
  background: linear-gradient(135deg, var(--fd-accent), var(--fd-accent-2));
}

.alert {
  border: 1px solid var(--fd-border);
  backdrop-filter: blur(10px);
}

.fd-footer {
  color: var(--fd-muted);
  border-top: 1px solid var(--fd-border);
}

