/**
 * OpenBus — compact dashboard layout (scoped to .openbus-tracker).
 * No viewport-fixed panels: toolbar, map, ETA, and status stay in one card.
 */

.openbus-tracker {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #4C5455;
    margin: 0 auto 1.25rem;
    max-width: 1200px;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.openbus-tracker *,
.openbus-tracker *::before,
.openbus-tracker *::after {
    box-sizing: border-box;
}

.openbus-dashboard {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Header: title + live status on one row */
.openbus-header {
    background: #4C5455;
    color: #fff;
    padding: 10px 14px;
}

.openbus-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.openbus-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.openbus-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    max-width: min(100%, 280px);
}

.openbus-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: openbus-pulse 2s infinite;
    flex-shrink: 0;
}

.openbus-status-dot.openbus-disconnected {
    background: #ef4444;
    animation: none;
}

.openbus-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes openbus-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* Toolbar: one compact row */
.openbus-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.openbus-control-btn {
    padding: 8px 14px;
    background: #F9DE25;
    color: #4C5455;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    min-height: 40px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

.openbus-control-btn:active {
    background: #e8cd15;
}

.openbus-control-btn.openbus-active {
    background: #636D6E;
    color: #fff;
}

.openbus-control-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.openbus-control-select {
    padding: 8px 32px 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #4C5455;
    cursor: pointer;
    font-size: 13px;
    min-height: 40px;
    min-width: 0;
    flex: 1 1 120px;
    max-width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234C5455' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.openbus-control-select:focus {
    outline: none;
    border-color: #F9DE25;
    box-shadow: 0 0 0 2px rgba(249, 222, 37, 0.35);
}

/* Map + ETA: column on small screens, row on wide */
.openbus-main {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.openbus-map-wrap {
    position: relative;
    min-height: 220px;
    width: 100%;
    background: #eef2f7;
    display: flex;
    flex-direction: column;
}

.openbus-map-canvas {
    flex: 1 1 auto;
    width: 100%;
    min-height: 200px;
    z-index: 1;
}

.openbus-eta-panel {
    padding: 12px 14px;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
}

.openbus-eta-panel__head {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 6px;
}

.openbus-eta-panel__body {
    font-size: 14px;
    line-height: 1.45;
    color: #374151;
}

/* Leaflet */
.openbus-tracker .leaflet-container {
    font-size: 13px;
    border-radius: 0;
}

.openbus-tracker .leaflet-popup-content {
    margin: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
}

/* Desktop: map left, ETA sidebar */
@media (min-width: 900px) {
    .openbus-main {
        flex-direction: row;
        align-items: stretch;
        min-height: min(58vh, 560px);
    }

    .openbus-map-wrap {
        flex: 1 1 0;
        min-width: 0;
        min-height: 360px;
        border-right: 1px solid #e5e7eb;
    }

    .openbus-eta-panel {
        flex: 0 0 260px;
        max-width: 280px;
        border-top: none;
        border-left: none;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .openbus-title {
        font-size: 1.15rem;
    }

    .openbus-control-btn:hover {
        background: #e8cd15;
    }
}

@media (min-width: 1100px) {
    .openbus-eta-panel {
        flex-basis: 280px;
    }
}
