/* ============================================================
   SmartBus — Reusable Components
   Cards, tables, tabs, progress, icons
   ============================================================ */

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; }
.page-title { font-size: 1.15rem; font-weight: 700; }
.page-title .page-title-icon { margin-right: 0.5rem; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.tab {
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}
.tab:hover { background: var(--color-bg-hover); color: var(--color-text); }
.tab.active {
  background: var(--color-bg-card);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-bottom: none;
  box-shadow: var(--shadow-sm);
}

/* ===== Data Table Wrapper ===== */
.table-wrapper {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--color-border-light);
}
.table-actions .search-box {
  position: relative;
  flex: 1;
  max-width: 240px;
}
.table-actions .search-box input {
  padding-left: 2.2rem;
  font-size: 0.85rem;
}
.table-actions .search-box .icon-search {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--color-text-tertiary);
}
.table-actions .filter-chips {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* ===== Progress Bar ===== */
.progress-bar {
  height: 6px;
  background: var(--color-border-light);
  border-radius: 3px;
  overflow: hidden;
  margin: 0.3rem 0;
}
.progress-bar > div {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.progress-bar .progress-safe { background: var(--color-safe); }
.progress-bar .progress-warning { background: var(--color-warning); }
.progress-bar .progress-danger { background: var(--color-danger); }

/* ===== Stat Number ===== */
.stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-tertiary);
  font-weight: 600;
}

/* ===== Chip ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip-success { background: var(--color-safe-bg); color: #14532d; }
.chip-warning { background: var(--color-warning-bg); color: #7c2d12; }
.chip-danger { background: var(--color-danger-bg); color: #7f1d1d; }
.chip-info { background: var(--color-info-bg); color: #0c4e69; }
.chip-neutral { background: var(--color-bg-muted); color: var(--color-text-secondary); }

/* ===== List Group ===== */
.list-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.list-item:hover { background: var(--color-bg-hover); }

/* ===== Icon Circle ===== */
.icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-muted);
}
.icon-circle-sm { width: 26px; height: 26px; }
.icon-circle-lg { width: 42px; height: 42px; }

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 1rem 0;
}
.divider .divider-text {
  text-align: center;
  font-size: 0.72rem;
  color: var(--color-text-tertiary);
  padding: 0 0.6rem;
}

/* ===== Avatar ===== */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: var(--color-accent);
  flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 0.6rem; }
.avatar.md { width: 32px; height: 32px; font-size: 0.7rem; }
.avatar.bus { background: var(--color-primary); }
.avatar.driver { background: var(--color-safe); }
.avatar.student { background: var(--color-info); }

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
.timeline-item {
  position: relative;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-bg);
}
.timeline-item .tl-time {
  font-size: 0.72rem;
  color: var(--color-text-tertiary);
  margin-bottom: 0.15rem;
}
.timeline-item .tl-text {
  font-size: 0.82rem;
  color: var(--color-text);
  font-weight: 500;
}
.timeline-item .tl-sub {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
}

/* ===== Collapsible Panel ===== */
.collapsible {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg-card);
}
.collapsible-header {
  padding: 0.7rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  user-select: none;
}
.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition);
}
.collapsible-body.open { max-height: 2000px; }
.collapsible-body .content { padding: 1rem; }

/* ===== Card Grid ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
