/* ============================================
   Bus Tracking — Premium UI
   Purple accent · Soft depth · Transport feel
   ============================================ */

:root {
    --bt-purple: #7c3aed;
    --bt-purple-dark: #6d28d9;
    --bt-purple-light: #ede9fe;
    --bt-purple-bg: #f5f3ff;
    --bt-green: #16a34a;
    --bt-green-light: #dcfce7;
    --bt-red: #dc2626;
    --bt-red-light: #fee2e2;
    --bt-amber: #d97706;
    --bt-amber-light: #fef3c7;
    --bt-blue: #2563eb;
    --bt-blue-light: #dbeafe;
    --bt-gray-50: #f9fafb;
    --bt-gray-100: #f3f4f6;
    --bt-gray-200: #e5e7eb;
    --bt-gray-300: #d1d5db;
    --bt-gray-400: #9ca3af;
    --bt-gray-500: #6b7280;
    --bt-gray-700: #374151;
    --bt-gray-900: #111827;
    --bt-radius: 16px;
    --bt-radius-sm: 12px;
    --bt-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --bt-shadow: 0 4px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    --bt-shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --bt-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Page Background ── */
.bt-page {
    background: linear-gradient(180deg, #faf9ff 0%, #f8f7fc 30%, #f5f3fa 100%);
    min-height: 100vh;
}

/* ── Hero Section ── */
.bt-hero {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 40%, #faf9ff 100%);
    border-bottom: 1px solid var(--bt-gray-200);
    padding: 48px 0 40px;
    position: relative;
    overflow: hidden;
}

.bt-hero::after {
    content: '';
    position: absolute;
    right: -60px;
    top: -40px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124,58,237,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.bt-hero .bt-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bt-purple);
    background: var(--bt-purple-light);
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.bt-hero .bt-hero-eyebrow .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bt-purple);
}

.bt-hero .bt-hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--bt-gray-900);
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.bt-hero .bt-hero-subtitle {
    font-size: 1.05rem;
    color: var(--bt-gray-500);
    max-width: 520px;
    line-height: 1.5;
}

.bt-hero .bt-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bt-gray-700);
    margin-top: 16px;
    box-shadow: var(--bt-shadow-sm);
}

.bt-hero .bt-hero-badge .pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bt-green);
    animation: bt-pulse 2s ease-in-out infinite;
}

@keyframes bt-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22,163,74,0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(22,163,74,0); }
}

/* ── Content Section ── */
.bt-content {
    padding: 32px 0 60px;
}

/* ── Summary Cards ── */
.bt-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.bt-summary-card {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    padding: 20px 24px;
    box-shadow: var(--bt-shadow-sm);
    transition: box-shadow var(--bt-transition), transform var(--bt-transition);
    position: relative;
    overflow: hidden;
}

.bt-summary-card:hover {
    box-shadow: var(--bt-shadow);
    transform: translateY(-2px);
}

.bt-summary-card .bt-sc-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 14px;
}

.bt-summary-card .bt-sc-icon.bus {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: var(--bt-purple);
}

.bt-summary-card .bt-sc-icon.route {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: var(--bt-amber);
}

.bt-summary-card .bt-sc-icon.driver {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: var(--bt-blue);
}

.bt-summary-card .bt-sc-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bt-gray-400);
    font-weight: 700;
    margin-bottom: 4px;
}

.bt-summary-card .bt-sc-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bt-gray-900);
    word-break: break-word;
    line-height: 1.3;
}

.bt-summary-card .bt-sc-sub {
    font-size: 0.8rem;
    color: var(--bt-gray-400);
    margin-top: 2px;
}

/* ── Skeleton Loading ── */
.bt-skeleton {
    background: linear-gradient(90deg, var(--bt-gray-100) 25%, var(--bt-gray-200) 50%, var(--bt-gray-100) 75%);
    background-size: 200% 100%;
    animation: bt-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes bt-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.bt-skeleton-text {
    height: 14px;
    width: 80%;
    margin-bottom: 8px;
}

.bt-skeleton-text.short { width: 50%; }

.bt-skeleton-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    margin-bottom: 14px;
}

/* ── Trip Status Card ── */
.bt-trip-card {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.bt-trip-card .bt-trip-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--bt-gray-100);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--bt-gray-900);
}

.bt-trip-card .bt-trip-body {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

/* Circular status */
.bt-trip-status-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: relative;
}

.bt-trip-status-circle::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px dashed transparent;
}

.bt-trip-status-circle.ready {
    background: var(--bt-purple-light);
    color: var(--bt-purple);
}

.bt-trip-status-circle.ready::before {
    border-color: var(--bt-purple);
    opacity: 0.3;
}

.bt-trip-status-circle.active {
    background: var(--bt-green-light);
    color: var(--bt-green);
}

.bt-trip-status-circle.active::before {
    border-color: var(--bt-green);
    opacity: 0.4;
    animation: bt-spin-dash 8s linear infinite;
}

.bt-trip-status-circle.completed {
    background: var(--bt-gray-100);
    color: var(--bt-gray-500);
}

@keyframes bt-spin-dash {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bt-trip-status-circle .bt-ts-icon {
    font-size: 1.6rem;
    margin-bottom: 2px;
}

/* Trip info */
.bt-trip-info {
    flex: 1;
    min-width: 180px;
}

.bt-trip-info .bt-ti-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--bt-gray-100);
}

.bt-trip-info .bt-ti-row:last-child {
    border-bottom: none;
}

.bt-trip-info .bt-ti-label {
    font-size: 0.8rem;
    color: var(--bt-gray-400);
    font-weight: 500;
}

.bt-trip-info .bt-ti-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bt-gray-900);
}

/* Trip actions */
.bt-trip-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.bt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all var(--bt-transition);
    white-space: nowrap;
    min-width: 160px;
}

.bt-btn-start {
    background: var(--bt-purple);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124,58,237,0.3);
}

.bt-btn-start:hover {
    background: var(--bt-purple-dark);
    box-shadow: 0 6px 20px rgba(124,58,237,0.4);
    transform: translateY(-1px);
}

.bt-btn-start:active {
    transform: translateY(0);
}

.bt-btn-end {
    background: #fff;
    color: var(--bt-red);
    border: 2px solid var(--bt-red-light);
}

.bt-btn-end:hover {
    background: var(--bt-red-light);
    border-color: var(--bt-red);
}

/* ── Two Column Layout ── */
.bt-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* ── Section Card ── */
.bt-section {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow-sm);
    overflow: hidden;
}

.bt-section .bt-section-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--bt-gray-100);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--bt-gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bt-section .bt-section-body {
    padding: 20px 24px;
}

/* ── Route Timeline ── */
.bt-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.bt-timeline .bt-tl-stop {
    position: relative;
    padding-left: 40px;
    padding-bottom: 22px;
}

.bt-timeline .bt-tl-stop:last-child {
    padding-bottom: 0;
}

.bt-timeline .bt-tl-stop::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 28px;
    bottom: 0;
    width: 2px;
    background: var(--bt-gray-200);
}

.bt-timeline .bt-tl-stop:last-child::before {
    display: none;
}

.bt-timeline .bt-tl-dot {
    position: absolute;
    left: 8px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--bt-purple);
    z-index: 1;
}

.bt-timeline .bt-tl-stop:first-child .bt-tl-dot {
    border-color: var(--bt-green);
    background: var(--bt-green-light);
}

.bt-timeline .bt-tl-stop:last-child .bt-tl-dot {
    border-color: var(--bt-red);
    background: var(--bt-red-light);
}

.bt-timeline .bt-tl-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bt-gray-400);
    font-weight: 700;
    margin-bottom: 2px;
}

.bt-timeline .bt-tl-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bt-gray-700);
    word-break: break-word;
    line-height: 1.4;
}

/* ── Stop meta (student count + amount) ── */
.bt-timeline .bt-tl-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.bt-timeline .bt-tl-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bt-purple);
    background: var(--bt-purple-light, #f1e9ff);
    border-radius: 999px;
    padding: 2px 10px;
}

.bt-timeline .bt-tl-amount {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bt-gray-500, #6b7280);
    background: var(--bt-gray-100);
    border-radius: 999px;
    padding: 2px 10px;
}

/* ── Passed / current / upcoming stop states ── */
.bt-timeline .bt-tl-stop.passed {
    opacity: 0.45;
}

.bt-timeline .bt-tl-stop.current .bt-tl-dot {
    border-color: var(--bt-purple);
    background: var(--bt-purple);
    box-shadow: 0 0 0 4px var(--bt-purple-light, #f1e9ff);
}

.bt-timeline .bt-tl-stop.current .bt-tl-name {
    color: var(--bt-purple);
    font-weight: 700;
}

/* ── Route / Direction Selector ── */
.bt-route-selector {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.bt-route-selector .bt-route-selector-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--bt-gray-100);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--bt-gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bt-route-selector .bt-route-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 20px 24px;
}

.bt-route-selector .bt-route-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    padding: 16px;
    border: 1.5px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.bt-route-selector .bt-route-option:hover {
    border-color: var(--bt-purple);
}

.bt-route-selector .bt-route-option.selected {
    border-color: var(--bt-purple);
    background: var(--bt-purple-light, #f1e9ff);
    box-shadow: 0 0 0 3px var(--bt-purple-light, #f1e9ff);
}

.bt-route-selector .bt-route-option-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--bt-gray-900);
}

.bt-route-selector .bt-route-option-sub {
    font-size: 0.8rem;
    color: var(--bt-gray-500, #6b7280);
}

/* ── Map Container ── */
.bt-map-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 380px;
    background: var(--bt-gray-100);
    border-radius: var(--bt-radius-sm);
    overflow: hidden;
    border: 1px solid var(--bt-gray-200);
}

.bt-map-wrapper #bus-map {
    width: 100%;
    height: 100%;
}

/* Map placeholder */
.bt-map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 380px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #faf9ff 100%);
    text-align: center;
    padding: 40px;
}

.bt-map-placeholder .bt-mp-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.bt-map-placeholder .bt-mp-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bt-gray-700);
    margin-bottom: 6px;
}

.bt-map-placeholder .bt-mp-sub {
    font-size: 0.85rem;
    color: var(--bt-gray-400);
    max-width: 280px;
}

.bt-map-placeholder .bt-mp-dots {
    display: flex;
    gap: 6px;
    margin-top: 20px;
}

.bt-map-placeholder .bt-mp-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bt-purple);
    opacity: 0.3;
    animation: bt-dot-pulse 1.4s ease-in-out infinite;
}

.bt-map-placeholder .bt-mp-dots span:nth-child(2) { animation-delay: 0.2s; }
.bt-map-placeholder .bt-mp-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bt-dot-pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.3); }
}

/* Connection badge */
.bt-conn-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(255,255,255,0.95);
    box-shadow: var(--bt-shadow-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    backdrop-filter: blur(8px);
}

.bt-conn-badge .bt-cb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.bt-conn-badge.live .bt-cb-dot { background: var(--bt-green); }
.bt-conn-badge.connecting .bt-cb-dot { background: var(--bt-amber); animation: bt-pulse 1.2s ease-in-out infinite; }
.bt-conn-badge.disconnected .bt-cb-dot { background: var(--bt-red); }

/* ── Info Panel Cards ── */
.bt-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.bt-info-card {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius-sm);
    box-shadow: var(--bt-shadow-sm);
    overflow: hidden;
}

.bt-info-card .bt-ic-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--bt-gray-100);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--bt-gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bt-info-card .bt-ic-body {
    padding: 16px 20px;
}

.bt-info-card .bt-ic-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--bt-gray-50);
}

.bt-info-card .bt-ic-row:last-child {
    border-bottom: none;
}

.bt-info-card .bt-ic-label {
    font-size: 0.8rem;
    color: var(--bt-gray-400);
}

.bt-info-card .bt-ic-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bt-gray-900);
}

/* ── Feature Cards ── */
.bt-features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 24px;
}

.bt-feature-card {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius-sm);
    padding: 20px;
    text-align: center;
    box-shadow: var(--bt-shadow-sm);
    transition: box-shadow var(--bt-transition);
}

.bt-feature-card:hover {
    box-shadow: var(--bt-shadow);
}

.bt-feature-card .bt-fc-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin: 0 auto 12px;
}

.bt-feature-card .bt-fc-icon.track { background: var(--bt-purple-light); color: var(--bt-purple); }
.bt-feature-card .bt-fc-icon.route { background: var(--bt-amber-light); color: var(--bt-amber); }
.bt-feature-card .bt-fc-icon.safe { background: var(--bt-green-light); color: var(--bt-green); }
.bt-feature-card .bt-fc-icon.alert { background: var(--bt-blue-light); color: var(--bt-blue); }

.bt-feature-card .bt-fc-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bt-gray-900);
    margin-bottom: 4px;
}

.bt-feature-card .bt-fc-desc {
    font-size: 0.75rem;
    color: var(--bt-gray-400);
    line-height: 1.4;
}

/* ── State Cards (loading/empty/error) ── */
.bt-state {
    text-align: center;
    padding: 48px 24px;
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow-sm);
}

.bt-state .bt-state-icon {
    font-size: 2.8rem;
    margin-bottom: 16px;
    display: block;
}

.bt-state .bt-state-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bt-gray-900);
    margin-bottom: 8px;
}

.bt-state .bt-state-msg {
    font-size: 0.9rem;
    color: var(--bt-gray-400);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.5;
}

.bt-state.loading .bt-state-icon {
    animation: bt-spin 1.2s linear infinite;
}

@keyframes bt-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bt-state.error {
    border-color: #fecaca;
    background: #fef2f2;
}

.bt-state.error .bt-state-title { color: var(--bt-red); }

.bt-state.empty {
    background: var(--bt-gray-50);
}

/* ── GPS Location ── */
.bt-location-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.bt-location-item {
    background: var(--bt-gray-50);
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius-sm);
    padding: 16px;
    text-align: center;
}

.bt-location-item .bt-loc-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bt-gray-400);
    font-weight: 700;
    margin-bottom: 6px;
}

.bt-location-item .bt-loc-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bt-gray-900);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Footer ── */
.bt-footer {
    background: #0f0f23;
    color: #a0a0b8;
    padding: 48px 0 32px;
    margin-top: 0;
    position: relative;
    overflow: hidden;
}

.bt-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--bt-purple), #a78bfa, var(--bt-purple));
}

.bt-footer .bt-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.bt-footer .bt-footer-brand {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}

.bt-footer .bt-footer-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    max-width: 300px;
}

.bt-footer h5 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
    font-weight: 700;
    margin-bottom: 16px;
}

.bt-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bt-footer ul li {
    margin-bottom: 8px;
}

.bt-footer ul li a {
    color: #a0a0b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.bt-footer ul li a:hover {
    color: #fff;
}

.bt-footer .bt-footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 32px;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    flex-wrap: wrap;
    gap: 12px;
}

.bt-footer .bt-footer-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bt-footer .bt-footer-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bt-green);
}

/* ── Responsive ── */
@media (max-width: 1199px) {
    .bt-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991px) {
    .bt-hero .bt-hero-title {
        font-size: 1.8rem;
    }

    .bt-summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .bt-two-col {
        grid-template-columns: 1fr;
    }

    .bt-route-selector .bt-route-options {
        grid-template-columns: 1fr;
    }

    .bt-trip-card .bt-trip-body {
        gap: 20px;
    }

    .bt-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bt-footer .bt-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

@media (max-width: 767px) {
    .bt-hero {
        padding: 36px 0 32px;
    }

    .bt-hero .bt-hero-title {
        font-size: 1.5rem;
    }

    .bt-hero .bt-hero-subtitle {
        font-size: 0.9rem;
    }

    .bt-summary-grid {
        grid-template-columns: 1fr;
    }

    .bt-trip-card .bt-trip-body {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .bt-trip-status-circle {
        align-self: center;
        width: 80px;
        height: 80px;
    }

    .bt-trip-actions {
        flex-direction: row;
    }

    .bt-trip-actions .bt-btn {
        flex: 1;
        min-width: 0;
    }

    .bt-info-grid {
        grid-template-columns: 1fr;
    }

    .bt-features-grid {
        grid-template-columns: 1fr 1fr;
    }

    .bt-location-grid {
        grid-template-columns: 1fr;
    }

    .bt-footer .bt-footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .bt-footer .bt-footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 575px) {
    .bt-hero {
        padding: 28px 0 24px;
    }

    .bt-hero .bt-hero-title {
        font-size: 1.3rem;
    }

    .bt-content {
        padding: 20px 0 40px;
    }

    .bt-trip-actions {
        flex-direction: column;
    }

    .bt-features-grid {
        grid-template-columns: 1fr;
    }

    .bt-section .bt-section-body {
        padding: 16px;
    }
}

/* ============================================
   Bus Tracking — Live Map + Components
   ============================================ */

/* ── Map page hero ── */
.bt-map-page {
    min-height: 100vh;
}

.bt-map-hero {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 40%, #faf9ff 100%);
    border-bottom: 1px solid var(--bt-gray-200);
    padding: 28px 0 20px;
}

.bt-map-hero-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.bt-map-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--bt-gray-900);
    letter-spacing: -0.02em;
    margin: 0 0 4px;
}

.bt-map-subtitle {
    font-size: 0.95rem;
    color: var(--bt-gray-500);
    margin: 0;
}

.bt-map-hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bt-live-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--bt-gray-700);
    box-shadow: var(--bt-shadow-sm);
}

.bt-live-count-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bt-green);
    animation: bt-pulse 2s ease-in-out infinite;
}

/* ── Filters ── */
.bt-filters {
    max-width: 1400px;
    margin: 16px auto 0;
    padding: 0 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bt-filter-chip {
    border: 1px solid var(--bt-gray-200);
    background: #fff;
    color: var(--bt-gray-700);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--bt-transition);
}

.bt-filter-chip:hover {
    border-color: var(--bt-purple);
    color: var(--bt-purple);
}

.bt-filter-chip.selected {
    background: var(--bt-purple);
    border-color: var(--bt-purple);
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

/* Staff live map: constrain the hero (title + meta), the LIVE/HISTORY switch,
   and the filter chips to the same centered content width as the tracking cards
   below. This matches the Student page's compact centered composition instead of
   stretching the top controls across the whole viewport. */
.bt-map-page .bt-map-hero-inner,
.bt-map-page .bt-filters {
    max-width: 900px;
}
.bt-map-page .bt-mode-switch {
    display: flex;
    width: fit-content;
    margin: 14px auto 0;
}

/* ── Map layout ── */
.bt-map-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 20px;
    align-items: start;
}

.bt-map-main {
    min-width: 0;
}

.bt-map-wrapper {
    position: relative;
    width: 100%;
    height: 58vh;
    min-height: 420px;
    border-radius: var(--bt-radius);
    overflow: hidden;
    border: 1px solid var(--bt-gray-200);
    box-shadow: var(--bt-shadow);
    background: var(--bt-gray-100);
}

.bt-map-wrapper #bus-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.bt-map-conn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
}

.bt-map-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #faf9ff 100%);
    color: var(--bt-gray-500);
    font-size: 0.85rem;
    font-weight: 600;
}

.bt-map-loading-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--bt-purple-light);
    border-top-color: var(--bt-purple);
    animation: bt-spin 0.8s linear infinite;
}

@keyframes bt-spin {
    to { transform: rotate(360deg); }
}

/* ── Map controls ── */
.bt-map-controls {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bt-mc-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--bt-shadow);
    overflow: hidden;
    border: 1px solid var(--bt-gray-200);
}

.bt-mc-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: none;
    color: var(--bt-gray-700);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--bt-transition), color var(--bt-transition);
}

.bt-mc-btn + .bt-mc-btn {
    border-top: 1px solid var(--bt-gray-100);
}

.bt-mc-btn:hover {
    background: var(--bt-purple-light);
    color: var(--bt-purple);
}

/* ── Map fallback ── */
.bt-map-fallback {
    height: 58vh;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bt-gray-50);
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
}

/* ── Markers ── */
.bt-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
    transition: transform var(--bt-transition);
}

.bt-marker:hover {
    transform: scale(1.08);
}

.bt-marker-pin svg {
    display: block;
}

.bt-marker-rotate {
    transition: transform 0.25s ease;
    transform-origin: center;
}

.bt-marker-pin svg path {
    transition: fill var(--bt-transition);
}

.bt-marker-label {
    margin-top: 2px;
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    color: var(--bt-gray-900);
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: var(--bt-shadow-sm);
}

.bt-marker.selected .bt-marker-pin svg path {
    fill: var(--bt-green);
}

.bt-marker.selected .bt-marker-label {
    background: var(--bt-green);
    border-color: var(--bt-green);
    color: #fff;
}

/* ── Connection pill ── */
.bt-conn-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--bt-gray-700);
    box-shadow: var(--bt-shadow-sm);
}

.bt-conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.bt-conn-pill.live .bt-conn-dot {
    background: var(--bt-green);
}

.bt-conn-pill.connecting .bt-conn-dot {
    background: var(--bt-amber);
    animation: bt-pulse 1.2s ease-in-out infinite;
}

.bt-conn-pill.disconnected .bt-conn-dot {
    background: var(--bt-red);
}

/* ── Status badge ── */
.bt-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
}

.bt-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.bt-status-badge.live {
    background: var(--bt-green-light);
    color: var(--bt-green);
}
.bt-status-badge.live .bt-status-dot {
    background: var(--bt-green);
}

.bt-status-badge.offline {
    background: var(--bt-red-light);
    color: var(--bt-red);
}
.bt-status-badge.offline .bt-status-dot {
    background: var(--bt-red);
}

.bt-status-badge.idle {
    background: var(--bt-amber-light);
    color: var(--bt-amber);
}
.bt-status-badge.idle .bt-status-dot {
    background: var(--bt-amber);
}

/* ── Side panel ── */
.bt-map-side {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 58vh;
}

.bt-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--bt-gray-100);
}

.bt-side-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--bt-gray-900);
}

.bt-side-count {
    background: var(--bt-purple-light);
    color: var(--bt-purple);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
}

.bt-bus-list {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

.bt-bus-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: var(--bt-gray-50);
    border: 1px solid var(--bt-gray-200);
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all var(--bt-transition);
}

.bt-bus-card:hover {
    border-color: var(--bt-purple);
    background: var(--bt-purple-bg);
}

.bt-bus-card.selected {
    border-color: var(--bt-purple);
    background: var(--bt-purple-light);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.bt-bus-card-icon {
    font-size: 1.3rem;
}

.bt-bus-card-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bt-bus-card-number {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--bt-gray-900);
}

.bt-bus-card-route {
    font-size: 0.75rem;
    color: var(--bt-gray-500);
}

.bt-bus-card-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.bt-bus-card-speed {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--bt-gray-700);
}

.bt-side-details {
    border-top: 1px solid var(--bt-gray-100);
    padding: 16px 18px;
}

/* ── Bus details ── */
.bt-bus-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bt-bd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bt-bd-bus {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bt-bd-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bt-purple-light);
    border-radius: 12px;
    font-size: 1.3rem;
}

.bt-bd-number {
    font-size: 1rem;
    font-weight: 800;
    color: var(--bt-gray-900);
}

.bt-bd-name {
    font-size: 0.78rem;
    color: var(--bt-gray-500);
}

.bt-bd-route {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bt-gray-50);
    border: 1px solid var(--bt-gray-200);
    border-radius: 10px;
    padding: 8px 12px;
}

.bt-bd-route-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bt-gray-400);
}

.bt-bd-route-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bt-gray-900);
}

.bt-bd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bt-bd-item {
    background: var(--bt-gray-50);
    border: 1px solid var(--bt-gray-200);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bt-bd-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bt-gray-400);
}

.bt-bd-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bt-gray-900);
}

.bt-bd-updated {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--bt-gray-500);
}

.bt-bd-updated-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bt-green);
}

.bt-bd-center {
    width: 100%;
}

.bt-bus-details-empty {
    align-items: center;
    text-align: center;
    padding: 20px 0;
}

.bt-bd-empty-icon {
    font-size: 2rem;
    opacity: 0.5;
}

.bt-bd-empty-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--bt-gray-700);
}

.bt-bd-empty-msg {
    font-size: 0.8rem;
    color: var(--bt-gray-400);
    max-width: 220px;
}

/* ── Bottom sheet (mobile) ── */
.bt-bottom-sheet {
    display: none;
}

/* ── Loading skeletons ── */
.bt-loading {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bt-skeleton-card {
    height: 120px;
    border-radius: var(--bt-radius-sm);
    background: linear-gradient(90deg, var(--bt-gray-100) 25%, var(--bt-gray-200) 50%, var(--bt-gray-100) 75%);
    background-size: 200% 100%;
    animation: bt-shimmer 1.4s ease-in-out infinite;
}

.bt-skeleton-block {
    height: 180px;
    border-radius: var(--bt-radius-sm);
    background: linear-gradient(90deg, var(--bt-gray-100) 25%, var(--bt-gray-200) 50%, var(--bt-gray-100) 75%);
    background-size: 200% 100%;
    animation: bt-shimmer 1.4s ease-in-out infinite;
}

.bt-loading-map {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
}

.bt-skeleton-map {
    height: 72vh;
    min-height: 480px;
    border-radius: var(--bt-radius);
    background: linear-gradient(90deg, var(--bt-gray-100) 25%, var(--bt-gray-200) 50%, var(--bt-gray-100) 75%);
    background-size: 200% 100%;
    animation: bt-shimmer 1.4s ease-in-out infinite;
}

.bt-skeleton-panel {
    height: 72vh;
    min-height: 480px;
    border-radius: var(--bt-radius);
    background: linear-gradient(90deg, var(--bt-gray-100) 25%, var(--bt-gray-200) 50%, var(--bt-gray-100) 75%);
    background-size: 200% 100%;
    animation: bt-shimmer 1.4s ease-in-out infinite;
}

@keyframes bt-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Trip controls ── */
.bt-trip-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.bt-trip-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
}

.bt-trip-state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.bt-trip-state.ready {
    background: var(--bt-gray-100);
    color: var(--bt-gray-700);
}
.bt-trip-state.ready .bt-trip-state-dot { background: var(--bt-gray-400); }

.bt-trip-state.starting {
    background: var(--bt-amber-light);
    color: var(--bt-amber);
}
.bt-trip-state.starting .bt-trip-state-dot { background: var(--bt-amber); animation: bt-pulse 1s ease-in-out infinite; }

.bt-trip-state.active {
    background: var(--bt-green-light);
    color: var(--bt-green);
}
.bt-trip-state.active .bt-trip-state-dot { background: var(--bt-green); animation: bt-pulse 1.6s ease-in-out infinite; }

.bt-trip-state.stopping {
    background: var(--bt-amber-light);
    color: var(--bt-amber);
}
.bt-trip-state.stopping .bt-trip-state-dot { background: var(--bt-amber); animation: bt-pulse 1s ease-in-out infinite; }

.bt-trip-state.completed {
    background: var(--bt-green-light);
    color: var(--bt-green);
}
.bt-trip-state.completed .bt-trip-state-dot { background: var(--bt-green); }

.bt-trip-done {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bt-green);
}

/* ── Location panel ── */
.bt-location-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bt-gps-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    align-self: flex-start;
}

.bt-gps-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.bt-gps-status.receiving {
    background: var(--bt-green-light);
    color: var(--bt-green);
}
.bt-gps-status.receiving .bt-gps-dot { background: var(--bt-green); animation: bt-pulse 1.6s ease-in-out infinite; }

.bt-gps-status.waiting {
    background: var(--bt-amber-light);
    color: var(--bt-amber);
}
.bt-gps-status.waiting .bt-gps-dot { background: var(--bt-amber); animation: bt-pulse 1.2s ease-in-out infinite; }

.bt-gps-status.unavailable {
    background: var(--bt-red-light);
    color: var(--bt-red);
}
.bt-gps-status.unavailable .bt-gps-dot { background: var(--bt-red); }

/* ── Trip summary ── */
.bt-summary-complete {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
    padding: 32px;
}

.bt-summary-complete-icon {
    font-size: 2.6rem;
    margin-bottom: 8px;
}

.bt-summary-complete-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--bt-gray-900);
    margin-bottom: 4px;
}

.bt-summary-complete-sub {
    font-size: 0.9rem;
    color: var(--bt-gray-500);
    margin-bottom: 20px;
}

.bt-summary-table {
    text-align: left;
    border: 1px solid var(--bt-gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.bt-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    font-size: 0.85rem;
}

.bt-summary-row + .bt-summary-row {
    border-top: 1px solid var(--bt-gray-100);
}

.bt-summary-row span {
    color: var(--bt-gray-500);
}

.bt-summary-row strong {
    color: var(--bt-gray-900);
}

/* ── Secondary button ── */
.bt-btn-secondary {
    background: #fff;
    color: var(--bt-purple);
    border: 1px solid var(--bt-purple);
}

.bt-btn-secondary:hover {
    background: var(--bt-purple-light);
}

/* ── Trip summary actions ── */
.bt-summary-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--bt-gray-200);
}

.bt-summary-action {
    width: 100%;
    justify-content: center;
}

.bt-summary-actions .bt-btn-start {
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

/* ── Responsive: tablet & mobile ── */
@media (max-width: 991px) {
    .bt-map-layout {
        grid-template-columns: 1fr;
    }

    .bt-map-side {
        display: none;
    }

    .bt-bottom-sheet {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        background: #fff;
        border-top: 1px solid var(--bt-gray-200);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
        padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .bt-bottom-sheet.collapsed {
        max-height: 120px;
    }
    .bt-bottom-sheet.expanded {
        max-height: 46vh;
        overflow-y: auto;
    }

    .bt-sheet-handle {
        display: block;
        width: 100%;
        background: transparent;
        border: none;
        padding: 6px 0 10px;
        cursor: pointer;
    }
    .bt-sheet-handle-bar {
        width: 40px;
        height: 4px;
        border-radius: 4px;
        background: var(--bt-gray-300);
        margin: 0 auto;
    }

    .bt-map-wrapper,
    .bt-map-fallback,
    .bt-skeleton-map {
        height: 52vh;
        min-height: 360px;
    }

    .bt-loading-map {
        grid-template-columns: 1fr;
    }

    .bt-skeleton-panel {
        display: none;
    }

    .bt-map-hero-inner,
    .bt-filters {
        padding-left: 16px;
        padding-right: 16px;
    }

    .bt-map-layout {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (max-width: 575px) {
    .bt-map-title {
        font-size: 1.35rem;
    }

    .bt-map-hero-meta {
        width: 100%;
        justify-content: space-between;
    }

    .bt-map-wrapper,
    .bt-map-fallback,
    .bt-skeleton-map {
        height: 48vh;
        min-height: 320px;
    }

    .bt-bottom-sheet.expanded {
        max-height: 50vh;
    }

    .bt-trip-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .bt-trip-state {
        align-self: flex-start;
    }
}

/* ============================================
   Bus Tracking — Dev mode + Parent/Student
   ============================================ */

/* ── Dev-mode indicator ── */
.bt-dev-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bt-amber-light);
    color: var(--bt-amber);
    border: 1px solid rgba(217, 119, 6, 0.25);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.bt-dev-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bt-amber);
    animation: bt-pulse 1.6s ease-in-out infinite;
}

/* ── Map toast (non-blocking location message) ── */
.bt-map-toast {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 20;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: var(--bt-shadow);
    white-space: nowrap;
    animation: bt-toast-in 0.25s ease;
}

@keyframes bt-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Parent / Student page ── */
.bt-parent-layout {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bt-parent-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.bt-child-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow-sm);
    padding: 18px;
}

.bt-child-avatar {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bt-purple-light);
    border-radius: 50%;
    font-size: 1.6rem;
}

.bt-child-info {
    display: flex;
    flex-direction: column;
}

.bt-child-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--bt-gray-900);
}

.bt-child-class {
    font-size: 0.82rem;
    color: var(--bt-gray-500);
}

.bt-assigned-card {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow-sm);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bt-assigned-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bt-gray-400);
}

.bt-assigned-bus {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bt-assigned-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bt-purple-light);
    border-radius: 10px;
    font-size: 1.2rem;
}

.bt-assigned-number {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--bt-gray-900);
}

.bt-assigned-route {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bt-gray-700);
}

.bt-parent-map .bt-map-wrapper {
    height: 58vh;
    min-height: 420px;
}

.bt-parent-map #parent-bus-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.bt-parent-sheet {
    background: #fff;
    border: 1px solid var(--bt-gray-200);
    border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow);
    padding: 16px 18px;
}

.bt-parent-sheet .bt-sheet-handle {
    display: none;
}

.bt-parent-sheet-summary {
    display: none;
}

/* ── Bus selector chips (shared desktop + mobile) ── */
.bt-sheet-buses {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--bt-gray-100);
}

.bt-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    border: 1px solid var(--bt-gray-200);
    background: #fff;
    color: var(--bt-gray-700);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: var(--bt-shadow-sm);
    transition: all var(--bt-transition);
}

.bt-chip:hover {
    border-color: var(--bt-purple);
    color: var(--bt-purple);
}

.bt-chip.selected {
    background: var(--bt-purple);
    border-color: var(--bt-purple);
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.bt-chip.selected .bt-chip-dot {
    background: #fff;
}

.bt-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.bt-chip-dot.live { background: var(--bt-green); }
.bt-chip-dot.offline { background: var(--bt-red); }
.bt-chip-dot.idle { background: var(--bt-amber); }

/* Keep the bus selector compact and scrollable when there are many buses,
   so it never pushes the details too far down on small screens. */
@media (max-width: 767px) {
    .bt-sheet-buses {
        max-height: 150px;
        overflow-y: auto;
    }
}


/* ── Parent responsive ── */
@media (max-width: 767px) {
    .bt-parent-cards {
        grid-template-columns: 1fr;
    }

    .bt-parent-layout {
        padding-left: 16px;
        padding-right: 16px;
    }

    .bt-parent-map .bt-map-wrapper {
        height: 50vh;
        min-height: 340px;
    }

    .bt-parent-sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
        padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .bt-parent-sheet.collapsed {
        max-height: 120px;
    }
    .bt-parent-sheet.expanded {
        max-height: 44vh;
        overflow-y: auto;
    }

    /* Staff live map: keep the bus list + details in normal document flow on
       mobile (NOT a fixed bottom sheet like the Student page), so resizing the
       viewport (e.g. docking DevTools) never clips or collapses the bus list. */
    .bt-staff-live-layout .bt-parent-sheet {
        position: static;
        border-radius: var(--bt-radius);
        box-shadow: var(--bt-shadow-sm);
        padding: 16px 18px;
        overflow: visible;
        max-height: none;
    }

    .bt-parent-sheet .bt-sheet-handle {
        display: block;
        width: 100%;
        background: transparent;
        border: none;
        padding: 6px 0 10px;
        cursor: pointer;
    }
    .bt-parent-sheet .bt-sheet-handle-bar {
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 4px;
        background: var(--bt-gray-300);
        margin: 0 auto;
    }

    .bt-parent-sheet-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 4px 0 8px;
    }
    .bt-parent-sheet-bus {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--bt-gray-900);
    }

    .bt-parent-layout.sheet-collapsed {
        padding-bottom: 120px;
    }
    .bt-parent-layout.sheet-expanded {
        padding-bottom: 44vh;
    }
}

/* ==========================================================================
   Historical tracking — LIVE/HISTORY mode switch + trip selection UI
   ========================================================================== */

.bt-mode-switch {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    background: var(--bt-gray-100, #f3f4f6);
    border-radius: 10px;
    margin-top: 14px;
}

.bt-mode-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--bt-gray-700, #374151);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.bt-mode-btn.active {
    background: #7c3aed;
    color: #fff;
}

.bt-history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-top: 14px;
}

.bt-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

.bt-filter label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bt-gray-700, #374151);
}

.bt-filter select,
.bt-filter input {
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--bt-gray-200, #d1d5db);
    border-radius: 8px;
    color: var(--bt-gray-900, #111827);
    background: #fff;
}

.bt-btn {
    padding: 10px 16px;
    border: 1px solid var(--bt-gray-200, #d1d5db);
    border-radius: 8px;
    background: #fff;
    color: var(--bt-gray-700, #374151);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.bt-btn:hover {
    background: var(--bt-gray-100, #f3f4f6);
}

.bt-history-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    flex: 1;
    min-height: 0;
}

.bt-history-status {
    padding: 14px 16px;
    border: 1px dashed var(--bt-gray-200, #d1d5db);
    border-radius: 8px;
    color: var(--bt-gray-500, #6b7280);
    font-size: 0.9rem;
}

.bt-history-status.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.bt-trip-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.bt-trip-item {
    border: 1px solid var(--bt-gray-200, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bt-trip-item:hover {
    border-color: #7c3aed;
}

.bt-trip-item.selected {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Scoped to `.bt-trip-item` so it does NOT collide with the driver page's
   `.bt-trip-card` (a large summary card that uses `overflow: hidden`,
   `box-shadow` and `margin-bottom`). The history trip header is a plain
   transparent button inside `.bt-trip-item`. */
.bt-trip-item .bt-trip-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    margin: 0;
    overflow: visible;
    color: var(--bt-gray-900, #111827);
    font: inherit;
    text-align: left;
    cursor: pointer;
    position: relative;
    -webkit-appearance: none;
    appearance: none;
}

.bt-trip-chevron {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--bt-gray-400, #9ca3af);
    font-size: 0.9rem;
    line-height: 1;
}

.bt-trip-name {
    font-weight: 700;
    color: var(--bt-gray-900, #111827);
    font-size: 0.95rem;
    line-height: 1.3;
}

.bt-trip-meta {
    color: var(--bt-gray-500, #6b7280);
    font-size: 0.82rem;
    line-height: 1.4;
}

.bt-trip-distance {
    color: #7c3aed;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
}

.bt-trip-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--bt-gray-100, #f3f4f6);
    background: var(--bt-gray-50, #f9fafb);
}

.bt-trip-details.collapsed {
    display: none;
}

/* Desktop: trip details stay visible; no collapse on large screens. */
@media (min-width: 992px) {
    .bt-trip-details.collapsed {
        display: flex;
    }
    .bt-trip-chevron {
        display: none;
    }
}

.bt-details-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--bt-gray-900, #111827);
}

.bt-details-row span:first-child {
    color: var(--bt-gray-500, #6b7280);
}

.bt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--bt-gray-100, #f3f4f6);
    margin-top: 4px;
}

.bt-legend-item {
    font-size: 0.85rem;
    font-weight: 600;
}

.bt-legend-item.master {
    color: var(--bt-gray-500, #6b7280);
}

.bt-legend-item.actual {
    color: #2563eb;
}

/* ── Map legend overlay (live map) ── */
.bt-map-legend {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--bt-gray-200);
    border-radius: 8px;
    font-size: 0.72rem;
    color: var(--bt-gray-700);
    box-shadow: var(--bt-shadow-sm);
}

.bt-map-legend .bt-legend-item {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bt-gray-700);
}

.bt-legend-item.live-master::before {
    content: "";
    width: 22px;
    height: 3px;
    border-radius: 2px;
    background: #7c3aed;
}

.bt-legend-item.bus::before {
    content: "🚌";
    font-size: 0.9rem;
}

.bt-route-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 575.98px) {
    .bt-history-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .bt-filter {
        min-width: 0;
    }

    .bt-mode-btn {
        flex: 1 1 auto;
        min-height: 44px;
    }

    .bt-btn {
        min-height: 44px;
    }
}
