/* ===== CSS VARIABLES & ROOT STYLES ===== */
:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --secondary: #6c757d;
    --background: #f4f7f9;
    --card-bg: #ffffff;
    --text: #212529;
    --text-light: #6c757d;
    --border: #dee2e6;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --transition: all 0.2s ease-in-out;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --input-height: 44px;
}

:root.dark-mode {
    --primary: #4dabf7;
    --primary-dark: #1c7ed6;
    --background: #121212;
    --card-bg: #1e1e1e;
    --text: #e9ecef;
    --text-light: #adb5bd;
    --border: #343a40;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

/* ===== BASE STYLES ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    padding: var(--space-md);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* ===== DONATION POPUP ===== */
.donation-popup-overlay {
    display: none;
    /* Hidden by default, shown via JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.donation-popup {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 550px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: popupSlideIn 0.3s ease-out;
    border: 2px solid var(--border);
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.donation-popup-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.donation-popup-header i {
    color: #e74c3c;
    font-size: 1.8rem;
}

.donation-popup-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
}

.donation-popup-content {
    padding: var(--space-lg);
}

.donation-popup-content p {
    margin: 0 0 var(--space-md) 0;
    line-height: 1.6;
    color: var(--text);
}

.donation-popup-content p:last-child {
    margin-bottom: 0;
}

.donation-popup-actions {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

.popup-btn {
    flex: 1;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    border: none;
}

.popup-btn-primary {
    background: #FFDD00;
    color: #1a1a1a;
}

.popup-btn-primary:hover {
    background: #f0cf00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 221, 0, 0.3);
}

.popup-btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.popup-btn-secondary:hover {
    background: var(--background);
}

@media (max-width: 600px) {
    .donation-popup-actions {
        flex-direction: column;
    }

    .popup-btn {
        width: 100%;
    }
}

/* ===== HEADER ===== */
header {
    text-align: center;
    position: relative;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: var(--space-xs);
}

.subtitle {
    color: var(--text-light);
    font-size: 1rem;
}

.top-right-controls {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ===== TAB NAVIGATION ===== */
.mobile-nav-dropdown {
    display: none;
    position: relative;
    width: 100%;
    margin-bottom: var(--space-md);
}

.mobile-nav-btn {
    width: 100%;
    padding: var(--space-md);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    transition: all 0.2s ease;
}

.mobile-nav-btn:hover {
    background: var(--hover);
}

.mobile-nav-btn i {
    transition: transform 0.2s ease;
}

.mobile-nav-btn.open i {
    transform: rotate(180deg);
}

.mobile-nav-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.mobile-nav-content.show {
    display: block;
}

.mobile-nav-item {
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    background: var(--card-bg);
}

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

.mobile-nav-item:hover {
    background: var(--hover);
}

.mobile-nav-item.active {
    background: var(--primary);
    color: white;
}

.mobile-nav-item i {
    width: 20px;
    text-align: center;
}

.mobile-nav-item .new-badge {
    margin-left: auto;
}

.desktop-tabs {
    display: flex;
}

.tab-container {
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    font-weight: 500;
    color: var(--text-light);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.tab:hover:not(.active) {
    color: var(--text);
}

.tab-container a.tab {
    text-decoration: none;
}

.notification-icon {
    display: none;
    margin-left: 8px;
    color: var(--warning);
    animation: ring 1.5s ease-in-out infinite;
}

.tab.has-notification .notification-icon {
    display: inline-block;
}

@keyframes ring {
    0% {
        transform: rotate(0);
    }

    10% {
        transform: rotate(30deg);
    }

    20% {
        transform: rotate(-25deg);
    }

    30% {
        transform: rotate(20deg);
    }

    40% {
        transform: rotate(-15deg);
    }

    50% {
        transform: rotate(10deg);
    }

    60% {
        transform: rotate(-5deg);
    }

    70% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(0);
    }
}

/* ===== FILTER CARD ===== */
.filter-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.time-range-control {
    margin-top: var(--space-sm);
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.time-range-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 4px;
}

.time-range-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
    background: transparent;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px dashed var(--border);
    align-self: flex-start;
}

.time-range-sliders {
    margin-top: 6px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
    max-width: 420px;
    margin-left: 0;
    margin-right: auto;
}

.time-range-sliders input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    height: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.input-group label,
.filter-group-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
}

.input-group input[type="number"],
.input-group input[type="date"],
.input-group input[type="email"] {
    width: 100%;
    height: var(--input-height);
    padding: 0 var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--text);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

.input-group input:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

.filter-group-label {
    grid-column: 1 / -1;
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-xs);
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    align-items: center;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

/* ===== DROPDOWNS ===== */
.dropdown {
    position: relative;
}

.dropbtn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    color: var(--text);
    padding: 0 var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: var(--transition);
    font-weight: 500;
    height: var(--input-height);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropbtn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropbtn:hover,
.dropbtn:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.dropbtn:disabled {
    background-color: var(--background);
    cursor: not-allowed;
    opacity: 0.7;
}

.dropbtn i {
    color: var(--text-light);
    margin-left: var(--space-sm);
    transition: transform 0.2s ease;
}

.dropdown.show .dropbtn i {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    padding: var(--space-sm);
    margin-top: var(--space-sm);
}

.dropdown.show .dropdown-content {
    display: block;
}

.dropdown-content-search {
    padding-bottom: var(--space-sm);
}

.dropdown-content-search input {
    width: 100%;
    height: 36px;
    padding: 0 var(--space-sm);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background-color: var(--background);
    color: var(--text);
}

.dropdown-content label {
    display: flex;
    align-items: center;
    padding: var(--space-sm);
    cursor: pointer;
    border-radius: calc(var(--radius) - 4px);
    transition: var(--transition);
    font-size: 0.9rem;
}

.dropdown-content label:hover {
    background-color: var(--background);
}

.dropdown-content input[type="checkbox"],
.dropdown-content input[type="radio"] {
    margin-right: var(--space-sm);
    accent-color: var(--primary);
    cursor: pointer;
}

/* ===== ACTION BAR & BUTTONS ===== */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: var(--space-lg);
}

.toggle-controls-container {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    align-items: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0 var(--space-md);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    height: var(--input-height);
    text-decoration: none;
    flex-grow: 1;
}

@media (min-width: 500px) {
    .btn {
        flex-grow: 0;
    }
}

.btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

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

.btn i {
    font-size: 1.1rem;
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background: rgba(0, 123, 255, 0.1);
}

.dark-mode-btn {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
    width: var(--input-height);
    height: var(--input-height);
    padding: 0;
    flex-grow: 0;
}

.dark-mode-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-bmc {
    background-color: #FFDD00 !important;
    color: #212529 !important;
    border: 1px solid transparent;
    flex-grow: 0;
}

.btn-bmc:hover {
    background-color: #f0cf00 !important;
    color: #212529 !important;
}

/* ===== TOGGLE SWITCHES ===== */
.live-refresh-control,
.cheap-flights-control {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    color: var(--text-light);
}

.cheap-flights-control .subtitle {
    font-size: 0.8rem;
    margin-top: -12px;
    text-align: right;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* ===== TABLES ===== */
.table-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.summary-bar {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9rem;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 800px;
}

th,
td {
    padding: var(--space-md) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: normal;
    vertical-align: middle;
}

td:nth-child(6),
td:nth-child(7),
td:nth-child(8) {
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

#pinnedFlightsTableBody td {
    border-bottom: 1px solid var(--primary);
}

#pinnedFlightsTableBody:not(:empty)+thead {
    border-top: 2px solid var(--primary);
}

th {
    background-color: var(--background);
    color: var(--text);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th:first-child,
td:first-child {
    padding-left: var(--space-lg);
}

th:last-child,
td:last-child {
    padding-right: var(--space-lg);
}

th.sortable {
    cursor: pointer;
}

th.sortable:hover {
    background-color: var(--border);
}

th .sort-icon {
    margin-left: var(--space-xs);
    opacity: 0.6;
}

tbody tr:hover {
    background-color: var(--background);
}

.flight-number {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.flight-number:hover {
    text-decoration: underline;
}

/* ===== PINNED & CHEAP FLIGHT ROWS ===== */
.pinned-row {
    background-color: rgba(0, 123, 255, 0.05);
}

.dark-mode .pinned-row {
    background-color: rgba(77, 171, 247, 0.1);
}

.cheap-flight-row {
    background-color: rgba(255, 193, 7, 0.1);
}

.dark-mode .cheap-flight-row {
    background-color: rgba(255, 193, 7, 0.15);
}

.cheap-flight-row:hover {
    background-color: rgba(255, 193, 7, 0.2);
}

.pinned-row.pinned-expired td {
    color: var(--danger) !important;
    text-decoration: line-through;
    opacity: 0.7;
}

.pinned-row.pinned-expired .flight-number {
    color: var(--danger) !important;
}

.btn-pin-action {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: var(--space-sm);
    font-size: 1rem;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-pin-action:hover {
    color: var(--primary);
    background-color: var(--background);
}

.price-info-icon {
    margin-left: 8px;
    color: var(--text-light);
    cursor: help;
}

/* ===== COMPACT RESULTS ===== */
.compact-result {
    line-height: 1.4;
}

.compact-result-primary {
    font-weight: 600;
    font-size: 1rem;
}

.compact-result-secondary {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: var(--space-xs);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
}

.compact-result-secondary span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.compact-result-secondary .highlight {
    color: var(--primary);
    font-weight: 500;
}

/* ===== DETAILS VIEW ===== */
.details-container-cell {
    padding: 0 !important;
}

.favorite-match-list .details-container-cell {
    border-bottom: none;
}

.details-view {
    padding: var(--space-lg);
    background: var(--background);
}

.details-leg {
    margin-bottom: var(--space-md);
}

.details-leg:last-child {
    margin-bottom: 0;
}

.details-leg-title {
    font-weight: 600;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
}

.details-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: var(--space-sm);
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.details-label {
    color: var(--text-light);
}

.layover-info {
    font-weight: 500;
    padding: 8px;
    margin-top: 8px;
    background: var(--background);
    border-radius: 8px;
    border-left: 3px solid var(--secondary);
}

.color-green {
    color: var(--success);
    border-left-color: var(--success);
}

.color-yellow {
    color: var(--warning);
    border-left-color: var(--warning);
}

.color-red {
    color: var(--danger);
    border-left-color: var(--danger);
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: var(--space-sm);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.expand-btn i {
    transition: transform 0.2s ease;
}

.expand-btn.expanded i {
    transform: rotate(180deg);
}

/* ===== NO RESULTS ===== */
.no-results {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    color: var(--text-light);
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.no-results div {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===== INFO BOX ===== */
.info-box {
    display: flex;
    align-items: start;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: calc(var(--radius) - 4px);
    background-color: rgba(0, 123, 255, 0.08);
    border-left: 4px solid var(--primary);
    font-size: 0.9rem;
}

.dark-mode .info-box {
    background-color: rgba(77, 171, 247, 0.1);
}

.info-box i {
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 3px;
}

.info-box p {
    line-height: 1.5;
    margin: 0;
}

.info-box ul {
    list-style-position: inside;
    padding-left: 0;
    margin-top: var(--space-sm);
}

.info-box li {
    margin-bottom: var(--space-xs);
}

/* ===== WATCHLIST & FAVORITES ===== */
#favoritesManagementSection h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.watchlist-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.watchlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.watchlist-route-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.watchlist-route-text .fa-arrow-right {
    margin: 0 var(--space-sm);
    color: var(--text-light);
    font-size: 0.9em;
}

.favorite-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.favorite-controls .radio-group {
    font-size: 0.9rem;
}

.watchlist-footer {
    padding: var(--space-md);
    background: var(--background);
    border-top: 1px solid var(--border);
}

.notification-info,
.notification-adder {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.9rem;
}

.btn-remove-favorite {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-remove-favorite:hover {
    background: var(--danger);
    color: white;
}

.favorite-match-list {
    padding: var(--space-sm) var(--space-md);
}

.favorite-match-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
}

.favorite-match-item-wrapper:not(:last-child) .favorite-match-item {
    border-bottom: 1px dashed var(--border);
}

.favorite-match-item.excluded {
    opacity: 0.65;
}

.dark-mode .favorite-match-item.excluded {
    opacity: 0.5;
}

.favorite-match-item.excluded:hover {
    opacity: 1;
}

.favorite-match-item .path-content {
    flex-grow: 1;
}

.favorite-match-item .path-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.path-actions .expand-btn {
    color: var(--text-light);
}

.path-actions .expand-btn:hover {
    color: var(--primary);
}

.route-path-summary .path {
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-size: 1rem;
}

.route-path-summary .details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
    font-size: 0.9rem;
    color: var(--text-light);
}

.route-path-summary .details span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.no-favorite-match {
    padding: var(--space-md);
    color: var(--text-light);
    font-style: italic;
    text-align: center;
}

.favorite-match-list h5 {
    font-size: 0.9rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.favorite-match-list h5:first-child {
    margin-top: 0;
}

.date-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.date-tag {
    background-color: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

.btn-remove-single-date {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-left: 6px;
    cursor: pointer;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    padding: 0;
}

.btn-remove-single-date:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.modal-content {
    background-color: var(--card-bg);
    color: var(--text);
    margin: auto;
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-md);
}

.modal-close-btn {
    color: var(--text-light);
    position: absolute;
    top: var(--space-md);
    right: var(--space-lg);
    font-size: 2rem;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    color: var(--text);
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.info-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.info-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.info-section h3 {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: var(--space-md);
    color: var(--primary);
}

.info-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
}

.info-section p,
.info-section li {
    line-height: 1.7;
    font-size: 0.95rem;
    color: var(--text-light);
}

.info-section li {
    margin-bottom: var(--space-md);
}

.info-section strong {
    color: var(--text);
    font-weight: 600;
}

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

.info-section li {
    padding-left: 1.5em;
    position: relative;
}

.info-section li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.info-section code {
    background-color: var(--background);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.info-section .fa-solid,
.info-section .fas {
    width: 20px;
    text-align: center;
    margin-right: var(--space-sm);
    color: var(--secondary);
}

/* ===== ROUTE CARDS ===== */
.route-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-md);
    transition: var(--transition);
}

.route-card:hover {
    box-shadow: var(--shadow-md);
}

.route-card-header {
    width: 100%;
    background: transparent;
    border: none;
    padding: var(--space-md);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    cursor: pointer;
}

.route-card-header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.route-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.3;
}

.route-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-lg);
    font-size: 0.9rem;
    color: var(--text-light);
}

.route-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.route-card-meta i {
    color: var(--primary);
}

.route-card-fees {
    font-weight: 600;
    color: black;
}

.dark-mode .route-card-fees {
    color: white;
}

.route-card-chevron {
    margin-left: auto;
    color: var(--text-light);
    transition: transform 0.2s ease;
}

.route-card-header.expanded .route-card-chevron {
    transform: rotate(180deg);
}

.route-card-details {
    padding: 0 var(--space-md) var(--space-md) var(--space-md);
    display: none;
    border-top: 1px solid var(--border);
    background: var(--background);
}

.route-card-details.open {
    display: block;
}

.full-route-display {
    padding: var(--space-md) !important;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.route-summary {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.route-path {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}

.route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    font-size: 0.9rem;
    color: var(--text-light);
}

.route-meta span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ===== FLIGHT TIMELINE ===== */
.flight-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    background-color: var(--background);
    border-radius: var(--radius);
    padding: var(--space-sm);
}

.timeline-flight {
    background: var(--card-bg);
    border-radius: calc(var(--radius) - 2px);
    padding: var(--space-sm);
    border: 1px solid var(--border);
    margin-bottom: 2px;
}

.flight-info-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-sm);
    align-items: center;
    min-height: 32px;
}

.airport-info {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-width: 0;
}

.airport-code {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.departure-time,
.arrival-time {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
    margin: 0;
    white-space: nowrap;
}

.flight-details-compact {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-width: 0;
    flex: 1;
}

.flight-line {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.flight-number-badge {
    background-color: var(--primary);
    color: white;
    padding: 2px var(--space-xs);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.flight-number-badge.price-badge {
    background-color: var(--success);
}

.flight-number-badge a {
    color: white;
    text-decoration: none;
}

.flight-number-badge a:hover {
    text-decoration: underline;
}

.flight-price-badge {
    background-color: var(--success);
    color: white;
    padding: 2px var(--space-xs);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.flight-price-badge:hover {
    background-color: #1e7e34;
    transform: scale(1.05);
}

.flight-price-badge i {
    font-size: 0.65rem;
}

.flight-duration {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.flight-date {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-left: var(--space-xs);
}

.timeline-layover {
    margin: 1px 0;
    position: relative;
    padding: var(--space-xs) 0;
}

.layover-line {
    height: 1px;
    background: var(--border);
    margin: 2px var(--space-lg);
    position: relative;
}

.layover-line::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.timeline-layover.layover-medium .layover-line::before {
    background: var(--warning);
}

.timeline-layover.layover-tight .layover-line::before {
    background: var(--danger);
}

.layover-info-compact {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
    line-height: 1.2;
}

.layover-info-compact i {
    font-size: 0.65rem;
}

.timeline-layover.layover-good .layover-info-compact {
    color: var(--success);
}

.timeline-layover.layover-medium .layover-info-compact {
    color: var(--warning);
}

.timeline-layover.layover-tight .layover-info-compact {
    color: var(--danger);
}

/* ===== FILTER PRESETS ===== */
.presets-section {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: var(--space-md);
}

.presets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    padding: var(--space-xs) 0;
}

.presets-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.presets-title i {
    color: var(--warning);
    font-size: 0.9rem;
}

.presets-count {
    font-size: 0.75rem;
    color: var(--text-light);
    background: var(--background);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.presets-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.preset-card {
    position: relative;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: var(--space-sm) var(--space-md);
    padding-right: 32px;
    transition: var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    max-width: 100%;
}

.preset-card:hover {
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

.preset-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}

.preset-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.preset-delete-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    opacity: 0.6;
}

.preset-card:hover .preset-delete-btn {
    opacity: 1;
}

.preset-delete-btn:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-50%) scale(1.15);
}

.preset-meta {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
}

.preset-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.preset-tag.tag-departure {
    background: #17a2b8;
}

.preset-tag.tag-destination {
    background: #6f42c1;
}

.preset-tag.tag-stops {
    background: #fd7e14;
}

.preset-tag i {
    font-size: 0.65rem;
}

.preset-apply-hint {
    display: none;
}

.dark-mode .preset-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .preset-card:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.dark-mode .presets-count {
    background: rgba(255, 255, 255, 0.05);
}

/* ===== DISCLAIMER FOOTER ===== */
.disclaimer-footer {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    margin-top: var(--space-lg);
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.85rem;
}

.disclaimer-footer h4 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: var(--space-sm);
}

.disclaimer-footer p {
    margin-bottom: var(--space-md);
    line-height: 1.5;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */

/* Tablets and below (768px) */
@media (max-width: 768px) {
    body {
        padding: var(--space-sm);
        font-size: 14px;
    }

    .container {
        gap: var(--space-md);
    }

    header {
        margin-bottom: var(--space-lg);
    }

    .top-right-controls {
        position: static;
        justify-content: center;
        margin-top: var(--space-md);
        flex-wrap: wrap;
        width: 100%;
    }

    .top-right-controls .btn,
    .top-right-controls .dark-mode-btn {
        flex: 1;
        min-width: 0;
        max-width: 33.333%;
    }

    /* Hide desktop tabs, show mobile dropdown */
    .desktop-tabs {
        display: none !important;
    }

    .mobile-nav-dropdown {
        display: block;
    }

    /* Make tab container scrollable on mobile */
    .tab-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        gap: 4px;
        padding-bottom: 4px;
    }

    .tab-container::-webkit-scrollbar {
        height: 4px;
    }

    .tab-container::-webkit-scrollbar-track {
        background: var(--background);
        border-radius: 2px;
    }

    .tab-container::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 2px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: var(--space-sm);
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .filter-card {
        padding: var(--space-md);
        gap: var(--space-md);
    }

    .action-bar {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .action-bar .btn {
        width: 100%;
    }

    .toggle-controls-container {
        width: 100%;
        align-items: stretch;
        margin-left: 0;
    }

    .live-refresh-control,
    .cheap-flights-control {
        margin-left: 0;
        justify-content: space-between;
        width: 100%;
        padding-top: var(--space-sm);
        border-top: 1px solid var(--border);
    }

    table {
        min-width: 700px;
        font-size: 0.85rem;
    }

    th,
    td {
        padding: var(--space-sm) var(--space-sm);
    }

    th:first-child,
    td:first-child {
        padding-left: var(--space-sm);
    }

    th:last-child,
    td:last-child {
        padding-right: var(--space-sm);
    }

    .watchlist-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-lg);
    }

    .favorite-controls {
        width: 100%;
        justify-content: space-between;
    }

    .notification-info,
    .notification-adder {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }

    .modal-overlay {
        padding: var(--space-sm);
    }

    .modal-content {
        padding: var(--space-md);
        max-height: 95vh;
    }

    .modal-close-btn {
        top: var(--space-sm);
        right: var(--space-sm);
        font-size: 1.5rem;
    }

    .modal-content h2 {
        font-size: 1.25rem;
        padding-right: var(--space-xl);
    }

    .route-card-header {
        padding: var(--space-md);
    }

    .route-card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    .route-card-details {
        padding: 0 var(--space-sm) var(--space-sm) var(--space-sm);
    }

    .route-card-title {
        font-size: 1rem;
    }

    .route-path {
        font-size: 1rem;
        word-break: break-word;
    }

    .route-meta {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .compact-result {
        line-height: 1.3;
    }

    .compact-result-primary {
        font-size: 0.9rem;
        margin-bottom: var(--space-xs);
        word-break: break-word;
    }

    .compact-result-secondary {
        font-size: 0.8rem;
        flex-direction: column;
        gap: var(--space-xs);
        align-items: flex-start;
    }

    .compact-result-secondary span {
        margin-right: var(--space-sm);
    }

    .flight-info-row {
        grid-template-columns: auto 1fr auto;
        gap: var(--space-xs);
        font-size: 0.85rem;
    }

    .airport-code {
        font-size: 0.85rem;
    }

    .departure-time,
    .arrival-time {
        font-size: 0.75rem;
    }

    .flight-timeline {
        padding: var(--space-xs);
    }

    .timeline-flight {
        padding: var(--space-xs);
    }

    .flight-number-badge {
        font-size: 0.7rem;
        padding: 1px var(--space-xs);
    }

    .flight-duration {
        font-size: 0.7rem;
    }

    .flight-date {
        font-size: 0.65rem;
    }

    .layover-info-compact {
        font-size: 0.65rem;
    }

    .presets-grid {
        flex-direction: column;
    }

    .preset-card {
        width: 100%;
    }

    .preset-name {
        white-space: normal;
        overflow: visible;
    }

    .preset-meta {
        flex-wrap: wrap;
    }
}

/* Mobile phones and below (640px) */
@media (max-width: 640px) {
    .tab {
        padding: var(--space-sm);
        font-size: 0.9rem;
        min-width: 100px;
        justify-content: center;
    }

    .input-group input[type="number"],
    .input-group input[type="date"],
    .input-group input[type="email"] {
        height: 48px;
        font-size: 16px;
    }

    .btn {
        height: 48px;
        font-size: 1rem;
    }

    .expand-btn {
        padding: var(--space-md);
        font-size: 1rem;
    }

    .btn-pin-action {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .radio-group {
        gap: var(--space-md);
    }

    .radio-group label {
        gap: var(--space-md);
        padding: var(--space-sm);
        border-radius: var(--radius);
        transition: var(--transition);
    }

    .radio-group label:hover {
        background-color: var(--background);
    }

    .radio-group input[type="radio"],
    .radio-group input[type="checkbox"] {
        transform: scale(1.3);
        margin: 0;
    }

    .dropbtn {
        height: 48px;
        font-size: 0.9rem;
    }

    .dropdown-content label {
        padding: var(--space-md);
        font-size: 1rem;
    }

    .dropdown-content input[type="checkbox"],
    .dropdown-content input[type="radio"] {
        transform: scale(1.2);
        margin-right: var(--space-md);
    }

    table {
        min-width: 600px;
        font-size: 0.8rem;
    }

    th,
    td {
        padding: var(--space-xs) var(--space-xs);
    }

    .compact-result-primary {
        font-size: 0.9rem;
    }

    .compact-result-secondary {
        font-size: 0.8rem;
    }

    #roundtripsTableContainer table,
    #routeSearchTableContainer table {
        min-width: 100%;
        display: block;
        overflow-x: visible;
    }

    #roundtripsTableContainer thead,
    #routeSearchTableContainer thead,
    #roundtripsTableContainer tbody,
    #routeSearchTableContainer tbody,
    #roundtripsTableContainer th,
    #routeSearchTableContainer th,
    #roundtripsTableContainer td,
    #routeSearchTableContainer td,
    #roundtripsTableContainer tr,
    #routeSearchTableContainer tr {
        display: block;
    }

    #roundtripsTableContainer thead tr,
    #routeSearchTableContainer thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    #roundtripsTableContainer tr,
    #routeSearchTableContainer tr {
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: var(--space-md);
        padding: var(--space-md);
        position: relative;
    }

    #roundtripsTableContainer td,
    #routeSearchTableContainer td {
        border: none;
        padding: var(--space-sm) 0;
        position: relative;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    #roundtripsTableContainer td:first-child,
    #routeSearchTableContainer td:first-child {
        margin-bottom: var(--space-md);
        padding-bottom: var(--space-md);
        border-bottom: 1px solid var(--border);
    }

    #roundtripsTableContainer .compact-result-primary,
    #routeSearchTableContainer .compact-result-primary {
        font-size: 1rem;
        font-weight: 600;
        color: var(--primary);
        margin-bottom: var(--space-sm);
    }

    #roundtripsTableContainer .compact-result-secondary,
    #routeSearchTableContainer .compact-result-secondary {
        display: flex;
        flex-direction: column;
        gap: var(--space-xs);
        font-size: 0.85rem;
    }

    #roundtripsTableContainer .expand-btn,
    #routeSearchTableContainer .expand-btn {
        width: 100%;
        justify-content: center;
        margin-top: var(--space-sm);
        padding: var(--space-md);
        background-color: var(--background);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        font-size: 0.9rem;
    }

    .details-container-cell {
        padding: var(--space-md) !important;
        background-color: var(--background);
        border-radius: var(--radius);
        margin-top: var(--space-sm);
    }

    .details-view {
        padding: var(--space-sm);
    }

    .details-row {
        grid-template-columns: 80px 1fr;
        gap: var(--space-sm);
        font-size: 0.85rem;
    }

    .details-label {
        font-size: 0.8rem;
        font-weight: 500;
    }

    .flight-line {
        flex-direction: column;
        gap: 2px;
        align-items: center;
    }

    .flight-info-row {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
        text-align: center;
    }

    .airport-info {
        justify-content: center;
    }

    .flight-details-compact {
        order: -1;
        margin-bottom: var(--space-xs);
    }

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

    .notification-info .btn-remove-notification {
        align-self: flex-end;
    }

    #favoritesManagementSection>.filter-grid:nth-of-type(2) {
        grid-template-columns: 1fr;
    }

    #favoritesManagementSection>.filter-grid:nth-of-type(2)>.btn {
        grid-column: auto;
    }
}

/* Very small screens (480px and below) */
@media (max-width: 480px) {
    body {
        padding: var(--space-xs);
        font-size: 13px;
    }

    :root {
        --input-height: 48px;
        --space-xs: 6px;
        --space-sm: 10px;
        --space-md: 12px;
        --space-lg: 16px;
        --space-xl: 20px;
    }

    .btn-bmc span {
        display: none;
    }

    .btn-bmc {
        width: var(--input-height);
        padding: 0;
    }

    .compact-result-primary {
        font-size: 0.85rem;
        line-height: 1.2;
        word-break: break-all;
    }

    .compact-result-secondary {
        font-size: 0.75rem;
    }

    .expand-btn {
        font-size: 0.85rem;
        padding: var(--space-sm);
    }

    .details-row {
        grid-template-columns: 70px 1fr;
        font-size: 0.8rem;
    }
}

/* ===== ADVANCED MONITORING STYLES ===== */
.weekday-selector {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--background);
    border-radius: var(--radius);
}

.weekday-selector label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.weekday-selector label:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.weekday-selector input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.weekday-selector input[type="checkbox"]:checked+span,
.weekday-selector label:has(input[type="checkbox"]:checked) {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

.advanced-form-section {
    background: var(--card-bg);
    padding: var(--space-lg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: var(--space-lg);
}

.advanced-form-section h3 {
    color: var(--primary);
    font-size: 1.2rem;
}

.advanced-form-section .subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

#advancedMonitoringList {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.monitoring-item {
    background: var(--card-bg);
    padding: var(--space-lg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    transition: var(--transition);
}

.monitoring-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.monitoring-item-content {
    flex: 1;
}

.monitoring-item-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.monitoring-item-type.one-stop {
    background: #e3f2fd;
    color: #1976d2;
}

.monitoring-item-type.roundtrip {
    background: #e8f5e9;
    color: #388e3c;
}

.monitoring-item-type.recurring {
    background: #fff3e0;
    color: #f57c00;
}

.monitoring-item-route {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.monitoring-item-details {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.monitoring-item-detail {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.monitoring-item-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-delete-monitoring {
    padding: var(--space-sm) var(--space-md);
    background: var(--danger);
    color: white;
    border: none;
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-delete-monitoring:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Weekday badges */
.weekday-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 4px;
}

/* Toggle specific styles for advanced mode */
#advancedModeSection .toggle-controls-container {
    margin: var(--space-md) 0;
}

/* Loading state */
.monitoring-loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-light);
}

.monitoring-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-light);
    font-style: italic;
}

/* Success/Error messages for advanced forms */
.form-message {
    padding: var(--space-md);
    border-radius: calc(var(--radius) / 2);
    margin-top: var(--space-md);
    font-weight: 500;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Large tablets (1024px and below) */
@media (max-width: 1024px) {
    table {
        min-width: 700px;
        font-size: 0.85rem;
    }

    th,
    td {
        padding: var(--space-sm) var(--space-sm);
    }

    th:first-child,
    td:first-child {
        padding-left: var(--space-sm);
    }

    th:last-child,
    td:last-child {
        padding-right: var(--space-sm);
    }
}

/* ===================================
   ADVANCED MODE STYLES
   Add these to styles.css
   =================================== */

/* Weekday Selector */
.weekday-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.weekday-selector label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.weekday-selector input[type="checkbox"] {
    display: none;
}

.weekday-selector span {
    display: inline-block;
    padding: 8px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    transition: all 0.2s ease;
}

.weekday-selector input[type="checkbox"]:checked+span {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.weekday-selector span:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Advanced Tab Navigation */
.tab-container [data-advanced-tab] {
    display: flex;
    align-items: center;
    gap: 8px;
}

.advanced-tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Toggle Control Enhancement */
.toggle-controls-container {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-control input[type="checkbox"] {
    display: none;
}

.toggle-control input[type="checkbox"]:checked~.toggle-slider {
    background: var(--primary);
}

.toggle-control input[type="checkbox"]:checked~.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

/* Notification Type Badge */
.notification-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.notification-type-badge.direct {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.notification-type-badge.onestop {
    background: rgba(102, 126, 234, 0.1);
    color: #764ba2;
}

.notification-type-badge.roundtrip {
    background: rgba(17, 153, 142, 0.1);
    color: #11998e;
}

.notification-type-badge.recurring {
    background: rgba(240, 147, 251, 0.1);
    color: #f5576c;
}

/* Enhanced Info Box */
.info-box {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--card-bg);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
}

.info-box i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.info-box li {
    margin-bottom: 6px;
}

/* Filter Grid Enhancement */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    align-items: start;
}

/* Input Group Styling */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
}

.input-group input[type="date"],
.input-group input[type="number"],
.input-group input[type="email"],
.input-group select {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
    transition: all 0.2s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}

/* Button Enhancements */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--primary);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .weekday-selector {
        justify-content: center;
    }

    .action-bar {
        justify-content: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Notification Tab Content */
.notification-tab-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* ============================================================================
   NOTIFICATION COMPONENTS STYLING
   ============================================================================ */

/* Notification Tab Content */
.notification-tab-content {
    animation: fadeIn 0.3s ease-in;
}

/* Subtitle in notification tabs */
.notification-tab-content .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Input groups in notification forms */
.notification-tab-content .input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.notification-tab-content .input-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.notification-tab-content input[type="date"],
.notification-tab-content input[type="email"],
.notification-tab-content input[type="number"],
.notification-tab-content select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.notification-tab-content input:focus,
.notification-tab-content select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Dropdown buttons in notification forms */
.notification-tab-content .dropbtn {
    width: 100%;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    font-size: 0.95rem;
}

.notification-tab-content .dropbtn:hover {
    border-color: var(--primary);
    background: var(--hover-bg);
}

/* Weekday selector - compact grid */
.weekday-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-xs);
}

.weekday-selector label {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.weekday-selector span {
    display: block;
    padding: 8px 4px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.weekday-selector label:hover span {
    border-color: var(--primary);
    background: var(--hover-bg);
}

.weekday-selector input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.weekday-selector input[type="checkbox"]:checked+span {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Action bar in notification tabs */
.notification-tab-content .action-bar {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.notification-tab-content .btn {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-tab-content .btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

/* Manage link styling */
.notification-tab-content a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.notification-tab-content a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Filter grid adjustments for notification forms */
#favoritesManagementSection .filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .weekday-selector {
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
    }

    .weekday-selector span {
        padding: 6px 2px;
        font-size: 0.75rem;
    }

    #favoritesManagementSection .filter-grid {
        grid-template-columns: 1fr;
    }
}

/* Notification dropdowns inherit all global dropdown styles */

/* Select styling for Trip Type and Frequency */
.notification-tab-content select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
    cursor: pointer;
}

.notification-tab-content select:hover {
    border-color: var(--primary);
}

/* Date input styling */
.notification-tab-content input[type="date"] {
    cursor: pointer;
    position: relative;
}

.notification-tab-content input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    filter: invert(0.5);
}

.notification-tab-content input[type="date"]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

/* Dark mode adjustments */
body.dark-mode .notification-tab-content input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Weekday Multiselect Dropdown */
.weekday-multiselect {
    min-width: 200px;
}

.weekday-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: var(--text);
    font-size: 0.9rem;
    user-select: none;
}

.weekday-option:hover {
    background: var(--hover-bg);
}

.weekday-option input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Prevent dropdown close on checkbox click */
.weekday-multiselect label {
    margin: 0;
}

.weekday-multiselect {
    min-width: 200px;
}

.weekday-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: var(--text);
    font-size: 0.9rem;
    user-select: none;
}

.weekday-option:hover {
    background: var(--hover-bg);
}

.weekday-option input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.weekday-multiselect label {
    margin: 0;
}


/* Notification Tab - Responsive Text & Badge */
.notification-tab-text::before {
    content: "E-mail notification";
}

.new-badge {
    display: inline-block !important;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(255, 82, 82, 0.3);
}

@media (max-width: 768px) {
    .notification-tab-text::before {
        content: "Notifications";
    }

    .new-badge {
        display: inline-block !important;
        font-size: 7px !important;
        padding: 1px 4px !important;
        margin-left: 4px !important;
    }
}

/* ===== MULTI-AIRPORT SELECTOR STYLES ===== */

/* Checkbox styling in dropdown labels */
.dropdown-content label .airport-checkbox {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

/* Selected label highlighting */
.dropdown-content.multi-select-active label.selected {
    background: rgba(102, 126, 234, 0.1) !important;
    border-left: 3px solid #667eea;
    padding-left: 13px !important;
}

.dropdown-content.multi-select-active label {
    padding-left: 16px;
}

.dropdown-content label {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-content label:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Dark mode adjustments */
:root.dark-mode .dropdown-content.multi-select-active label.selected {
    background: rgba(102, 126, 234, 0.2) !important;
}

:root.dark-mode .dropdown-content label:hover {
    background-color: rgba(102, 126, 234, 0.08);
}

/* ===== COMMUNITY FORM CONTROLS ===== */
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

:root.dark-mode .form-control:focus {
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.2);
}

.form-checkbox,
.form-radio {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Radio-Gruppe mit gleichem Style wie Input-Felder */
.radio-group {
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* Einheitlicher Hintergrund für Dark Mode */
:root.dark-mode .radio-group {
    background: var(--card-bg) !important;
    border-color: var(--border) !important;
}

:root.dark-mode .radio-group label {
    color: var(--text) !important;
}

/* Transport fields styling */
.transport-fields {
    padding: 15px;
    background: var(--background);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

/* Community data display */
#communityDataDisplay {
    margin-top: var(--space-lg);
}

/* Collapsible Categories */
.collapsible-category {
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
}

.collapsible-header {
    padding: 16px;
    background: var(--surface);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
    user-select: none;
}

.collapsible-header:hover {
    background: var(--hover);
}

.collapsible-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.collapsible-title i {
    color: var(--primary);
    width: 20px;
}

.verification-tag {
    font-size: 11px;
    background: #4caf50;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.collapsible-arrow {
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.open {
    max-height: 2000px;
}

.category-items {
    padding: 16px;
}

.community-data-item {
    padding: 10px 0;
}

.community-data-item:first-child {
    padding-top: 0;
}

.community-data-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.community-data-label i {
    color: var(--primary);
    width: 16px;
}

.community-data-value {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.community-data-value a {
    color: var(--primary);
    text-decoration: none;
    word-break: break-all;
}

.community-data-value a:hover {
    text-decoration: underline;
}

/* Custom Airport Dropdown for View Mode */
.custom-airport-dropdown {
    position: relative;
    width: 100%;
}

.airport-dropdown-display {
    width: 100%;
    padding: 12px 40px 12px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.airport-dropdown-display:hover {
    border-color: var(--primary);
}

.airport-dropdown-display .placeholder-text {
    color: var(--text-muted);
}

.airport-dropdown-display i {
    color: var(--text-muted);
}

.airport-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.community-data-section {
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.community-data-section h4 {
    color: var(--primary);
    margin-bottom: var(--space-md);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.community-data-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.community-data-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 4px;
}

.community-data-value {
    color: var(--text);
    font-size: 14px;
}

.community-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.community-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--background);
    border-radius: 6px;
}

.community-checkbox-item i {
    color: var(--success);
    font-size: 14px;
}

.community-text-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.community-text-item {
    padding: 12px;
    margin-bottom: 10px;
    background: var(--background);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.community-text-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-light);
}

.community-text-item-content {
    color: var(--text);
    line-height: 1.5;
}

/* Improved dark mode styling */
:root.dark-mode .community-data-section {
    background: #252525;
    border-color: #3a3a3a;
}

:root.dark-mode .community-checkbox-item {
    background: #1a1a1a;
}

:root.dark-mode .community-text-item {
    background: #1a1a1a;
}

:root.dark-mode .transport-fields {
    background: #1a1a1a;
}

:root.dark-mode .radio-group label {
    color: var(--text);
}

/* Scrollbar styling for text lists */
.community-text-list::-webkit-scrollbar {
    width: 6px;
}

.community-text-list::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 3px;
}

.community-text-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.community-text-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Mobile responsive layout for community section */
@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-sm);
    }

    .tab-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tab {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
        font-size: 14px;
        padding: 10px 8px;
    }

    .radio-group {
        flex-direction: column;
        align-items: stretch;
    }

    .radio-group label {
        width: 100%;
        text-align: left;
        justify-content: flex-start;
    }

    .transport-fields {
        padding: 10px;
    }

    .community-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .community-data-section {
        padding: var(--space-sm);
    }

    .form-group label {
        font-size: 13px;
    }

    .form-control,
    .form-checkbox,
    select {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .tab {
        flex: 1 1 100%;
        font-size: 13px;
        padding: 8px 6px;
    }

    .new-badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    .community-tabs .tab {
        font-size: 13px;
        padding: 8px 12px;
    }

    .form-group {
        margin-bottom: var(--space-sm);
    }
}


/* ===== LOCAL TRACKING STYLES ===== */
#localTrackingList {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.local-tracking-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    transition: var(--transition);
}

.local-tracking-card:hover {
    border-color: var(--primary);
    background-color: #f8f9fa;
}

:root.dark-mode .local-tracking-card:hover {
    background-color: #2a2a2a;
}

.local-tracking-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.local-tracking-route {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 15px;
    font-weight: 600;
    min-width: 200px;
}

.local-tracking-route .airport-code {
    font-family: 'Courier New', monospace;
    color: var(--primary);
    font-weight: 700;
}

.local-tracking-route .route-arrow {
    color: var(--text-light);
    font-size: 12px;
}

.local-tracking-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.local-tracking-actions {
    display: flex;
    gap: var(--space-sm);
}

.local-tracking-actions .btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

#localTrackingList:empty:before {
    content: 'No local tracked routes yet. Add one above to get started.';
    display: block;
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-light);
    font-style: italic;
}

@media (max-width: 768px) {
    .local-tracking-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .local-tracking-info {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
        width: 100%;
    }

    .local-tracking-actions {
        width: 100%;
    }

    .local-tracking-actions .btn {
        flex: 1;
    }
}

/* Pagination footer */
.pagination-footer {
    display: flex;
    justify-content: center;
    padding: var(--space-md);
}

.pager {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    justify-content: center;
}

.pager-btn,
.pager-number {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    min-width: 40px;
    transition: all 0.15s ease;
}

.pager-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.pager-number.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pager-number:hover:not(.active),
.pager-btn:hover:not([disabled]) {
    background: var(--primary-light, rgba(82, 110, 255, 0.1));
    border-color: var(--primary);
}

.pager-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.pager-ellipsis {
    padding: 8px 10px;
    color: var(--text-light);
    user-select: none;
}

.pager-size {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.pager-size select {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    min-width: 80px;
}

.pager-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}
/* History View Styles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr); /* Force 2 columns */
    gap: var(--space-xs); /* Smaller gap */
  }
  
  .stat-card {
    padding: var(--space-sm); /* Smaller padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100px; /* Ensure consistent height */
  }
  
  .stat-value {
    font-size: 1.2rem; /* Smaller font */
    line-height: 1.2;
    margin-bottom: 4px;
  }
  
  .stat-label {
    font-size: 0.75rem; /* Smaller label */
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

.stat-card {
  background: var(--card-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-xs);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chart-container {
  background: var(--card-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 60px; /* Significantly increased margin to prevent overlap */
  position: relative;
  height: 450px; /* Increased height for labels */
  /* overflow: hidden; Removed to prevent clipping of labels */
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  flex-direction: column;
}

body.dark-mode .loading-overlay {
  background: rgba(15, 23, 42, 0.8);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-md);
}

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

/* Scrollable History Table */
.history-table-container {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg); /* Ensure background in dark mode */
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: auto; /* Override global min-width if any */
}

.history-table thead th {
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
  box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
  padding: 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.history-table td {
  padding: 10px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 600px) {
  .history-table th, 
  .history-table td {
    padding: 8px 4px;
    font-size: 0.85rem;
  }
}

/* Fix footer overlap */
#historyDashboardContent {
  /* padding-bottom: var(--space-xl); */
  /* margin-bottom: var(--space-xl); */
}
