* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    padding: 20px;
}

/* SEO-focused header */
.app-header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.app-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.app-header p {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto;
    padding: 0 80px;
}

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

.main-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    min-height: 400px;
    position: relative;
}

.route-info {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.route-info h2 {
    color: #667eea;
    margin-bottom: 5px;
    font-size: 1.2rem;
    padding-right: 120px; /* Space for buttons */
    word-wrap: break-word;
    line-height: 1.3;
}

.route-info p {
    color: #666;
    font-size: 0.9rem;
    padding-right: 120px; /* Space for buttons */
    word-wrap: break-word;
    line-height: 1.4;
}

.detours-warning {
    margin-top: 8px;
    color: #d68910;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.detours-warning:hover {
    color: #b7950b;
}

.route-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: flex-start;
}

.action-button {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid #667eea;
    color: #667eea;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 42px;
    max-width: 42px;
    width: 42px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    box-sizing: border-box;
    flex-shrink: 0;
    margin: 0;
}

.action-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

.action-button:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

.action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Error state for refresh button - exact same dimensions */
.action-button.error {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 6px 10px;
    border-radius: 8px;
    min-width: 42px;
    max-width: 42px;
    width: 42px;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    margin: 0;
    box-sizing: border-box;
}

.action-button.error:hover {
    background: rgba(220, 53, 69, 0.2);
    transform: translateY(-1px);
}

.refresh-countdown {
    font-size: 0.65rem;
    line-height: 1.2;
    opacity: 0.8;
    white-space: nowrap;
    margin-top: 2px;
    color: inherit;
}

.bus-list {
    padding: 20px;
}

.bus-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    margin-bottom: 12px;
    background: white;
    border: 2px solid #f1f3f4;
    border-radius: 15px;
    transition: all 0.3s ease;
    gap: 15px;
}

.bus-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.bus-info {
    flex: 1;
    min-width: 0;
}

.bus-number {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.bus-details {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
}

.destination-line {
    margin-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.next-stop-line {
    margin-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.arrival-container {
    text-align: right;
    min-width: 80px;
    flex-shrink: 0;
}

.arrival-time {
    font-size: 1.4rem;
    font-weight: 700;
    color: #28a745;
    margin-bottom: 4px;
}

.arrival-time.late {
    color: #dc3545;
}

.distance {
    font-size: 0.75rem;
    color: #999;
}

.occupancy {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 4px;
}

.occupancy.empty { background: #d4edda; color: #155724; }
.occupancy.few { background: #fff3cd; color: #856404; }
.occupancy.many { background: #cce5ff; color: #004085; }
.occupancy.full { background: #f8d7da; color: #721c24; }
.occupancy.standing { background: #d1ecf1; color: #0c5460; }
.occupancy.crushed { background: #f5c6cb; color: #721c24; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading, .error {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border-radius: 10px;
    margin: 20px;
}

.refresh-info {
    text-align: center;
    padding: 15px 20px;
    color: #999;
    font-size: 0.8rem;
    border-top: 1px solid #f1f3f4;
    background: white;
    flex-shrink: 0;
}

.more-info-link {
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 5px;
}

.more-info-link:hover {
    color: #5a6fd8;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.3s;
    width: 100%;
}

.btn:hover {
    background: #5a6fd8;
}

/* Detours modal specific styles */
.detour-item {
    background: #fff8e1;
    border-left: 4px solid #f39c12;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.detour-header {
    font-weight: 600;
    color: #e67e22;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detour-direction {
    background: #f39c12;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.detour-reason {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.detour-dates {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
}

.detour-location {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
}

.detour-message {
    background: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
    border: 1px solid #f39c12;
}

/* Route history modal specific styles */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: #e9ecef;
}

.history-details {
    flex: 1;
}

.history-route {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 2px;
}

.history-stop {
    font-size: 0.85rem;
    color: #666;
}

.history-delete {
    color: #dc3545;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    font-size: 0.9rem;
}

.history-delete:hover {
    background: #f8d7da;
}

.no-history {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.faq-content {
    line-height: 1.6;
}

.faq-content h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.faq-content ul {
    list-style: none;
    padding: 0;
}

.faq-content li {
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
}

.faq-content li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}
.no-route .bus-list {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    position: relative;
}

.no-route .setup-button-center {
    background: #667eea;
    color: white;
    padding: 16px 32px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.no-route .setup-button-center:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* --- Tooltip Styles --- */
.tooltip-container {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    font-size: 11px;
    font-weight: bold;
    cursor: help;
    border: 1px solid #ced4da;
}

.tooltip-text {
    visibility: hidden;
    width: 240px;
    background-color: #343a40;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%; /* Position above the icon */
    left: 50%;
    margin-left: -120px; /* Center the tooltip */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
    font-weight: normal;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
        min-height: 100vh;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .app-header p {
        font-size: 0.9rem;
    }
    
    .route-actions {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    
    .action-button {
        padding: 5px 8px;
        min-width: 38px;
        height: 42px;
    }
    
    .action-button svg {
        width: 15px;
        height: 15px;
    }
    
    .refresh-countdown {
        font-size: 0.6rem;
        margin-top: 1px;
    }
}