html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* Traffic-themed background colors */
.bg-traffic-red {
  background-color: var(--traffic-red) !important;
}

.bg-traffic-green {
  background-color: var(--traffic-green) !important;
}

.bg-road-orange {
  background-color: var(--road-orange) !important;
}

.bg-road-green {
  background-color: var(--road-green) !important;
}

/* Traffic-themed text colors */
.text-traffic-red {
  color: var(--traffic-red) !important;
}

.text-traffic-green {
  color: var(--traffic-green) !important;
}

.text-road-orange {
  color: var(--road-orange) !important;
}

.text-road-grey {
  color: var(--road-grey) !important;
}

/* Traffic-themed border-left accents for cards */
.border-left-traffic-red {
  border-left: 4px solid var(--traffic-red) !important;
}

.border-left-traffic-green {
  border-left: 4px solid var(--traffic-green) !important;
}

.border-left-road-orange {
  border-left: 4px solid var(--road-orange) !important;
}

.border-left-road-yellow {
  border-left: 4px solid var(--road-yellow) !important;
}

/* Traffic-themed buttons */
.btn-traffic-red {
  background-color: var(--traffic-red);
  border-color: var(--traffic-red);
  color: white;
}

.btn-traffic-red:hover {
  background-color: #b71c1c;
  border-color: #b71c1c;
  color: white;
}

.btn-traffic-green {
  background-color: var(--traffic-green);
  border-color: var(--traffic-green);
  color: white;
}

.btn-traffic-green:hover {
  background-color: #2e7d32;
  border-color: #2e7d32;
  color: white;
}

.btn-road-orange {
  background-color: var(--road-orange);
  border-color: var(--road-orange);
  color: white;
}

.btn-road-orange:hover {
  background-color: #e66a02;
  border-color: #e66a02;
  color: white;
}

/* Profile avatar */
.profile-avatar {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border: 3px solid var(--traffic-red);
  max-width: 100%;
}

.profile-avatar-placeholder {
  width: 100px;
  height: 100px;
  border: 3px solid var(--traffic-red);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Rank badge */
.rank-badge {
  color: white;
}

/* Stat card */
.stat-card-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Card accent borders */
.card-accent {
  border-left: 4px solid var(--road-orange);
}

/* Section header with border accent */
.section-header-accent {
  border-left: 4px solid var(--road-orange);
  padding-left: 15px;
  margin-bottom: 20px;
}

/* Page header icon */
.page-header-icon {
  font-size: 2rem;
}

/* Empty state */
.empty-state-icon {
  font-size: 3rem;
}

/* Attempt cards (exam/quiz history) */
.attempt-card {
  border-top: 4px solid var(--road-grey);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.attempt-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12) !important;
}

.attempt-card-passed {
  border-top-color: var(--traffic-green);
}

.attempt-card-failed {
  border-top-color: var(--traffic-red);
}

.attempt-score {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.attempt-progress {
  height: 6px;
  border-radius: 3px;
}

.attempt-progress .progress-bar {
  border-radius: 3px;
}

.attempt-footer {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

/* Card search filter */
.card-search {
  max-width: 300px;
}

/* History section (row with cards) */
.history-grid {
  margin-bottom: -1rem;
}

/* Profile tabs */
.profile-tabs {
  border-bottom: 2px solid rgba(0,0,0,0.06);
  gap: 0.25rem;
}

.tab-pane:not(.active) {
  display: none !important;
}

.profile-tabs .nav-link {
  border: none;
  border-radius: 8px 8px 0 0;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  color: var(--road-grey);
  transition: all 0.2s ease;
  background: transparent;
  opacity: 0.7;
}

.profile-tabs .nav-link:hover {
  color: var(--traffic-red);
  background: rgba(211, 47, 47, 0.05);
}

.profile-tabs .nav-link.active {
  color: white;
  background: var(--traffic-red);
  box-shadow: 0 -2px 8px rgba(211, 47, 47, 0.15);
  border-bottom: 3px solid #b71c1c;
  margin-bottom: -2px;
}

.profile-tabs .nav-link i {
  font-size: 1.1rem;
}

/* ===== Page Loading Overlay ===== */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 46, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

.loader-overlay.show {
  display: flex;
}

.loader-overlay-content {
  text-align: center;
  color: white;
}

.loader-overlay-spinner {
  width: 3.5rem;
  height: 3.5rem;
  border-width: 0.35em;
  color: var(--traffic-red);
}

.loader-overlay-icon {
  font-size: 3rem;
  color: var(--traffic-yellow);
  margin-bottom: 0.5rem;
}

.loader-overlay-text {
  font-size: 1.15rem;
  opacity: 0.95;
  font-weight: 500;
  margin-top: 1rem;
  margin-bottom: 0;
}

.loader-overlay-subtext {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-top: 0.25rem;
}

/* ===== Inline Loader Placeholder ===== */
.loader-placeholder {
  gap: 0.5rem;
}

.loader-placeholder-text {
  font-size: 0.9rem;
}

/* ===== Traffic-themed pulse animation for loader ===== */
@keyframes traffic-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

.loader-pulse {
  animation: traffic-pulse 1.5s ease-in-out infinite;
}

/* ===== Button loading state ===== */
.btn-loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn-loading .btn-loader {
  display: inline-flex !important;
}

.btn-loading .btn-text {
  display: none !important;
}
