/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: #212121;
    background-color: #fafafa;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
}

/* Header */
.header {
    background: #2196F3;
    color: white;
    padding: 16px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;
    text-align: left;
}

.subtitle {
    display: none;
}

/* Route Section */
.route-section {
    background: white;
    margin: 0;
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 64px;
    z-index: 90;
}

.route-header h2 {
    font-size: 1.2rem;
    color: #424242;
    margin: 0;
    font-weight: 500;
}

.route-info {
    text-align: right;
    font-size: 0.8rem;
    color: #757575;
}

.countdown-container {
    font-weight: 400;
    color: #616161;
}

.fetch-warning {
    display: none;
    color: #FF5722;
    font-size: 0.75rem;
    margin-top: 4px;
    padding: 4px 8px;
    background: rgba(255, 87, 34, 0.1);
    border-radius: 4px;
    border-left: 3px solid #FF5722;
}

.warning-icon {
    margin-right: 4px;
    font-size: 0.8rem;
}

/* Route Visualization */
.route-container {
    background: white;
    position: relative;
}

.route-stops {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.route-stop {
    display: flex;
    align-items: center;
    position: relative;
    min-height: 56px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.route-stop:hover {
    background: #f5f5f5;
}

.route-stop:last-child {
    border-bottom: none;
}

/* Stop markers removed for more compact design */

.stop-info {
    flex: 1;
    margin-left: 0;
    min-width: 0;
}

.stop-name {
    font-size: 0.9rem;
    color: #424242;
    font-weight: 400;
    line-height: 1.4;
}

.buses-at-stop {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: row;
    gap: 6px;
    z-index: 50;
    pointer-events: none;
}

.buses-between-stops {
    position: absolute;
    right: 20px;
    top: 100%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: row;
    gap: 6px;
    z-index: 50;
    pointer-events: none;
    opacity: 0.8;
}

/* Route connections removed for cleaner design */

/* Bus representation */
.bus-on-route {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 4px;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid #2196F3;
    transition: all 0.3s ease;
    pointer-events: all;
    cursor: pointer;
    gap: 3px;
    position: relative;
    z-index: 60;
}

.bus-on-route:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 70;
}

.bus-on-route.journey-start {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #ffffff 0%, #f1f8e9 100%);
}

.bus-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.8rem;
}

.bus-icon {
    font-size: 0.9rem;
}

.bus-occupancy-indicators {
    display: flex;
    gap: 1px;
    font-size: 0.5rem;
    line-height: 1;
}

.occupancy-person {
    color: #e0e0e0;
    transition: color 0.2s ease;
    font-size: 0.7rem;
}

.occupancy-person.filled-0 {
    color: #4CAF50;
}

.occupancy-person.filled-1 {
    color: #2196F3;
}

.occupancy-person.filled-2 {
    color: #FF9800;
}

.occupancy-person.filled-3 {
    color: #FF5722;
}

.occupancy-person.filled-4 {
    color: #F44336;
}

/* Occupancy colors for bus border */
.bus-on-route.occupancy-0 {
    border-color: #4CAF50;
}

.bus-on-route.occupancy-1 {
    border-color: #2196F3;
}

.bus-on-route.occupancy-2 {
    border-color: #FF9800;
}

.bus-on-route.occupancy-3 {
    border-color: #FF5722;
}

.bus-on-route.occupancy-4 {
    border-color: #F44336;
}


/* Error handling */
.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.error-icon {
    font-size: 2rem;
}

.error-details {
    flex: 1;
}

.error-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.error-text {
    font-size: 0.9rem;
}

.retry-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.retry-btn:hover {
    background: #c82333;
}

/* Debug section */
.debug-section {
    background: white;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
}

.debug-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

.debug-header h3 {
    display: none;
}

.debug-toggle-btn {
    background: transparent;
    color: #9e9e9e;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.debug-toggle-btn:hover {
    background: #f5f5f5;
    color: #757575;
}

.debug-content {
    font-size: 0.85rem;
    color: #616161;
}

.debug-summary {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    border-left: 4px solid #2196F3;
}

.debug-buses {
    max-height: 400px;
    overflow-y: auto;
}

.debug-bus-item {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
}

.debug-bus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.debug-bus-id {
    font-weight: 600;
    color: #333;
}

.debug-bus-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.debug-status-included {
    background: #d4edda;
    color: #155724;
}

.debug-status-excluded {
    background: #f8d7da;
    color: #721c24;
}

.debug-detail-group {
    margin-bottom: 8px;
}

.debug-detail-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.debug-detail-content {
    font-size: 0.75rem;
    color: #6c757d;
    line-height: 1.4;
}

.debug-direction-away {
    color: #28a745;
    font-weight: 500;
}

.debug-direction-toward {
    color: #dc3545;
    font-weight: 500;
}

.debug-direction-unknown {
    color: #6c757d;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .route-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 16px;
        top: 52px;
    }

    .route-info {
        text-align: left;
        font-size: 0.75rem;
    }
    
    .fetch-warning {
        font-size: 0.7rem;
        margin-top: 6px;
        padding: 3px 6px;
    }

    .route-stop {
        padding: 12px 16px;
        min-height: 48px;
    }

    .buses-at-stop {
        right: 16px;
    }

    .buses-between-stops {
        right: 16px;
    }
}

@media (max-width: 480px) {
    .bus-on-route {
        padding: 3px 6px;
        gap: 2px;
    }

    .bus-occupancy-indicators {
        font-size: 0.6rem;
    }

    .occupancy-person {
        font-size: 0.6rem;
    }
}