/* RJ_BPCL — dashboard stylesheet (Streamlit-match edition) */

:root {
  --sidebar-bg:     #4FC3F7;   /* light blue, matches Streamlit */
  --sidebar-fg:     #fff;
  --cap-bg:         rgba(255,255,255,0.85);
  --cap-border:     rgba(0,120,180,0.3);
  --cap-border-hover: #0277BD;
  --cap-fg:         #000;
  --accent-red:     #C62828;
  --accent-red-dk:  #B71C1C;
  --table-header:   #1C2833;
  --table-header-alt: #273746;
  --title-color:    #1C2833;
  --bg:             #f7f8fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: var(--bg);
  color: #111;
}

.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
}

.sidebar-logo { text-align: center; padding: 6px 0; }
.sidebar-logo img {
  width: 120px; border-radius: 10px;
  display: inline-block;
}
.sidebar-title {
  font-size: 1rem; font-weight: 800; margin-top: 6px;
  letter-spacing: 1px; color: #fff !important;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

.nav-cap {
  display: flex; align-items: center;
  background: var(--cap-bg);
  color: var(--cap-fg) !important;
  padding: 12px 20px;
  border: 2px solid var(--cap-border);
  border-radius: 25px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  min-height: 48px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: all 0.15s ease;
}
.nav-cap:hover {
  background: #fff;
  border-color: var(--cap-border-hover);
  box-shadow: 0 3px 10px rgba(0,120,180,0.25);
  color: #000 !important;
}
.nav-cap.active {
  background: #fff;
  border-color: var(--cap-border-hover);
  color: #000 !important;
  box-shadow: 0 3px 12px rgba(0,120,180,0.30);
}

.sidebar-footer {
  margin-top: auto;
  text-align: center;
  color: rgba(255,255,255,0.85) !important;
  font-size: 0.72rem;
  padding-top: 20px;
}

/* ── Main ─────────────────────────────────────────────── */
.main { flex: 1; padding: 20px 30px; overflow-x: auto; }

.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.page-header h1 {
  margin: 0; font-size: 1.45rem; font-weight: 800;
  color: var(--title-color); letter-spacing: 0.2px;
}
.page-header h2, .main h2 {
  font-size: 1.1rem; font-weight: 700; color: var(--title-color);
  margin-top: 22px; margin-bottom: 10px;
}

/* ── Stat cards ─────────────────────────────────────────── */
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-card {
  flex: 1 1 200px;
  background: #fff;
  border-left: 4px solid var(--accent-red);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.stat-label {
  font-size: 10px; color: #85929E;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 4px;
}
.stat-value {
  font-size: 1.7rem; font-weight: 800; color: var(--title-color);
}

/* ── Cool table (replaces Bootstrap default look) ────────── */
.cool-table {
  border: 1.5px solid #D5D8DC;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  background: #fff;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.cool-table thead tr {
  background: var(--table-header);
  color: #ECF0F1 !important;
}
.cool-table thead tr:hover {
  background: var(--table-header-alt);
}
.cool-table thead th {
  border-bottom: none !important;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: left;
  color: #ECF0F1 !important;
}
.cool-table tbody tr:nth-child(even) td { background: #F7F8FA; }
.cool-table tbody tr:hover td { background: #FFEBEE; }
.cool-table tbody td {
  padding: 9px 12px;
  vertical-align: middle;
  border-top: 1px solid #EFEFEF;
  font-size: 12.5px;
  color: #2C3E50;
}
.cool-table tfoot tr { background: var(--table-header); color: #fff; }
.cool-table tfoot th {
  padding: 10px 12px; color: #fff !important;
  font-size: 12px; font-weight: 700;
  border-top: none !important;
}

/* Badges */
.badge.bg-success { background: #2E7D32 !important; }
.badge.bg-secondary { background: #95A5A6 !important; }
.badge.bg-warning { background: #E65100 !important; color: #fff !important; }
.badge.bg-danger { background: var(--accent-red) !important; }

/* Red text highlight */
.text-danger { color: var(--accent-red) !important; font-weight: 700 !important; }

/* Primary button — red */
.btn-primary {
  background: var(--accent-red) !important;
  border-color: var(--accent-red) !important;
  color: #fff !important;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-red-dk) !important;
  border-color: var(--accent-red-dk) !important;
}

/* Login box */
.login-box {
  max-width: 360px; margin: 60px auto;
  background: #fff; padding: 30px; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.login-box h1 {
  font-size: 1.2rem; font-weight: 700;
  color: var(--title-color); margin-bottom: 14px;
}

/* Form controls */
.form-control, .form-select {
  border: 1.5px solid #D5D8DC;
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  border-color: #0277BD;
  box-shadow: 0 0 0 0.15rem rgba(2,119,189,0.15);
}

/* ── Dashboard dark stat cards (match old Streamlit) ─────── */
.db-stats {
  display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.db-stat {
  flex: 1 1 200px;
  background: linear-gradient(135deg, #1C2833 0%, #2E4053 100%);
  border-radius: 12px;
  padding: 14px 18px;
  color: #fff;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.db-stat-num {
  font-size: 28px; font-weight: 800; line-height: 1.1; color: #fff;
}
.db-stat-lbl {
  font-size: 11px; font-weight: 600; color: #85929E;
  text-transform: uppercase; letter-spacing: 0.8px; margin-top: 4px;
}
.db-stat.green .db-stat-num { color: #66BB6A; }
.db-stat.yellow .db-stat-num { color: #FFD54F; }
.db-stat.red .db-stat-num { color: #EF5350; }
.db-stat.moving {
  background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%);
}
.db-stat.moving .db-stat-num { color: #fff; }
.db-stat.moving .db-stat-lbl { color: #A5D6A7; }

/* ── Dashboard fleet table (color-coded rows) ────────────── */
.db-wrap {
  width: 100%;
  border: 1px solid #E0E0E0;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  overflow-x: auto;
  background: #fff;
}
.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.db-table thead th {
  background: #1C2833;
  color: #ECF0F1;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.3px;
  border-right: 1px solid #2E3F50;
  border-bottom: 2px solid #C62828;
  text-transform: uppercase;
}
.db-table thead th:last-child { border-right: none; }
.db-table tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  text-align: left;
  color: #2C3E50;
  line-height: 1.3;
  vertical-align: middle;
}
.db-table tbody tr:hover td { filter: brightness(0.93); transition: 0.1s; }

/* Status pill badges */
.badge-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
}
.badge-pill.green  { background: #2E7D32; }
.badge-pill.yellow { background: #F9A825; }
.badge-pill.orange { background: #EF6C00; }
.badge-pill.red    { background: #C62828; }

/* Responsive */
@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 10px; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-cap { flex: 1 1 45%; text-align: center; min-height: 40px; padding: 8px 12px; }
  .main { padding: 14px; }
  .stat-card { flex: 1 1 100%; }
  .cool-table thead th, .cool-table tbody td { padding: 7px 8px; font-size: 11px; }
}
