/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background: #f8fafc;
    min-height: 100vh;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    padding: 3rem 0;
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.header .container {
    position: relative;
    z-index: 1;
}

.logo {
    font-size: 2.25rem;
    font-weight: 800;
    color: #ffffff;
    cursor: pointer;
    margin-bottom: 0.75rem;
    letter-spacing: -0.025em;
}

.tagline {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.75);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

.tagline a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tagline a:hover {
    color: #93c5fd;
}

/* Main Content */
.main {
    flex: 1;
}

/* Filters */
.filters {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.filter-group {
    position: relative;
}

.filter-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    color: #64748b;
}

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-wrapper input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: all 0.2s ease;
    color: #1a1a2e;
}

.autocomplete-wrapper input::placeholder {
    color: #94a3b8;
}

.autocomplete-wrapper input:hover {
    border-color: #cbd5e1;
}

.autocomplete-wrapper input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.clear-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: #e2e8f0;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #cbd5e1;
    color: #475569;
}

.autocomplete-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.autocomplete-item:hover {
    background: #f1f5f9;
}

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

.autocomplete-item strong {
    color: #1e293b;
}

.autocomplete-item small {
    color: #64748b;
}

/* Winner Section */
.winner-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.winner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.winner-header h2 {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.share-icon {
    color: #64748b;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.share-icon:hover {
    opacity: 1;
    color: #3b82f6;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #1e293b;
}

.nav-btn:disabled {
    background: #f8fafc;
    color: #cbd5e1;
    border-color: #f1f5f9;
    cursor: not-allowed;
}

.current-date {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
    padding: 0 0.5rem;
}

/* Winner Card */
.winner-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.winner-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.winner-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 0;
}

.winner-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.winner-details h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.winner-details p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
}

.winner-details strong {
    color: #fff;
}

.savings-highlight {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.savings-amount {
    font-size: 3.5rem;
    font-weight: 800;
    display: block;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(74, 222, 128, 0.6));
    }
}

.route-info {
    text-align: center;
    margin: 1rem 0 1.5rem 0;
}

.route-display {
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: #64748b;
}

.airport-code {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

#route-info span.airport-code.skipped {
    text-decoration: line-through !important;
    opacity: 0.7;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.2);
}

/* Map */
.map-container {
    height: 400px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Recent Winners */
.recent-winners {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.recent-winners h3 {
    margin-bottom: 1.25rem;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.recent-list {
    display: grid;
    gap: 0.5rem;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    background: #f8fafc;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.recent-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
    transform: translateX(4px);
}

.recent-item.active {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: white;
    border-color: transparent;
}

.recent-date {
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.recent-route {
    flex: 1;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

.recent-item.active .recent-route {
    color: rgba(255, 255, 255, 0.8);
}

.recent-savings {
    font-weight: 700;
    color: #059669;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.recent-item.active .recent-savings {
    color: #4ade80;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem auto;
}

.no-winner,
.no-winners {
    text-align: center;
    padding: 3rem;
    color: #64748b;
    font-size: 1rem;
}

.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #b91c1c;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    text-align: center;
    margin: 1rem 0;
    border: 1px solid rgba(185, 28, 28, 0.2);
    font-weight: 500;
}

/* Footer */
.footer {
    background: #0f172a;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    font-size: 0.9rem;
}

.footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #60a5fa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .filters {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .winner-header {
        text-align: center;
        flex-direction: column;
    }
    
    .winner-info {
        grid-template-columns: 1fr;
    }
    
    .date-nav {
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .current-date {
        font-size: 1rem;
    }
    
    .route-display {
        font-size: 0.9rem;
        gap: 0.3rem;
    }
    
    .route-display .airport-code {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 90px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .recent-item {
        padding: 0.8rem;
    }
    
    .recent-route {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
        font-size: 0.8rem;
    }
    
    .nav-btn {
        width: 100%;
    }
    
    .map-container {
        height: 300px;
    }

    .winner-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .filters,
    .winner-section,
    .recent-winners {
        padding: 1rem;
    }
    
    .savings-amount {
        font-size: 3rem;
    }
    
    .map-container {
        height: 200px;
    }
    
    .winner-card {
        padding: 1.5rem;
    }
    
    .autocomplete-wrapper input {
        font-size: 0.9rem;
    }
}


/* Spinner animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
