/* ---- Base ---- */
body {
  background: linear-gradient(135deg, #080b16 0%, #0d1225 25%, #111b3a 50%, #0a1628 75%, #0d0f1a 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: rgba(255, 255, 255, 0.88);
}

/* Subtle animated gradient orbs for depth */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}
body::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99, 130, 255, 0.4), transparent 70%);
  top: -10%; left: -5%;
  animation: floatOrb1 20s ease-in-out infinite alternate;
}
body::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(120, 80, 220, 0.3), transparent 70%);
  bottom: -10%; right: -5%;
  animation: floatOrb2 25s ease-in-out infinite alternate;
}
@keyframes floatOrb1 {
  0% { transform: translate(0, 0); }
  100% { transform: translate(80px, 60px); }
}
@keyframes floatOrb2 {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-60px, -80px); }
}

/* ---- Layout ---- */
#sidebar {
  width: 250px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  overflow-y: auto;
  background: rgba(12, 16, 32, 0.6) !important;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.main-content {
  min-height: 100vh;
  overflow-x: auto;
}

/* ---- Glass card mixin ---- */
.card, .stat-card, .modal-content {
  background: rgba(18, 24, 44, 0.55) !important;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card-header {
  background: rgba(255, 255, 255, 0.03) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  border-radius: 16px 16px 0 0 !important;
}

.card-body {
  position: relative;
}

/* ---- Stat cards ---- */
.stat-card {
  border-left-width: 4px !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.5;
}

/* ---- Progress bars ---- */
.progress {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06) !important;
  overflow: hidden;
}

.progress-bar {
  transition: width 0.6s ease;
  border-radius: 8px;
  background-image: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, transparent 100%);
}

/* ---- Nav / Sidebar ---- */
.sidebar .nav-link {
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.25s ease;
}

.sidebar .nav-link:hover {
  background: rgba(99, 130, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

.sidebar .nav-link.active {
  background: linear-gradient(135deg, rgba(99, 130, 255, 0.35), rgba(80, 100, 220, 0.15));
  color: #fff;
  border: 1px solid rgba(99, 130, 255, 0.25);
  box-shadow: 0 2px 12px rgba(99, 130, 255, 0.15);
}

.sidebar-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* ---- Tables ---- */
.table {
  --bs-table-bg: transparent;
}

.table thead th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.45);
}

.table-hover tbody tr:hover {
  background: rgba(99, 130, 255, 0.05) !important;
}

.table td, .table th {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* ---- Forms ---- */
.form-control, .form-select {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  color: rgba(255, 255, 255, 0.9);
}

.form-control:focus, .form-select:focus {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(99, 130, 255, 0.45) !important;
  box-shadow: 0 0 0 4px rgba(99, 130, 255, 0.12);
}

.form-control::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* ---- Buttons ---- */
.btn-primary {
  background: linear-gradient(135deg, #6382ff 0%, #5468d4 100%) !important;
  border: 1px solid rgba(99, 130, 255, 0.4) !important;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(99, 130, 255, 0.2);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7a94ff 0%, #6b80e8 100%) !important;
  box-shadow: 0 4px 20px rgba(99, 130, 255, 0.35);
  transform: translateY(-1px);
}

.btn-outline-secondary, .btn-outline-primary, .btn-outline-success,
.btn-outline-danger, .btn-outline-warning, .btn-outline-info {
  border-radius: 10px;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
}

.btn-outline-secondary:hover, .btn-outline-primary:hover, .btn-outline-success:hover,
.btn-outline-danger:hover, .btn-outline-warning:hover, .btn-outline-info:hover {
  transform: translateY(-1px);
}

/* ---- Badges ---- */
.badge {
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ---- Alerts ---- */
.alert {
  background: rgba(18, 24, 44, 0.6) !important;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  background: transparent;
  padding: 0;
}

.breadcrumb-item a {
  color: rgba(99, 130, 255, 0.8);
  transition: color 0.2s;
}

.breadcrumb-item a:hover {
  color: #7a94ff;
}

/* ---- List groups (milestones) ---- */
.list-group-item {
  background: rgba(255, 255, 255, 0.02) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  transition: background 0.2s;
}

.list-group-item:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

.list-group-item-success {
  background: rgba(25, 135, 84, 0.12) !important;
  color: #75b798 !important;
}

.list-group-item-danger {
  background: rgba(220, 53, 69, 0.12) !important;
  color: #ea868f !important;
}

/* ---- Nav pills (inspections page) ---- */
.nav-pills .nav-link {
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.55);
  transition: all 0.25s ease;
}

.nav-pills .nav-link:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(99, 130, 255, 0.08);
}

.nav-pills .nav-link.active {
  background: linear-gradient(135deg, rgba(99, 130, 255, 0.35), rgba(99, 130, 255, 0.15)) !important;
  border: 1px solid rgba(99, 130, 255, 0.25);
  box-shadow: 0 2px 12px rgba(99, 130, 255, 0.12);
}

/* ---- Dropdown menus ---- */
.dropdown-menu {
  background: rgba(16, 20, 38, 0.85) !important;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.dropdown-item {
  color: rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  transition: all 0.2s;
}

.dropdown-item:hover {
  background: rgba(99, 130, 255, 0.12);
  color: #fff;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ---- Responsive ---- */

/* Mobile top bar */
.mobile-topbar {
  background: rgba(12, 16, 32, 0.85) !important;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 1030;
}

/* Offcanvas sidebar styling */
.offcanvas {
  background: rgba(12, 16, 32, 0.92) !important;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  max-width: 280px;
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.offcanvas .nav-link {
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.25s ease;
}

.offcanvas .nav-link:hover {
  background: rgba(99, 130, 255, 0.12);
  color: #fff;
}

.offcanvas .nav-link.active {
  background: linear-gradient(135deg, rgba(99, 130, 255, 0.35), rgba(80, 100, 220, 0.15));
  color: #fff;
  border: 1px solid rgba(99, 130, 255, 0.25);
}

@media (max-width: 767.98px) {
  .main-content {
    min-height: calc(100vh - 56px);
  }

  .milestone-item .d-flex.align-items-center.gap-2.mt-2 {
    flex-wrap: wrap;
  }

  .milestone-item .d-flex.align-items-center.gap-2.mt-2 input {
    max-width: 100% !important;
    flex: 1 1 auto;
    min-width: 0;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .card-body {
    padding: 0.75rem;
  }

  .inspection-card .row.g-2 .col-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .stat-icon {
    font-size: 1.5rem;
  }

  h3 { font-size: 1.35rem; }

  .ofci-form-row .col-4 {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 0.25rem;
  }
}
