:root {
    --kmb-red: #C8102E;
    --kmb-gold: #FFD700;
    --dark-bg: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-light: #ffffff;
    --text-secondary: #cccccc;
    --highlight: #4CAF50;
    --warning: #FF9800;
    --active-tab: #C8102E;
    --inactive-tab: #333;
    --route91m-color: #FF6B6B;
    --route91-color: #FF6B6B;
    --route91p-color: #FF6B6B;
    --route11-color: #9CEC5B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--dark-bg);
    color: var(--text-light);
    min-height: 100vh;
    padding: 20px;
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="%231a1a1a"/><path d="M0,0 L100,100 M100,0 L0,100" stroke="%23C8102E" stroke-width="1" opacity="0.1"/></svg>'));
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    padding: 30px 0 20px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--kmb-gold), #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

header p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 15px;
    color: var(--text-secondary);
}

.route-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 25px 0 15px; /* Increased bottom margin */
    flex-wrap: wrap;
    position: relative;
}

/* Horizontal divider between route tabs and direction tabs */
.route-tabs::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
}

.route-tab {
    background: var(--inactive-tab);
    color: var(--text-light);
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-width: 120px;
    justify-content: center;
}

.route-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.1) 50%);
    background-size: 400% 400%;
    transition: background-position 0.5s;
    z-index: -1;
}

.route-tab:hover::before {
    background-position: 100% 100%;
}

.route-tab.active {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.route-tab.active.route-91m {
    background: var(--route91m-color);
}

.route-tab.active.route-91 {
    background: var(--route91-color);
}

.route-tab.active.route-91p {
    background: var(--route91p-color);
}

.route-tab.active.route-11 {
    background: var(--route11-color);
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 20px; /* Adjusted margin */
    flex-wrap: wrap;
}

.tab {
    background: var(--inactive-tab);
    color: var(--text-light);
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    justify-content: center;
}

.tab.active {
    transform: translateY(-1px);
}

.route-91m .tab.active {
    background: var(--route91m-color);
}

.route-91 .tab.active {
    background: var(--route91-color);
}

.route-91p .tab.active {
    background: var(--route91p-color);
}

.route-11 .tab.active {
    background: var(--route11-color);
}

.tab:hover:not(.active) {
    background: #444;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 0 0 30px;
    flex-wrap: wrap;
}

.refresh-btn {
    background: var(--kmb-red);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.refresh-btn:hover {
    background: #e00e2f;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.last-updated {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stops-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.stop-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.stop-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
}

.route-91m .stop-card::before {
    background: var(--route91m-color);
}

.route-91 .stop-card::before {
    background: var(--route91-color);
}

.route-91p .stop-card::before {
    background: var(--route91p-color);
}

.route-11 .stop-card::before {
    background: var(--route11-color);
}

.stop-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.stop-header {
    background: var(--kmb-red);
    color: white;
    padding: 20px 20px 20px 30px;
    position: relative;
}

.route-label {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: bold;
}

.route-91m .route-label {
    background: var(--route91m-color);
}

.route-91 .route-label {
    background: var(--route91-color);
}

.route-91p .route-label {
    background: var(--route91p-color);
}

.route-11 .route-label {
    background: var(--route11-color);
}

.stop-name {
    font-size: 1.4rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stop-location {
    font-size: 0.9rem;
    opacity: 0.9;
    padding-left: 30px;
}

.eta-list {
    padding: 20px;
}

.eta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.eta-item:last-child {
    border-bottom: none;
}

.eta-time {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    width: 70%;
}

.eta-remark {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.eta-minutes {
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    min-width: 100px;
    text-align: center;
}

.eta-minutes.arriving {
    background: var(--highlight);
}

.eta-minutes.soon {
    background: var(--warning);
}

.eta-minutes.departed {
    background: #666;
}

.no-eta {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.loading {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--kmb-red);
    animation: spin 1.5s linear infinite;
}

.footer {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 40px;
    padding: 20px;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-info {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(200, 16, 46, 0.2);
    border-radius: 10px;
    max-width: 600px;
    margin: 0 auto 20px;
    font-size: 0.9rem;
}

.bus-icon {
    font-size: 1.5rem;
    margin-right: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .stops-container {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .route-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .route-tab {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .tab {
        width: 100%;
        border-radius: 30px;
        margin-bottom: 5px;
    }
    
    /* Adjust divider for mobile */
    .route-tabs::after {
        left: 10%;
        width: 80%;
    }
}