/* 
 * Roam Travel - Custom CSS
 * Main color scheme: 
 *   Primary: #1976D2 (sky blue)
 *   Secondary: #FF6B6B (coral) 
 *   Background: #F5F7FA (cloud white)
 *   Text: #2C3E50 (navy)
 *   Accent: #4CAF50 (success green)
 */

/* CSS Custom Properties for Theme Support */
:root {
    --primary-color: #1976D2;
    --primary-dark: #1565C0;
    --success-color: #4CAF50;
    --success-dark: #3D9140;
    --info-color: #17a2b8;
    --info-dark: #138496;
    --warning-color: #ffc107;
    --danger-color: #dc3545;

    /* Light theme colors */
    --bg-color: #F5F7FA;
    --card-bg: #ffffff;
    --text-color: #2C3E50;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.08);

    /* Navbar colors */
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --navbar-text: #2C3E50;
}

/* Global Styles */
body {
    font-family: 'Inter', 'Roboto', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding-bottom: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover, .btn-success:focus {
    background-color: var(--success-dark);
    border-color: var(--success-dark);
}

/* Navbar Styles */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

/* Hero Section */
.hero-section {
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1976D2;
}

/* Modern Card Design */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    margin-bottom: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: var(--card-bg);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--shadow-color);
}

.card-header {
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border: none;
}

.card-header.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
}

.card-header.bg-info {
    background: linear-gradient(135deg, var(--info-color) 0%, var(--info-dark) 100%);
}

.card-body {
    padding: 2rem;
}

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.lead {
    font-size: 1.125rem;
    font-weight: 400;
    color: #6c757d;
}

/* Modern Button Design */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #3D9140 100%);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #3D9140 0%, #2E7D32 100%);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    transform: translateY(-1px);
}

/* Enhanced Form Design */
.form-control, .form-select {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    background-color: var(--card-bg);
    color: var(--text-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(25, 118, 210, 0.15);
    transform: translateY(-1px);
}

.input-group-text {
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-right: none;
    font-weight: 500;
    color: var(--text-color);
}

/* Make calendar icon spans clickable */
.input-group-text:has(.fa-calendar-alt) {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.input-group-text:has(.fa-calendar-alt):hover {
    background-color: var(--border-color);
}

/* Modern Alert Design */
.alert {
    border-radius: 0.75rem;
    border: none;
    padding: 1.25rem 1.5rem;
    font-weight: 500;
}

.alert-primary {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.1) 0%, rgba(25, 118, 210, 0.05) 100%);
    color: #1976D2;
    border-left: 4px solid #1976D2;
}

.alert-success {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%);
    color: #4CAF50;
    border-left: 4px solid #4CAF50;
}

.alert-info {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.1) 0%, rgba(23, 162, 184, 0.05) 100%);
    color: #17a2b8;
    border-left: 4px solid #17a2b8;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    color: #ffc107;
    border-left: 4px solid #ffc107;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
    color: #dc3545;
    border-left: 4px solid #dc3545;
}

/* Enhanced Navigation */
.navbar {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1030;
}

.navbar-light {
    background: rgba(255, 255, 255, 0.95) !important;
}

.navbar-dark {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%) !important;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.75rem;
}

.navbar-light .navbar-brand {
    background: linear-gradient(135deg, #1976D2 0%, #4CAF50 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-dark .navbar-brand {
    color: #ffffff !important;
}

.nav-link {
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    transition: all 0.2s ease;
    border-radius: 0.5rem;
    margin: 0 0.25rem;
}

.navbar-dark .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-dark .nav-link:hover,
.navbar-dark .nav-link.active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* Keep long navbar dropdowns usable on short or zoomed viewports. */
.cheap-flights-dropdown-menu {
    max-height: min(80vh, 38rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1080;
    width: max-content;
    max-width: min(52rem, calc(100vw - 2rem));
}

.cheap-flights-continent-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Lay the continent groups out side by side on wider viewports so the full
   city list reads at a glance instead of requiring a scroll. */
@media (min-width: 576px) {
    .cheap-flights-continent-grid {
        grid-template-columns: repeat(3, minmax(10rem, 1fr));
        column-gap: 1.5rem;
    }
}

.navbar-light .nav-link:hover {
    background: rgba(25, 118, 210, 0.1);
    transform: translateY(-1px);
}

/* Modern Footer */
footer {
    background: linear-gradient(135deg, #2C3E50 0%, #1976D2 100%);
    color: white;
    margin-top: 4rem;
    padding: 3rem 0 2rem;
}

footer h5 {
    font-weight: 700;
    margin-bottom: 1.5rem;
}

footer .list-unstyled li {
    margin-bottom: 0.5rem;
}

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

footer .list-unstyled a:hover {
    color: white;
}

/* Enhanced Hero Section */
.hero-section {
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.05) 0%, rgba(76, 175, 80, 0.05) 100%);
    border-radius: 1rem;
    text-align: center;
}

.hero-section h1 {
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: #2C3E50;
    font-size: 3rem;
}

.hero-section .lead {
    font-size: 1.25rem;
    color: #6c757d;
    margin-bottom: 0;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
}

.form-control:focus, .form-select:focus {
    border-color: #1976D2;
    box-shadow: 0 0 0 0.25rem rgba(25, 118, 210, 0.25);
}

.input-group-text {
    background-color: #f8f9fa;
}

/* Autocomplete styles */
.autocomplete-results {
    position: absolute;
    z-index: 1000;
    background: white;
    width: calc(100% - 2rem);
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-top: 2px;
    top: 100%;
    left: 0;
}

/* Ensure input-group has proper positioning context for autocomplete */
.input-group {
    position: relative;
}

/* Mobile-specific autocomplete fixes */
@media (max-width: 767.98px) {
    .autocomplete-results {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        max-height: 200px;
        z-index: 1050;
    }
    
    /* Ensure the parent container doesn't clip the dropdown */
    .input-group:has(.autocomplete-results) {
        overflow: visible;
    }
    
    /* Add some spacing between input and dropdown on mobile */
    .autocomplete-results {
        margin-top: 4px;
    }
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.autocomplete-item:hover, .autocomplete-item.selected {
    background-color: #f0f7ff;
}

.highlight {
    background-color: #ffe066;
    font-weight: bold;
}

/* Multi-destination selection styles */
.selected-destinations-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 5px 0;
    max-width: 100%;
    overflow: hidden;
}

.selected-destination {
    margin-right: 5px;
    margin-bottom: 5px;
    max-width: 100%;
}

.selected-destination .badge {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    font-size: 0.85rem;
    max-width: 100%;
    word-break: break-word;
}

.selected-destination .destination-name {
    margin-right: 6px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.selected-destination .btn-close {
    font-size: 0.6rem;
    padding: 2px;
    flex-shrink: 0;
}

/* Mobile-specific destination tag styles */
@media (max-width: 575.98px) {
    .selected-destination .badge {
        max-width: calc(100vw - 80px);
        font-size: 0.8rem;
        padding: 5px 8px;
    }
    
    .selected-destination .destination-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100vw - 120px);
    }
}

/* Time input styles for mobile */
input[type="time"] {
    min-width: 0;
}

@media (max-width: 575.98px) {
    input[type="time"] {
        font-size: 0.8rem;
        padding: 0.3rem 0.4rem;
        min-width: 105px;
    }
    
    /* Reduce padding for time filter labels on mobile */
    #takeoff-content .form-label.small,
    #landing-content .form-label.small {
        font-size: 0.75rem;
    }
}

@media (max-width: 767.98px) {
    input[type="time"] {
        font-size: 0.85rem;
        padding: 0.35rem 0.5rem;
    }
}

/* Flight Results Table */
.table {
    font-size: 0.95rem;
}

.flight-date {
    font-weight: 600;
    color: #2C3E50;
}

.flight-time {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Day abbreviation styling */
.day-abbr {
    font-weight: normal;
    color: #2C3E50;
    display: inline-block;
}

/* Dashboard Styles */
.dashboard-header {
    padding: 1.5rem 0;
}

.dashboard-header h1 {
    color: #1976D2;
    margin-bottom: 0.5rem;
}

.search-params .badge {
    margin-right: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.search-summary {
    background-color: #f5f8ff;
    border: 1px solid #d6e4ff;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.search-summary:hover {
    background-color: #e8f0ff;
    border-color: #1976D2;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}

.search-summary .edit-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    color: #1976D2;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.search-summary:hover .edit-indicator {
    opacity: 1;
}

.search-summary-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    color: #0d6efd;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.search-summary-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    color: #2c3e50;
    font-size: 0.95rem;
}

.search-params-line {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.search-summary-details .separator {
    color: #6c757d;
}

/* Tips Section */
.tip-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
    height: 100%;
}

.tip-card h5 {
    margin-bottom: 1rem;
    color: #1976D2;
}

/* Auth Pages */
.auth-container {
    max-width: 450px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.auth-header h2 {
    color: #1976D2;
    margin-bottom: 0.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

/* Footer */
footer {
    margin-top: 3rem;
}

/* Time Filter Styles */
.nav-tabs .nav-link {
    border: none;
    color: #1976D2;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link.active {
    background-color: transparent;
    border-bottom: 3px solid #1976D2;
    color: #1976D2;
    font-weight: 600;
}

.nav-tabs .nav-link:hover:not(.active) {
    border-bottom: 3px solid rgba(25, 118, 210, 0.2);
    background-color: rgba(25, 118, 210, 0.05);
}

.card-header-tabs {
    margin-right: 0;
    margin-left: 0;
    margin-bottom: -1px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

/* Override card-header gradient when it contains tabs */
.card-header.p-0 {
    background: #ffffff !important;
    border-bottom: 1px solid var(--border-color);
}

.card-header.p-0 .nav-tabs {
    background-color: #ffffff;
    border-bottom: none;
}

.card-header.p-0 .nav-tabs .nav-link {
    color: #495057;
    background-color: transparent;
}

.card-header.p-0 .nav-tabs .nav-link:hover {
    color: #1976D2;
    background-color: rgba(25, 118, 210, 0.05);
}

.card-header.p-0 .nav-tabs .nav-link.active {
    color: #1976D2;
    background-color: #ffffff;
    border-bottom: 3px solid #1976D2;
    font-weight: 600;
}

.time-range-slider {
    height: 4px;
    background: #E0E0E0;
    border-radius: 2px;
    position: relative;
    margin: 20px 0;
}

.time-range-slider .track {
    height: 4px;
    background: #1976D2;
    position: absolute;
    border-radius: 2px;
}

.time-range-slider .handle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid #1976D2;
    position: absolute;
    top: -8px;
    margin-left: -10px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.time-indicator {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
}

/* Price Range Slider */
.price-range-slider {
    position: relative;
    margin-bottom: 1rem;
}

.price-range-slider input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #1976D2 0%, #1976D2 var(--slider-percent, 50%), #e9ecef var(--slider-percent, 50%), #e9ecef 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: background 0.2s ease;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1976D2;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.price-range-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1976D2;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.price-range-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d;
}

.price-current {
    font-weight: 600;
    color: #1976D2;
    font-size: 1rem;
    background: rgba(25, 118, 210, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Enhanced Filter Options */
.filter-section {
    background: rgba(25, 118, 210, 0.05);
    border: 1px solid rgba(25, 118, 210, 0.1);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.filter-section h6 {
    color: #1976D2;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.filter-option:hover {
    background-color: rgba(25, 118, 210, 0.1);
}

.filter-option input[type="checkbox"] {
    margin-right: 0.5rem;
}

.filter-option label {
    font-weight: 500;
    margin-bottom: 0;
    cursor: pointer;
    flex-grow: 1;
}

.filter-badge {
    background: #1976D2;
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.75rem;
    margin-left: 0.5rem;
}

/* Duration Filter Enhancement */
.duration-filter {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.duration-input {
    position: relative;
}

.duration-input::after {
    content: "h";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-weight: 500;
    pointer-events: none;
}

/* Quick Filter Buttons */
.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-filter-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 1.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quick-filter-btn:hover {
    background: #1976D2;
    color: white;
    border-color: #1976D2;
    transform: translateY(-1px);
}

.quick-filter-btn.active {
    background: #1976D2;
    color: white;
    border-color: #1976D2;
}

/* Responsive Adjustments */

/* Large tablets and small desktops */
@media (max-width: 991.98px) {
    .hero-section {
        padding: 1.5rem 0;
    }

    .card {
        margin-bottom: 1rem;
    }
}

/* Tablets */
@media (max-width: 767.98px) {
    /* Global adjustments */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .card-body {
        padding: 1rem;
    }

    /* Hero section */
    .hero-section {
        padding: 1rem 0;
        text-align: center;
    }

    .hero-section h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .hero-section .lead {
        font-size: 1.1rem;
    }

    /* Navigation improvements */
    .navbar-nav {
        text-align: center;
        margin-top: 1rem;
    }

    .navbar-nav .nav-item {
        margin: 0.25rem 0;
    }

    /* Search form improvements */
    .card-header h5 button {
        font-size: 1.1rem;
        padding: 0.5rem 1rem;
    }

    /* Form layout improvements */
    .row .col-md-6 {
        margin-bottom: 1rem;
    }

    /* Time filter tabs */
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        border-bottom: 2px solid transparent;
    }

    .nav-tabs .nav-link.active {
        border-bottom: 2px solid #1976D2;
    }

    /* Flight results table - hidden on tablets, show cards instead */
    .table {
        font-size: 0.8rem;
    }

    .table thead th {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }

    .table tbody td {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
    }

    /* Flight time styling for mobile */
    .flight-date {
        font-size: 0.85rem;
    }

    .flight-time {
        font-size: 0.75rem;
    }

    /* Mobile/Tablet card layout for flight results */
    .flight-cards-mobile {
        display: block;
    }

    .flight-cards-mobile .flight-card {
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .flight-cards-mobile .flight-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
        border-bottom: 1px solid #eee;
        padding-bottom: 0.5rem;
    }

    .flight-cards-mobile .flight-route {
        font-weight: 600;
        color: #2C3E50;
    }

    .flight-cards-mobile .flight-price {
        font-size: 1.25rem;
        font-weight: 700;
        color: #1976D2;
    }

    .flight-cards-mobile .flight-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .flight-cards-mobile .flight-detail {
        font-size: 0.9rem;
    }

    .flight-cards-mobile .flight-detail strong {
        color: #495057;
    }

    /* Dashboard improvements */
    .dashboard-header h1 {
        font-size: 1.75rem;
    }

    .list-group-item {
        padding: 0.75rem;
    }

    /* Auth pages */
    .auth-container {
        padding: 1.5rem;
        margin: 1rem;
    }

    /* Footer */
    footer {
        margin-top: 2rem;
        padding: 1.5rem 0;
    }

    footer .col-md-6,
    footer .col-md-3 {
        margin-bottom: 1rem;
        text-align: center;
    }
}

/* Mobile phones */
@media (max-width: 575.98px) {
    /* Very small screens */
    .hero-section h1 {
        font-size: 1.75rem;
    }

    .hero-section .lead {
        font-size: 1rem;
    }

    /* Navigation - stack vertically */
    .navbar-brand {
        font-size: 1.25rem;
    }

    /* Search form - single column layout */
    .row .col-md-6 {
        margin-bottom: 1.5rem;
    }

    /* Collapsible sections for mobile */
    .card-header h5 button {
        width: 100%;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .card-header h5 button::after {
        content: "▼";
        font-size: 0.8rem;
        transition: transform 0.2s;
    }

    .card-header h5 button.collapsed::after {
        transform: rotate(-90deg);
    }

    /* Compact form inputs */
    .form-control, .form-select {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    .input-group-text {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    /* Flight results - card layout for mobile */
    .table-responsive {
        border: none;
    }

    .table {
        display: none; /* Hide table on mobile */
    }

    /* Mobile card layout for flight results */
    .flight-cards-mobile {
        display: block;
    }

    .flight-cards-mobile .flight-card {
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .flight-cards-mobile .flight-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
        border-bottom: 1px solid #eee;
        padding-bottom: 0.5rem;
    }

    .flight-cards-mobile .flight-route {
        font-weight: 600;
        color: #2C3E50;
    }

    .flight-cards-mobile .flight-price {
        font-size: 1.25rem;
        font-weight: 700;
        color: #1976D2;
    }

    .flight-cards-mobile .flight-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .flight-cards-mobile .flight-detail {
        font-size: 0.85rem;
    }

    .flight-cards-mobile .flight-detail strong {
        color: #495057;
    }

    /* Dashboard mobile improvements */
    .dashboard-header {
        text-align: center;
        padding: 1rem 0;
    }

    .list-group-item {
        padding: 1rem 0.75rem;
    }

    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Footer mobile */
    footer {
        text-align: center;
    }

    footer .row > div {
        margin-bottom: 1.5rem;
    }
}

/* Loading States and Skeleton Screens */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.375rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.skeleton-text.wide {
    width: 75%;
}

.skeleton-text.narrow {
    width: 50%;
}

.skeleton-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.skeleton-header {
    height: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

.skeleton-line {
    height: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    float: right;
    margin-left: 1rem;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 0.5rem;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 0.25em solid #f3f3f3;
    border-top: 0.25em solid #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading state for search form */
.search-loading .form-control,
.search-loading .form-select,
.search-loading .btn {
    pointer-events: none;
    opacity: 0.6;
}

/* Dashboard skeleton styles */
.dashboard-skeleton .list-group-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.dashboard-skeleton .skeleton-text {
    background: linear-gradient(90deg, #e9ecef 25%, #dee2e6 50%, #e9ecef 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* Flight results skeleton */
.flight-results-skeleton {
    display: none;
}

.flight-results-skeleton.show {
    display: block;
}

.flight-skeleton-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Pulse animation for loading indicators */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Loading button states */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -0.5rem 0 0 -0.5rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Extra small devices */
@media (max-width: 359.98px) {
    .hero-section h1 {
        font-size: 1.5rem;
    }

    .hero-section .lead {
        font-size: 0.9rem;
    }

    /* Very compact layout */
    .card-body {
        padding: 0.75rem;
    }

    .form-control, .form-select {
        font-size: 0.85rem;
        padding: 0.35rem 0.5rem;
    }
}

/* Mobile bottom-sheet modals (Save Search / Modify Search) */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 92vh;
    }

    .modal.fade .modal-dialog {
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
    }

    .modal.show .modal-dialog {
        transform: translateY(0);
    }

    .modal-content {
        border-radius: 1rem 1rem 0 0;
        border: none;
        max-height: 92vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Drag handle affordance */
    .modal-content::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        margin: 0.6rem auto 0;
        background: #dee2e6;
        border-radius: 2px;
        flex-shrink: 0;
    }

    /* The Save/Modify Search forms wrap .modal-body/.modal-footer in a
       <form>, which breaks Bootstrap's flex-column chain unless the form
       itself is also a flex column. */
    .modal-content > form {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 2;
        background: inherit;
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: white;
    }

    .modal-body {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Thumb-friendly primary actions on mobile */
@media (max-width: 767.98px) {
    .flight-cards-mobile .flight-card .text-center .btn-primary {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 48px;
    }

    #flightSearchForm .col-12.mt-3 > button[type="submit"] {
        width: 100%;
        min-height: 48px;
        font-size: 1.05rem;
    }

    #flightSearchForm .col-12.mt-3 > button[type="reset"] {
        width: 100%;
        margin-top: 0.5rem;
        margin-left: 0 !important;
        min-height: 44px;
    }

    .modal-footer .btn {
        min-height: 44px;
    }
}

/* Flight card visual hierarchy on mobile */
@media (max-width: 767.98px) {
    .flight-cards-mobile .flight-price {
        font-size: 1.4rem;
    }

    .flight-cards-mobile .flight-detail.flight-detail-emphasis {
        background: rgba(25, 118, 210, 0.06);
        border-radius: 0.4rem;
        padding: 0.4rem 0.5rem;
        margin: -0.4rem -0.5rem 0.25rem;
    }

    .flight-cards-mobile .flight-detail.flight-detail-emphasis strong {
        color: #1976D2;
        font-size: 0.85rem;
    }

    .flight-cards-mobile .flight-detail.flight-detail-muted {
        opacity: 0.7;
    }

    .flight-cards-mobile .flight-detail .badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}

/* Larger tap targets on touch-sized screens */
@media (max-width: 767.98px) {
    .selected-destination .btn-close {
        min-width: 24px;
        min-height: 24px;
        padding: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background-size: 0.6em;
    }

    .autocomplete-item {
        padding: 0.85rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-tabs .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Keep the autocomplete dropdown from being clipped by a narrow viewport / keyboard */
@media (max-width: 767.98px) {
    .autocomplete-results {
        max-height: min(45vh, 260px);
    }
}
