/* ==========================================================================
   ReportPilot — Bootstrap 5 theme overrides
   Most styling comes from Bootstrap classes in the HTML. This file only:
   1) sets the brand colour/font, 2) styles the sidebar, 3) adds a few
   small components Bootstrap doesn't ship (stepper, dropzone, logos).
   ========================================================================== */

/* ---------- 1. Brand settings (change colours here) ---------- */
:root {
  --brand: #4f46e5;
  --brand-rgb: 79, 70, 229;
  --brand-dark: #4338ca;
  --sidebar-bg: #0f172a;
  --sidebar-width: 250px;

  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9rem;
  --app-bg: #f6f7fb;            /* page background behind cards */
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-primary-bg-subtle: #eef2ff;
  --bs-primary-border-subtle: #c7d2fe;
  --bs-primary-text-emphasis: #3730a3;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: var(--brand-dark);
  --bs-link-hover-color-rgb: 67, 56, 202;
  --bs-focus-ring-color: rgba(var(--brand-rgb), .25);
  --bs-border-radius: .5rem;
  --bs-border-radius-lg: .75rem;
}

.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
  --bs-btn-disabled-color: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .55); box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .18); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: rgba(var(--brand-rgb), .55); box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .18); }
.form-switch .form-check-input { width: 2.5em; height: 1.35em; cursor: pointer; }
body { background-color: var(--app-bg); }
.toast { --bs-toast-bg: #fff; }
.card { --bs-card-border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; font-weight: 600; background: #f9fafb; white-space: nowrap; }

/* ---------- 2. Layout: sidebar + top bar ---------- */
.app-sidebar.offcanvas-lg { background-color: var(--sidebar-bg) !important; color: #cbd5e1; width: var(--sidebar-width); }
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
}
.app-sidebar .offcanvas-header { display: flex !important; } /* keep the logo visible on desktop too */
.app-sidebar .brand { color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.app-sidebar .brand-icon { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #4338ca); }
.app-sidebar .nav-link { color: #cbd5e1; border-radius: .5rem; padding: .55rem .75rem; display: flex; align-items: center; gap: .65rem; font-weight: 500; }
.app-sidebar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.app-sidebar .nav-link.active { color: #fff; background: rgba(99, 102, 241, .2); box-shadow: inset 3px 0 0 #818cf8; }
.app-sidebar .nav-heading { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #64748b; font-weight: 600; }
.app-sidebar .demo-note { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); color: #94a3b8; }
.app-main { min-width: 0; }
.app-topbar { height: 60px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); z-index: 1020; }
.app-topbar .breadcrumb { --bs-breadcrumb-margin-bottom: 0; white-space: nowrap; overflow: hidden; flex-wrap: nowrap; }
.app-topbar .breadcrumb-item.active { color: #111827; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 34px; height: 34px; font-size: .75rem; }

/* ---------- 3. Small components ---------- */
.min-w-0 { min-width: 0; }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--brand); }

/* Profile & account settings */
.profile-avatar { width: 112px; height: 112px; font-size: 2.4rem; box-shadow: 0 0 0 4px #fff, 0 4px 14px rgba(16, 24, 40, .15); overflow: hidden; }
.avatar-edit-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 0 0 3px #fff; }
.avatar { overflow: hidden; }
.settings-section { scroll-margin-top: 80px; }
@media (min-width: 992px) { .settings-nav { position: sticky; top: 80px; } }
.settings-nav .nav-link { color: #374151; white-space: nowrap; border-radius: .5rem; }
.settings-nav .nav-link:hover { background: #f3f4f6; }
.settings-nav .nav-pills { --bs-nav-pills-link-active-bg: var(--brand); }
.qr-placeholder { width: 120px; height: 120px; font-size: 5rem; line-height: 1; background: #fff; }
fieldset:disabled .btn-tile { opacity: .55; }

/* Header project switcher */
.project-switcher .btn { min-height: 44px; }
.project-switcher-name { max-width: 220px; }
.project-switcher-menu { width: 330px; max-width: calc(100vw - 1.5rem); }
@media (max-width: 575.98px) { .project-switcher-name { max-width: 118px; } }
.table-responsive { position: relative; } /* keeps .visually-hidden labels inside the scroll box on phones */
.project-mark { display: inline-flex; align-items: center; justify-content: center; border-radius: .6rem; font-weight: 700; flex-shrink: 0; overflow: hidden; background: #f3f4f6; }
.project-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.platform-logo { display: inline-flex; flex-shrink: 0; }
.platform-logo svg { width: 100%; height: 100%; }
.platform-stack .platform-logo { background: #fff; border: 1px solid #e5e7eb; border-radius: 50%; padding: 4px; box-shadow: 0 0 0 2px #fff; margin-left: -6px; box-sizing: content-box; }
.platform-stack .platform-logo:first-child { margin-left: 0; }
.stat-icon { width: 42px; height: 42px; }
.empty-icon { width: 56px; height: 56px; }
.row-new { --bs-table-bg: #eef2ff; }

/* Wizard stepper */
.wizard-steps .step-btn { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .9rem 1rem; border: 0; background: none; text-align: left; border-bottom: 3px solid transparent; color: #6b7280; }
.wizard-steps .step-btn:not(:disabled):hover { background: rgba(var(--brand-rgb), .04); }
.wizard-steps .step-btn:disabled { opacity: 1; cursor: default; }
.wizard-steps .step-num { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; border: 1.5px solid #d1d5db; background: #fff; flex-shrink: 0; }
.wizard-steps .is-current .step-btn { border-bottom-color: var(--brand); background: #fff; color: #111827; }
.wizard-steps .is-current .step-num { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .15); }
.wizard-steps .is-done .step-num { background: #ecfdf3; border-color: #86efac; color: #15803d; }
.wizard-steps .is-done .step-btn { color: #111827; }

/* Logo upload drop zone */
.dropzone { border: 1.5px dashed #d1d5db; background: #f9fafb; cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand); background: #eef2ff; }
.dropzone.is-invalid { border-color: var(--bs-form-invalid-border-color); background: #fef2f2; }
.logo-preview-img { width: 64px; height: 64px; object-fit: contain; }

/* Integration cards */
.integration.is-connected { border-color: #86efac; background: linear-gradient(180deg, #f7fef9, #fff 60%); }

/* Pill & tile radio buttons (Bootstrap .btn-check) */
.btn-check + .btn-pill { border-radius: 50rem; border: 1px solid #d1d5db; background: #fff; color: #374151; font-weight: 500; }
.btn-check + .btn-pill:hover { border-color: var(--brand); color: var(--brand); }
.btn-check:checked + .btn-pill { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-check + .btn-tile { border: 1.5px solid #d1d5db; background: #fff; text-align: left; width: 100%; }
.btn-check + .btn-tile:hover { border-color: var(--brand); }
.btn-check:checked + .btn-tile { border-color: var(--brand); background: #eef2ff; box-shadow: inset 0 0 0 1px var(--brand); color: inherit; }

/* Review step */
.review-list dt { color: #6b7280; font-weight: 400; }
.review-list dd { font-weight: 500; overflow-wrap: anywhere; }

/* Success state */
.success-badge { width: 76px; height: 76px; box-shadow: 0 0 0 10px #dcfce7; animation: pop .4s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* Dashboard */
.kpi-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-spark { height: 36px !important; }
.chart-box { position: relative; height: 290px; }
.chart-box-sm { position: relative; height: 180px; }
.dash-loading > .row { opacity: .45; pointer-events: none; transition: opacity .2s; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.progress { --bs-progress-height: .5rem; --bs-progress-bar-bg: #2a78d6; }

@media (max-width: 575.98px) {
  .kpi-value { font-size: 1.3rem; }
}
