:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-bg: rgba(0, 0, 0, 0.05);
    --text-main: #0f172a;
    --text-muted: #475569;
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --bg-dark: #f8fafc;
    --accent-glow: #6366f1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center content horizontally */
    overflow-x: hidden;
    position: relative;
}



.app-footer {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
    z-index: 2;
}



/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: #4f46e5;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: #ec4899;
    animation-delay: -2s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 300px;
    height: 300px;
    background: #06b6d4;
    animation-delay: -4s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    z-index: 1;
    flex: 1 1 auto;
    margin: 0 auto;
    /* Allow shrinking and growing */
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #4338ca, #7e22ce);
    /* Darker gradient for visibility */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.app-header p {
    color: var(--text-muted);
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    background: rgba(0, 0, 0, 0.05);
}

/* Custom Date/Time Input Styles for Webkit */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: none;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

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

.button-group {
    display: flex;
    gap: 1rem;
}

.btn-secondary-action {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary-action:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--text-muted);
}

/* Result Section */
.result-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.result-section:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none;
}

.result-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.train-badge {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--glass-border);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-icon {
    position: absolute;
    left: -2.6rem;
    width: 32px;
    height: 32px;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 2;
}

.timeline-content h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.time-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.date-display {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.description {
    font-size: 0.85rem;
    color: rgba(0, 0, 0, 0.6);
}

.action-buttons {
    margin-top: 2rem;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--text-muted);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.autocomplete-item .code {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.train-name {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.clear-btn {
    position: absolute;
    right: 10px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.clear-btn:hover {
    color: var(--text-main);
}

.clear-btn.hidden {
    display: none;
}

/* Loading Spinner */
.input-spinner {
    position: absolute;
    right: 40px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.input-spinner.hidden {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Adjust input padding to make room for clear button */
input {
    padding-right: 35px;
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .app-header h1 {
        font-size: 2rem;
    }
}

/* Info Section */
.info-section {
    margin-top: 2rem;
    text-align: center;
}

.info-section h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.info-section p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* FAQ Section */
.faq-section {
    margin-top: 3rem;
}

.section-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
}

.faq-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.faq-card {
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--glass-border);
    background: #ffffff;
    /* Explicit white for cards in light mode */
    border-radius: 16px;
}

.faq-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.faq-card h3 {
    color: var(--text-main);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.faq-card h3::before {
    content: 'Q.';
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(79, 70, 229, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.faq-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    padding-left: 2.5rem;
    /* Align with text start */
}

@media (min-width: 768px) {
    .faq-grid {
        grid-template-columns: 1fr;
        /* Full width horizontal tiles */
    }
}

/* Error Section Styles */
.error-card {
    background: rgba(255, 82, 82, 0.1);
    /* Light red background */
    border: 1px solid rgba(255, 82, 82, 0.3);
    text-align: center;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
}

.error-icon {
    font-size: 3rem;
    color: #ff5252;
    margin-bottom: 0.5rem;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff5252;
    margin: 0;
}

.error-message {
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.8);
    margin: 0;
    line-height: 1.5;
}