/* Antigravity theme -- light, airy, Google-style: soft cool background, white rounded cards,
   pill buttons, blue->violet gradient accent, Inter type. Loaded after base.html's inline
   styles so it overrides them; works in both data-bs-theme="light" and "dark". */

:root {
  --ag-blue: #4285f4;
  --ag-indigo: #5b6cf0;
  --ag-violet: #8a5cf6;
  --ag-gradient: linear-gradient(135deg, #4285f4 0%, #6a6df2 55%, #8a5cf6 100%);
  --ag-radius: 16px;
  --ag-radius-sm: 10px;
  --primary: #1f2430;
  --accent: #4285f4;
  --bs-font-sans-serif: 'Inter', 'Google Sans', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --bs-border-radius: 10px;
  --bs-border-radius-lg: 16px;
  --bs-link-color: #3b6fe0;
  --bs-link-hover-color: #2a54b8;
}

[data-bs-theme="light"] {
  --ag-bg: #f5f7fb;
  --ag-surface: #ffffff;
  --ag-surface-2: #f0f3fa;
  --ag-border: #e6e9f2;
  --ag-text: #1f2430;
  --ag-muted: #6b7385;
  --ag-tint: rgba(66, 133, 244, 0.10);
  --ag-shadow: 0 1px 2px rgba(31, 36, 48, 0.04), 0 8px 24px -12px rgba(31, 36, 48, 0.12);
  --bs-body-bg: var(--ag-bg);
  --bs-body-color: var(--ag-text);
  --bs-border-color: var(--ag-border);
  --bs-secondary-color: var(--ag-muted);
}
[data-bs-theme="dark"] {
  --ag-bg: #0a0c12;
  --ag-surface: #12151d;
  --ag-surface-2: #181c26;
  --ag-border: #232836;
  --ag-text: #e8eaf2;
  --ag-muted: #8d95a8;
  --ag-tint: rgba(106, 140, 255, 0.14);
  --ag-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  --bs-body-bg: var(--ag-bg);
  --bs-body-color: var(--ag-text);
  --bs-border-color: var(--ag-border);
  --bs-secondary-color: var(--ag-muted);
  --bs-link-color: #8fb0ff;
  --bs-link-hover-color: #b6ccff;
}

body { background: var(--ag-bg); color: var(--ag-text); font-family: var(--bs-font-sans-serif); letter-spacing: -0.005em; }
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.02em; }

/* ---- Sidebar: light surface, tinted pill for the active item ---- */
#sidebar { background: var(--ag-surface); border-right: 1px solid var(--ag-border); }
#sidebar .sidebar-brand { border-bottom: 1px solid var(--ag-border); }
#sidebar .sidebar-brand img { box-shadow: none; background: transparent; padding: 3px 6px; }
[data-bs-theme="dark"] #sidebar .sidebar-brand img { background: #fff; border-radius: 10px; }
#sidebar .nav-section-title { color: var(--ag-muted); opacity: .85; padding-top: 1.25rem; }
#sidebar .nav-link { color: var(--ag-muted); border-radius: 999px; margin: 2px 10px; padding: 0.55rem 1rem; font-weight: 500; }
#sidebar .nav-link:hover { color: var(--ag-text); background: var(--ag-surface-2); }
#sidebar .nav-link.active { color: #2f5fd0; background: var(--ag-tint); font-weight: 600; }
[data-bs-theme="dark"] #sidebar .nav-link.active { color: #a9c1ff; }
#sidebar .nav-link.active i { color: var(--ag-blue); }
#sidebar .badge { border-radius: 999px; }

/* ---- Top bar ---- */
[data-bs-theme="light"] #top-navbar { background: rgba(245, 247, 251, 0.82); border-bottom: 1px solid var(--ag-border); }
[data-bs-theme="dark"] #top-navbar { background: rgba(10, 12, 18, 0.82); border-bottom: 1px solid var(--ag-border); }

/* ---- Page header ---- */
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-header h1 i { background: var(--ag-gradient); -webkit-background-clip: text; background-clip: text; color: transparent !important; }

/* ---- Cards ---- */
.card, .stat-card {
  background: var(--ag-surface); border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius); box-shadow: var(--ag-shadow);
}
.card-header { background: transparent; border-bottom: 1px solid var(--ag-border); border-radius: var(--ag-radius) var(--ag-radius) 0 0 !important; }
.card-header.bg-primary { background: var(--ag-gradient) !important; border-bottom: 0; }
.card-footer { background: transparent; border-top: 1px solid var(--ag-border); }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px -14px rgba(66, 133, 244, 0.35); }
.stat-card .stat-icon { border-radius: 14px; }

/* ---- Buttons: pills; primary uses the gradient ---- */
.btn { border-radius: 999px; font-weight: 500; padding-left: 1.1rem; padding-right: 1.1rem; transition: all .15s ease; white-space: nowrap; }
.btn-sm { padding-left: .8rem; padding-right: .8rem; }
.btn-primary {
  --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-border-color: transparent;
  background-image: var(--ag-gradient); background-color: var(--ag-indigo); color: #fff; border: 0;
  box-shadow: 0 6px 16px -8px rgba(91, 108, 240, 0.7);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background-image: var(--ag-gradient); filter: brightness(1.07); color: #fff; transform: translateY(-1px); }
.btn-outline-primary { --bs-btn-color: #3b6fe0; --bs-btn-border-color: #bcd0fb; --bs-btn-hover-bg: var(--ag-tint); --bs-btn-hover-color: #2f5fd0; --bs-btn-hover-border-color: #8fb0ff; --bs-btn-active-bg: var(--ag-tint); --bs-btn-active-color: #2f5fd0; }
.btn-outline-secondary { --bs-btn-color: var(--ag-muted); --bs-btn-border-color: var(--ag-border); --bs-btn-hover-bg: var(--ag-surface-2); --bs-btn-hover-color: var(--ag-text); --bs-btn-hover-border-color: var(--ag-border); --bs-btn-active-bg: var(--ag-surface-2); --bs-btn-active-color: var(--ag-text); }
.btn-light { --bs-btn-bg: var(--ag-surface); --bs-btn-border-color: var(--ag-border); --bs-btn-hover-bg: var(--ag-surface-2); }

/* ---- Forms ---- */
.form-control, .form-select, .input-group-text {
  border-radius: var(--ag-radius-sm); border: 1px solid var(--ag-border); background-color: var(--ag-surface); color: var(--ag-text);
}
.input-group > .form-control, .input-group > .form-select { border-radius: 0; }
.input-group > :first-child { border-top-left-radius: var(--ag-radius-sm) !important; border-bottom-left-radius: var(--ag-radius-sm) !important; }
.input-group > :last-child { border-top-right-radius: var(--ag-radius-sm) !important; border-bottom-right-radius: var(--ag-radius-sm) !important; }
.form-control:focus, .form-select:focus { border-color: #8fb0ff; box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.16); background-color: var(--ag-surface); color: var(--ag-text); }
.form-label { font-weight: 500; }
.form-check-input:checked { background-color: var(--ag-indigo); border-color: var(--ag-indigo); }
.select2-container--bootstrap-5 .select2-selection { border-radius: var(--ag-radius-sm); border-color: var(--ag-border); background-color: var(--ag-surface); }

/* ---- Tables ---- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ag-text); --bs-table-border-color: var(--ag-border); }
.table > thead > tr > th, .table-light, .table-light > th, .table-light > td {
  --bs-table-bg: var(--ag-surface-2); background: var(--ag-surface-2); color: var(--ag-muted);
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--ag-border);
}
.table-hover tbody tr:hover { --bs-table-hover-bg: var(--ag-tint); }
.card > .table-responsive, .card > .table { border-radius: var(--ag-radius); overflow: hidden; }

/* ---- Tabs, badges, alerts, dropdowns, modals ---- */
.nav-tabs { border-bottom: 1px solid var(--ag-border); }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--ag-muted); font-weight: 500; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--ag-text); border-bottom-color: var(--ag-border); }
.nav-tabs .nav-link.active { color: #2f5fd0; background: transparent; border-bottom-color: var(--ag-blue); font-weight: 600; }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { color: #a9c1ff; }
.nav-pills .nav-link { border-radius: 999px; }
.nav-pills .nav-link.active { background-image: var(--ag-gradient); }
.badge { border-radius: 999px; padding: .4em .75em; font-weight: 500; }
.alert { border-radius: var(--ag-radius-sm); border-width: 1px; }
.dropdown-menu, .popover, .toast { border: 1px solid var(--ag-border); border-radius: 14px; box-shadow: var(--ag-shadow); background: var(--ag-surface); }
.dropdown-item { border-radius: 8px; margin: 0 6px; width: auto; }
.modal-content { border: 1px solid var(--ag-border); border-radius: 20px; background: var(--ag-surface); box-shadow: 0 30px 80px -30px rgba(31, 36, 48, 0.45); }
.modal-header, .modal-footer { border-color: var(--ag-border); }
.pagination .page-link { border: 0; border-radius: 999px; margin: 0 2px; color: var(--ag-muted); background: transparent; }
.pagination .page-item.active .page-link { background-image: var(--ag-gradient); color: #fff; }
.list-group-item { background: var(--ag-surface); border-color: var(--ag-border); }
.progress { border-radius: 999px; background: var(--ag-surface-2); }
.progress-bar { background-image: var(--ag-gradient); }

/* ---- Misc ---- */
.drop-zone { border-radius: var(--ag-radius); }
.drop-zone.drag-over { border-color: var(--ag-blue); background: var(--ag-tint); }
.timeline-step .step-icon { box-shadow: 0 0 0 4px var(--ag-surface); }
::selection { background: rgba(66, 133, 244, 0.25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ag-border); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ag-muted); background-clip: content-box; }

/* ---- Wide data tables: base.html lets .card break words anywhere, which turns narrow column
   headers into one-letter-per-line stacks. Keep words whole; wide tables scroll instead. ---- */
.card .table { overflow-wrap: normal; word-break: normal; }
.table > thead > tr > th { white-space: nowrap; }
.table-responsive { overflow-x: auto; }
