/* =====================================================
   IWQT Track — Custom CSS
   190th Engineer Battalion
   Based on TC 3-20.40
   ===================================================== */

/* ── Root Variables ── */
:root {
  --army-green: #1a3a1a;
  --army-tan: #c8b882;
  --army-dark: #0d1f0d;
  --army-light: #f0f4f0;
}

/* ── Body ── */
body {
  background-color: #f4f4f0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: 250px;
  background-color: var(--army-green);
  border-right: 3px solid var(--army-tan);
  box-shadow: 2px 0 8px rgba(0,0,0,0.25);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(200,184,130,0.28);
  flex-shrink: 0;
}

.sidebar-icon {
  font-size: 2rem;
  color: var(--army-tan);
  flex-shrink: 0;
  line-height: 1;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.6px;
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 0.6rem;
  color: rgba(200,184,130,0.72);
  letter-spacing: 0.7px;
  line-height: 1.4;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  letter-spacing: 0.3px;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s;
}

.sidebar-link .bi {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background-color: rgba(255,255,255,0.07);
  color: var(--army-tan);
  border-left-color: rgba(200,184,130,0.45);
}

.sidebar-link.active {
  background-color: rgba(200,184,130,0.13);
  color: var(--army-tan);
  border-left-color: var(--army-tan);
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(200,184,130,0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-unit-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.sidebar-section-label {
  font-size: 0.6rem;
  color: rgba(200,184,130,0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 18px 2px;
}

.sidebar-user {
  border-top: 1px solid rgba(200,184,130,0.15);
  padding-top: 10px;
  margin-top: 4px;
}

.sidebar-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.65rem;
  color: rgba(200,184,130,0.7);
}

.sidebar-logout {
  color: rgba(255,255,255,0.45);
  font-size: 1rem;
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-logout:hover {
  color: #dc3545;
}

/* HTMX indicator inside sidebar */
.sidebar .htmx-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.65);
  font-size: 0.75rem;
}

/* ── Main wrapper ── */
.main-wrapper {
  margin-left: 250px;   /* full sidebar DOM width; clipped area shows page bg */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f4f4f0;
}

.main-content {
  flex: 1;
  padding: 24px 28px;
}

/* ── Mobile top bar ── */
.mobile-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background-color: var(--army-green);
  border-bottom: 2px solid var(--army-tan);
  padding: 9px 14px;
  color: white;
}

/* ── Responsive: mobile sidebar ── */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
    padding-top: 50px;
  }
}

/* ── Legacy card header that used .iwqt-navbar ── */
.card-header.iwqt-navbar,
.iwqt-navbar {
  background-color: var(--army-green) !important;
}

/* ── Footer ── */
footer {
  border-top: 1px solid #dee2e6;
  font-size: 0.78rem;
  background-color: #212529 !important;
  color: #adb5bd !important;
  padding: 8px 0;
}

/* ── HTMX Loading Indicator ── */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex !important;
  align-items: center;
}

/* ── Cards ── */
.card-stat {
  border-left: 4px solid var(--army-green) !important;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
}

/* ── Tables ── */
.table-sm td,
.table-sm th {
  font-size: 0.82rem;
  vertical-align: middle;
}

.table-tracker th {
  background-color: var(--army-green) !important;
  color: white !important;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 600;
  border-color: #2d5c2d !important;
}

.table-hover tbody tr:hover {
  background-color: rgba(26, 58, 26, 0.05);
}

/* ── Qualification Badges ── */
.badge-expert { background-color: #198754 !important; }
.badge-sharpshooter { background-color: #0d6efd !important; }
.badge-marksman { background-color: #ffc107 !important; color: #000 !important; }
.badge-unqualified { background-color: #dc3545 !important; }
.badge-no-fire { background-color: #6c757d !important; }

.weapon-badge {
  font-size: 0.70rem;
  padding: 3px 7px;
  white-space: nowrap;
}

/* ── Inline Qual Form Row ── */
.qual-row-form {
  background-color: #fffde7 !important;
  border-left: 4px solid #ffc107 !important;
}

/* ── Progress Bars ── */
.progress {
  height: 8px;
  border-radius: 4px;
}

/* ── Army Button ── */
.btn-army {
  background-color: var(--army-green);
  color: white;
  border: 1px solid var(--army-dark);
  font-weight: 500;
  transition: background-color 0.2s;
}

.btn-army:hover,
.btn-army:focus {
  background-color: var(--army-dark);
  color: white;
  border-color: var(--army-dark);
}

.btn-army:active {
  background-color: var(--army-dark) !important;
  color: white !important;
}

/* ── Text Colors ── */
.text-army-green {
  color: var(--army-green) !important;
}

/* ── Form Controls ── */
.form-control:focus,
.form-select:focus {
  border-color: var(--army-green);
  box-shadow: 0 0 0 0.2rem rgba(26, 58, 26, 0.2);
}

/* ── Alert Enhancements ── */
.alert {
  border-left: 4px solid transparent;
}
.alert-success { border-left-color: #198754; }
.alert-danger { border-left-color: #dc3545; }
.alert-warning { border-left-color: #ffc107; }
.alert-info { border-left-color: #0dcaf0; }

/* ── Code Styling ── */
code {
  color: var(--army-dark);
  background-color: #e8f0e8;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.82em;
}

/* ── Responsive Table Overflow ── */
.table-responsive {
  border-radius: 0 0 6px 6px;
}

/* ── Dashboard Stat Numbers ── */
.fs-1 { font-size: 2rem !important; }

/* ── Card Header Army Style ── */
.card-header.iwqt-navbar {
  border-radius: 6px 6px 0 0 !important;
}

/* ── Weapon Tracker Table ── */
#tracker-table th,
#tracker-table td {
  white-space: nowrap;
}

/* ── Quick nav buttons ── */
.btn-outline-dark:hover {
  background-color: var(--army-green);
  border-color: var(--army-green);
  color: white;
}

/* ── Spinner sizing ── */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}

/* ── Auth Pages (login / register) ── */
.auth-page {
  background: linear-gradient(135deg, var(--army-dark) 0%, var(--army-green) 60%, #2d5c2d 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-wrapper {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: #fff;
  border-radius: 10px;
  padding: 36px 32px 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  font-size: 2.8rem;
  color: var(--army-green);
  line-height: 1;
  margin-bottom: 6px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--army-dark);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.auth-subtitle {
  font-size: 0.72rem;
  color: #6c757d;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 0;
}

/* ── Print Styles ── */
@media print {
  .sidebar,
  .mobile-topbar,
  .btn,
  footer,
  .htmx-indicator {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  body {
    background: white;
    font-size: 10pt;
  }
  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
  .table-tracker th {
    background-color: #ccc !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
  }
}
