* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
    color: #1f2937;
    min-height: 100vh;
}

header {
    background: rgba(220, 38, 38, 0.95);
    backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 2em 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid #fbbf24;
}

h1 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

.header-link {
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.header-link:hover {
    opacity: 0.85;
}

.header-subtitle {
    margin: 0.5em 0 1em;
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Search functionality styles */
.search-container {
    position: relative;
    max-width: 400px;
    margin: 1.5em auto 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

#stationSearch {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    font-size: 16px;
    outline: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: #1f2937;
}

#stationSearch::placeholder {
    color: #6b7280;
    font-weight: 500;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

#stationSearch:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    border-color: #dc2626;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    color: #1f2937;
    border: 1px solid #e5e7eb;
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease;
    color: #1f2937;
}

.search-result-item:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-highlight {
    background-color: rgba(251, 191, 36, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.location-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #d1d5db;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.location-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #dc2626;
}

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

/* View toggle switch */
.view-toggle-container {
    display: flex;
    justify-content: center;
    margin: 1.5em auto 0;
    padding: 0 1em;
}

.view-toggle-label {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 3px;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.view-toggle-label:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #dc2626;
}

.view-option {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
    padding: 5px 10px;
    border-radius: 20px;
    min-width: 75px;
    justify-content: center;
}

.view-icon {
    font-size: 12px;
    filter: grayscale(0.5);
    transition: filter 0.3s ease;
}

/* Hide the checkbox */
#viewToggle {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider - now a white pill that moves */
.view-toggle-slider {
    position: absolute;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    left: 3px;
    top: 3px;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #dc2626;
}

/* Active state for map view (unchecked) */
.view-option[data-view="map"] {
    color: #dc2626;
}

.view-option[data-view="map"] .view-icon {
    filter: grayscale(0);
}

/* When checkbox is checked (image view) */
#viewToggle:checked~.view-toggle-slider {
    left: calc(50%);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
}

#viewToggle:checked~.view-option[data-view="map"] {
    color: #6b7280;
}

#viewToggle:checked~.view-option[data-view="map"] .view-icon {
    filter: grayscale(0.5);
}

#viewToggle:checked~.view-option[data-view="image"] {
    color: #dc2626;
}

#viewToggle:checked~.view-option[data-view="image"] .view-icon {
    filter: grayscale(0);
}

/* Default state (map view - unchecked) */
#viewToggle:not(:checked)~.view-option[data-view="image"] {
    color: #6b7280;
}

#viewToggle:not(:checked)~.view-option[data-view="image"] .view-icon {
    filter: grayscale(0.5);
}

/* City selector styles */
.city-selector {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 1.5em auto 0;
    padding: 0 1em;
    max-width: 800px;
}

.station-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #dc2626;
    border: 1px solid #dc2626;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.station-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.station-btn.active {
    background: #dc2626;
    color: #ffffff;
    border-color: #b91c1b;
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

/* Welcome section styles */
.welcome-section {
    background: rgba(255, 255, 255, 0.95);
    margin: 1.5em auto;
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 1200px;
    border: 1px solid #e5e7eb;
}

.welcome-content h2 {
    color: #dc2626;
    font-size: 1.8em;
    margin-bottom: 0.5em;
    text-align: center;
    font-weight: 600;
}

.welcome-content>p {
    color: #6b7280;
    text-align: center;
    font-size: 1em;
    margin-bottom: 1.5em;
}

.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1em;
}

.feature {
    background: rgba(255, 255, 255, 0.8);
    padding: 1.5em;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-color: #dc2626;
}

.feature-icon {
    font-size: 2.5em;
    margin-bottom: 0.8em;
    display: block;
}

.feature h3 {
    color: #dc2626;
    margin-bottom: 0.8em;
    font-weight: 600;
    font-size: 1.1em;
}

.feature p {
    color: #6b7280;
    line-height: 1.5;
    font-size: 0.9em;
    margin: 0;
}

/* System Map Section */
.system-map-section {
    background: rgba(255, 255, 255, 0.95);
    margin: 1.5em auto;
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 1200px;
    border: 1px solid #e5e7eb;
}

.system-map-container h2 {
    color: #dc2626;
    font-size: 1.8em;
    margin-bottom: 1em;
    text-align: center;
    font-weight: 600;
}

.system-map-figure {
    margin: 0;
    text-align: center;
}

.system-map-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.system-map-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #dc2626;
}

.system-map-figure figcaption {
    color: #6b7280;
    font-size: 0.95em;
    margin-top: 1em;
    font-style: italic;
}


/* Map display styles */
.map-display {
    background: rgba(255, 255, 255, 0.95);
    margin: 2em auto;
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 1000px;
    border: 1px solid #e5e7eb;
}

/* Google Maps view styles */
.map-view {
    background: rgba(255, 255, 255, 0.95);
    margin: 2em auto;
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 1000px;
    border: 1px solid #e5e7eb;
}

.map-view-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2em;
}

.google-map {
    width: 100%;
    height: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
    overflow: hidden;
}

.map-view-info {
    text-align: center;
    width: 100%;
}

.map-view-info h3 {
    color: #dc2626;
    font-size: 1.8em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.map-view-info p {
    color: #6b7280;
    font-size: 1.1em;
    line-height: 1.6;
}

.map-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2em;
}

.metro-map {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
}

.metro-map:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #dc2626;
}

.map-info {
    text-align: center;
    width: 100%;
}

.map-info h3 {
    color: #dc2626;
    font-size: 1.8em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.map-info p {
    color: #6b7280;
    font-size: 1.1em;
    line-height: 1.6;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.modal img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    cursor: default;
}

.modal h3 {
    color: #fff;
    margin: 1em 0 0.5em 0;
    font-size: 1.5em;
    text-align: center;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 38, 38, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid #dc2626;
}

#modalDescription {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin: 0.5em 0;
    font-size: 1em;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 38, 38, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid #dc2626;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(220, 38, 38, 0.9);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 1001;
    border: 1px solid #dc2626;
}

.close:hover {
    color: #fff;
    background: rgba(220, 38, 38, 0.8);
    transform: scale(1.1);
}

/* Fullscreen controls */
.fullscreen-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1001;
}

.fullscreen-btn {
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
    border: 1px solid #dc2626;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.fullscreen-btn:hover {
    background: rgba(220, 38, 38, 0.8);
    transform: scale(1.05);
}

/* Zoom controls */
.zoom-controls {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1001;
}

.zoom-btn {
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
    border: 1px solid #dc2626;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: rgba(220, 38, 38, 0.8);
    transform: scale(1.1);
}

footer {
    background: rgba(220, 38, 38, 0.95);
    color: #fff;
    padding: 2em 0;
    margin-top: 3em;
    backdrop-filter: blur(10px);
    border-top: 3px solid #fbbf24;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2em;
    padding: 0 2em;
    margin-bottom: 2em;
}

.footer-section h3 {
    color: #fbbf24;
    margin-bottom: 1em;
    font-size: 1.2em;
    font-weight: 600;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 1em;
}

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

.footer-section ul li {
    margin-bottom: 0.5em;
}

.footer-section ul li a {
    color: #fbbf24;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #ffffff;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1.5em;
    margin: 0 2em;
}

footer a {
    color: #fbbf24;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #ffffff;
}

/* MRT Info Section */
.mrt-info {
    max-width: 800px;
    margin: 3em auto;
    padding: 2em;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.mrt-info h2 {
    color: #dc2626;
    margin-bottom: 1em;
    font-size: 1.8em;
    font-weight: 600;
}

.mrt-info h3 {
    color: #dc2626;
    margin: 1.5em 0 0.8em;
    font-size: 1.3em;
    font-weight: 600;
}

.mrt-info p {
    line-height: 1.7;
    margin-bottom: 1.5em;
    color: #374151;
}

.mrt-info ul {
    list-style: none;
    padding: 0;
}

.mrt-info ul li {
    padding: 0.5em 0;
    border-bottom: 1px solid rgba(220, 38, 38, 0.1);
    color: #374151;
}

.mrt-info ul li:last-child {
    border-bottom: none;
}

.mrt-info ul li strong {
    color: #dc2626;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Large screen optimization */
@media (min-width: 1400px) {
    .welcome-section {
        max-width: 1400px;
        padding: 2.5em;
    }

    .features {
        gap: 1.5em;
    }

    .feature {
        padding: 2em;
    }

    .feature-icon {
        font-size: 3em;
    }

    .feature h3 {
        font-size: 1.3em;
    }

    .feature p {
        font-size: 1em;
    }
}

/* Tablet responsive design */
@media (max-width: 1024px) {
    .welcome-section {
        max-width: 95%;
        padding: 1.8em;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: 1em;
    }

    .feature {
        padding: 1.3em;
    }

    .feature-icon {
        font-size: 2.2em;
    }
}

/* Mobile responsive design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5em;
        letter-spacing: 1px;
    }

    .search-container {
        max-width: 90%;
        margin: 1em auto 0;
    }

    #stationSearch {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .city-selector {
        flex-wrap: wrap;
        gap: 8px;
        margin: 1em auto 0;
    }

    .city-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .welcome-section {
        margin: 1em auto;
        padding: 1.5em;
        max-width: 95%;
    }

    .welcome-content h2 {
        font-size: 1.5em;
        margin-bottom: 0.3em;
    }

    .welcome-content>p {
        font-size: 0.9em;
        margin-bottom: 1em;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 0.8em;
    }

    .feature {
        padding: 1.2em;
        margin-bottom: 0.5em;
    }

    .feature-icon {
        font-size: 2em;
        margin-bottom: 0.6em;
    }

    .feature h3 {
        font-size: 1em;
        margin-bottom: 0.6em;
    }

    .feature p {
        font-size: 0.85em;
        line-height: 1.4;
    }

    .map-display {
        padding: 1em;
        margin: 1em auto;
    }

    .map-container {
        flex-direction: column;
        gap: 1em;
    }

    .map-view {
        padding: 1em;
        margin: 1em auto;
    }

    .google-map {
        height: 400px;
    }

    .view-toggle-label {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: fit-content;
        padding: 4px;
        gap: 0;
    }

    .view-option {
        font-size: 13px;
        padding: 8px 12px;
        min-width: 100px;
        justify-content: center;
    }

    .view-icon {
        font-size: 15px;
    }

    .view-toggle-slider {
        width: calc(50% - 4px);
        height: calc(100% - 8px);
        left: 4px;
        top: 4px;
        border-radius: 22px;
    }

    #viewToggle:checked~.view-toggle-slider {
        left: 50%;
    }

    .modal-content {
        padding: 10px;
    }

    .close {
        top: 10px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }

    /* Mobile controls */
    .zoom-controls {
        left: 10px;
        gap: 8px;
    }

    .zoom-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .fullscreen-controls {
        bottom: 10px;
        right: 10px;
    }

    .fullscreen-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .modal h3 {
        font-size: 1.2em;
        padding: 8px 15px;
    }

    #modalDescription {
        font-size: 0.9em;
        padding: 8px 15px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5em 0;
    }

    h1 {
        font-size: 1.3em;
    }

    .welcome-section {
        margin: 0.8em auto;
        padding: 1.2em;
    }

    .welcome-content h2 {
        font-size: 1.3em;
    }

    .welcome-content>p {
        font-size: 0.85em;
    }

    .feature {
        padding: 1em;
    }

    .feature-icon {
        font-size: 1.8em;
    }

    .feature h3 {
        font-size: 0.95em;
    }

    .feature p {
        font-size: 0.8em;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 0.6em;
    }

    .feature-icon {
        font-size: 1.6em;
        margin-bottom: 0.5em;
    }

    .header-subtitle {
        font-size: 0.9em;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5em;
        padding: 0 1em;
    }

    .mrt-info {
        margin: 2em auto;
        padding: 1.5em;
    }

    .mrt-info h2 {
        font-size: 1.5em;
    }

    .mrt-info h3 {
        font-size: 1.1em;
    }
}