/**
 * BFL Flight Display Styles
 * v2.3.1
 * Fixes: button active/focus state (white text on teal), uniform row height,
 *        sticky thead, seamless detail rows, CSS-only search icon (correct size),
 *        tab counts removed, pagination label text restored.
 */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Open+Sans:wght@400;500;600&display=swap');

/* ─── Variables ──────────────────────────────────────────────────── */
:root {
    --bfl-blue: #093547;
    --bfl-blue-hover: #062636;
    --bfl-orange:    #C04C28;
    --bfl-gray:      #484D56;

    --text-primary:  #1a1f2e;
    --text-secondary:#4b5563;
    --text-muted:    #6b7280;   /* was #9ca3af (2.54:1) — now 4.83:1 ✓ SC 1.4.3 */
    --text-delay:    #C04C28;

    /* Status — all ≥ 4.5:1 WCAG AA */
    --good-bg:       #eef2e8;
    --good-text:     #4A6520;   /* was #5E782C (4.41:1 fail); #4A6520 = 5.83:1 ✓ SC 1.4.3 */
    --departed-bg:   #eeeef0;
    --departed-text: #484D56;
    --delay-bg:   #fff3ed;
    --delay-text: #C04C28;
    --cancel-bg:  #fdf2f2;
    --cancel-text:#9b2c2c;

    --border-light:  #f0f2f5;
    --border-medium: #e2e5ea;
    /* SC 1.4.11 — interactive control borders need 3:1 on white.
       #878e98 = 3.31:1. Used on inputs, selects, and filter buttons. */
    --border-ui:     #878e98;

    --card-bg:     #ffffff;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.07),0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.10),0 2px 4px rgba(0,0,0,0.06);
    --page-bg:     #f4f6f9;

    /* SC 1.4.11 — focus indicator needs 3:1.
       White inner ring + teal outer ring works on any background:
       on white: teal outer = 5.46:1 ✓   on teal: white inner = 5.46:1 ✓ */
    --focus-ring:  0 0 0 2px #ffffff, 0 0 0 4px #093547;
    --focus-color: #093547;

    /* In-flight: BFL blue tint (#093547 on #e8eff2 ≈ 8.5:1 ✓ WCAG AA) */
    --inflight-bg:   #e8eff2;
    --inflight-text: #093547;

    /* Arrived early: same as good/green */
    --early-bg:   #eef2e8;
    --early-text: #4A6520;     /* was #5E782C (4.41:1 fail); #4A6520 = 5.83:1 ✓ SC 1.4.3 */
}

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

/* ─── Container ───────────────────────────────────────────────────── */
.bfl-flights {
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
    max-width: 1100px;
    margin: 0 auto;
    background: transparent;
    padding: 0 0 32px;
}

/* Force white background on the table area so page theme bg doesn't bleed through */
.bfl-flights__table-wrapper {
    background: #ffffff;
    border-radius: 0 0 12px 12px;
}

/* ─── Tabs ────────────────────────────────────────────────────────── */
.bfl-flights__tabs {
    display: flex;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-medium);
    border-radius: 12px 12px 0 0;
    padding: 0 8px;
    margin-bottom: 16px;
}

.bfl-flights__tab {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 16px 20px 13px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    -webkit-appearance: none;
    /* Fix: explicit :active state so browser default doesn't invert */
    -webkit-tap-highlight-color: transparent;
}

.bfl-flights__tab:hover { color: var(--text-primary); }

/* WCAG focus — no outline on mouse click, visible on keyboard */
.bfl-flights__tab:focus          { outline: none; }
.bfl-flights__tab:focus-visible  { box-shadow: var(--focus-ring); outline: none; border-radius: 4px 4px 0 0; }

.bfl-flights__tab--active {
    color: var(--bfl-blue) !important;
    border-bottom-color: var(--bfl-orange);
}

/* Explicit :active to override UA default for all buttons */
.bfl-flights__tab:active { color: var(--bfl-blue); background: none; }

/* ─── Filters bar ─────────────────────────────────────────────────── */
.bfl-flights__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: 10px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

/* Search — icon is pure CSS, no DOM SVG */
.bfl-flights__search { flex: 2; min-width: 240px; position: relative; }

.bfl-flights__search-input {
    width: 100%;
    height: 42px;
    padding: 0 14px 0 44px;
    border: 1.5px solid var(--border-ui);  /* SC 1.4.11: 3.31:1 on white */
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    box-sizing: border-box;
    background-color: #fafbfc;
    /* Small 16×16 magnifying glass encoded inline — no external request */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 16px 16px;
    transition: border-color 0.15s, background-color 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

.bfl-flights__search-input:focus {
    outline: none;
    border-color: var(--bfl-blue);
    background-color: #fff;
    box-shadow: var(--focus-ring);
}

.bfl-flights__search-input::placeholder { color: var(--text-muted); }

/* Remove native clear button on search inputs */
.bfl-flights__search-input::-webkit-search-cancel-button { display: none; }

/* Airline select */
.bfl-flights__airline-select {
    height: 42px;
    min-width: 150px;
    padding: 0 30px 0 12px;
    border: 1.5px solid var(--border-ui);  /* SC 1.4.11 */
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: #fafbfc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    box-sizing: border-box;
}

.bfl-flights__airline-select:focus {
    outline: none;
    border-color: var(--bfl-blue);
    box-shadow: var(--focus-ring);
}

/* Mobile-only selects: hidden on desktop, shown at 600px */
.bfl-flights__mobile-select { display: none; }

/* Day filter buttons */
.bfl-flights__day-filter { display: flex; gap: 4px; }

.bfl-flights__day-filter-btn {
    height: 42px;
    padding: 0 16px;
    border: 1.5px solid var(--border-ui);  /* SC 1.4.11 */
    border-radius: 8px;
    background: #fafbfc;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.bfl-flights__day-filter-btn:hover {
    border-color: var(--bfl-blue);
    color: var(--bfl-blue);
    background: #fff;
}

/* Fix: active and focus states explicitly defined so UA doesn't invert */
.bfl-flights__day-filter-btn:active           { background: var(--bfl-blue); border-color: var(--bfl-blue); color: #fff; }
.bfl-flights__day-filter-btn:focus            { outline: none; }
.bfl-flights__day-filter-btn:focus-visible    { box-shadow: var(--focus-ring); outline: none; }

.bfl-flights__day-filter-btn--active {
    background: var(--bfl-blue) !important;
    border-color: var(--bfl-blue) !important;
    color: #fff !important;
}

.bfl-flights__day-filter-btn--active:hover {
    background: var(--bfl-blue-hover) !important;
    border-color: var(--bfl-blue-hover) !important;
    color: #fff !important;
}

/* Sort toggle */
.bfl-flights__sort-toggle { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.bfl-flights__sort-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.bfl-flights__sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 14px;
    height: 38px;
    border: 1.5px solid var(--border-ui);  /* SC 1.4.11 */
    border-radius: 8px;
    background: #fafbfc;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.bfl-flights__sort-btn:hover { border-color: var(--bfl-blue); color: var(--bfl-blue); }
.bfl-flights__sort-btn:active { background: var(--bfl-blue); border-color: var(--bfl-blue); color: #fff; }
.bfl-flights__sort-btn:focus          { outline: none; }
.bfl-flights__sort-btn:focus-visible  { box-shadow: var(--focus-ring); outline: none; }

.bfl-flights__sort-btn--active {
    background: var(--bfl-blue) !important;
    border-color: var(--bfl-blue) !important;
    color: #fff !important;
}

.bfl-flights__sort-btn--active:hover {
    background: var(--bfl-blue-hover) !important;
    border-color: var(--bfl-blue-hover) !important;
    color: #fff !important;
}

/* ─── Pagination — earlier / later ───────────────────────────────── */
.bfl-flights__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    border: 1.5px solid var(--border-ui);  /* SC 1.4.11 */
    border-radius: 10px;
    background: var(--card-bg);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--bfl-blue);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin: 10px 0;
    box-shadow: var(--shadow-sm);
    -webkit-tap-highlight-color: transparent;
}

/* Fix: white text on teal, never invisible */
.bfl-flights__pagination:hover {
    background: var(--bfl-blue);
    border-color: var(--bfl-blue);
    color: #fff;
}

/* Critical fix: :active must also be teal+white, not whatever UA defaults to */
.bfl-flights__pagination:active {
    background: var(--bfl-blue-hover);
    border-color: var(--bfl-blue-hover);
    color: #fff;
}

.bfl-flights__pagination:focus          { outline: none; }
.bfl-flights__pagination:focus-visible  { box-shadow: var(--focus-ring); outline: none; }
/* After a click the button keeps :focus — reset so text/bg dont stay white */
.bfl-flights__pagination:focus:not(:hover):not(:active) {
    background: var(--card-bg);
    border-color: var(--border-medium);
    color: var(--bfl-blue);
}

.bfl-flights__pagination svg { flex-shrink: 0; }
.bfl-flights__pagination:hover svg,
.bfl-flights__pagination:active svg { color: #fff; }

/* ─── Table ────────────────────────────────────────────────────────── */
.bfl-flights__table-wrapper { overflow: visible; }

.bfl-flights__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;  /* vertical gap between card-rows */
    font-size: 14px;
    table-layout: fixed;
}

/* Column widths */
.bfl-flights__table col.col-time     { width: 120px; }
.bfl-flights__table col.col-airline  { width: 180px; }
.bfl-flights__table col.col-flight   { width: 105px; }
.bfl-flights__table col.col-location { width: auto; }
.bfl-flights__table col.col-status   { width: 235px; }
.bfl-flights__table col.col-gate     { width: 75px; }
.bfl-flights__table col.col-expand   { width: 44px; }

/* Sticky header — stays visible while scrolling; solid white background so rows don't bleed through */
.bfl-flights__table thead {
    /* z-index only — sticky is on th elements for better theme compat */
    position: relative;
    z-index: 10;
}

/* Opaque background so rows don't bleed through while scrolling. */
.bfl-flights__table thead tr { background: #fff !important; }

.bfl-flights__table thead th {
    padding: 6px 16px 10px !important;
    text-align: left !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    /* !important prevents theme stylesheets from re-uppercasing column headers */
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-secondary) !important;
    border: none !important;
    background: #fff !important;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 32px;
    z-index: 10;
}
body:not(.admin-bar) .bfl-flights__table thead th { top: 0; }

/* JS sticky clone — floats fixed over table when real header scrolls out of view */
.bfl-flights__sticky-clone {
    background: #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.10);
    border-bottom: 1px solid var(--border-light);
    table-layout: fixed;
    border-collapse: separate;
}
.bfl-flights__sticky-clone th {
    padding: 6px 16px 10px !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-secondary) !important;
    background: #fff !important;
    border: none !important;
    white-space: nowrap;
    text-align: left !important;
}

/* Each tbody row = white card with gap via border-spacing */
.bfl-flights__row {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.1s;
}

.bfl-flights__row:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    position: relative;
    z-index: 1;
}

.bfl-flights__row:focus-visible { outline: 2px solid var(--focus-color); outline-offset: -2px; box-shadow: var(--shadow-sm); z-index: 2; }

/* Rounded corners: left side on first td, right side on last td */
.bfl-flights__row td:first-child { border-radius: 10px 0 0 10px; }
.bfl-flights__row td:last-child  { border-radius: 0 10px 10px 0; }

/* When expanded: square off the bottom so detail row attaches flush */
.bfl-flights__row--expanded td:first-child { border-radius: 10px 0 0 0 !important; }
.bfl-flights__row--expanded td:last-child  { border-radius: 0 10px 0 0 !important; }
.bfl-flights__row--expanded { box-shadow: var(--shadow-md); transform: none; }

/* Status accent bar — left border of first cell */
.bfl-flights__row td:first-child {
    border-left: 4px solid var(--border-medium);
}

/* Sidebar accent colours — match pill colour logic
   Blue   = active/in-progress (on-time upcoming, in-flight, boarding)
   Green  = positive outcome (arrived/departed early)
   Gray   = completed neutral
   Orange = warning/negative (delayed, late)
   Red    = cancelled */
.bfl-flights__row[data-status="on-time"]       td:first-child,
.bfl-flights__row[data-status="in-flight"]     td:first-child,
.bfl-flights__row[data-status="boarding"]      td:first-child,
.bfl-flights__row[data-status="scheduled"]     td:first-child { border-left-color: var(--bfl-blue); }

.bfl-flights__row[data-status="arrived-early"] td:first-child { border-left-color: var(--good-text); }

.bfl-flights__row[data-status="arrived"]       td:first-child,
.bfl-flights__row[data-status="departed"]      td:first-child { border-left-color: var(--border-medium); }

.bfl-flights__row[data-status="delayed"]       td:first-child,
.bfl-flights__row[data-status="arrived-late"]  td:first-child { border-left-color: var(--bfl-orange); }

.bfl-flights__row[data-status="cancelled"]     td:first-child { border-left-color: var(--cancel-text); }

.bfl-flights__table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    background: var(--card-bg); /* Explicit white — tr background unreliable in some browsers */
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    /* Uniform row height — no wrapping */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bfl-flights__table tbody td:first-child { border-left: 4px solid var(--border-medium); }
.bfl-flights__table tbody td:last-child  { border-right: 1px solid var(--border-light); text-overflow: clip; overflow: visible; white-space: normal; }

/* ─── Detail row — seamlessly attached below parent ──────────────── */
.bfl-flights__details-row { display: none; }
.bfl-flights__details-row.is-visible { display: table-row; }

/* Hide via jQuery .toggle() — override display:none when JS shows it */
.bfl-flights__details-row[style*="display: table-row"],
.bfl-flights__details-row[style*="display:table-row"] { display: table-row !important; }

.bfl-flights__details-row td {
    padding: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    /* Default: neutral gray for completed/neutral statuses */
    background: var(--departed-bg) !important;
    border-top: none !important;
    border-bottom: 1px solid var(--border-medium) !important;
    border-left: 4px solid var(--border-medium) !important;
    border-right: 1px solid var(--border-medium) !important;
    border-radius: 0 0 10px 10px !important;
    box-shadow: var(--shadow-md);
}

/* Blue tint — active/in-progress statuses */
tr.bfl-flights__details-row[data-status="on-time"] td,
tr.bfl-flights__details-row[data-status="in-flight"] td,
tr.bfl-flights__details-row[data-status="boarding"] td,
tr.bfl-flights__details-row[data-status="scheduled"] td {
    background: var(--inflight-bg) !important;
    border-left-color: var(--bfl-blue) !important;
    border-bottom-color: rgba(9,53,71,0.12) !important;
    border-right-color: rgba(9,53,71,0.12) !important;
}

/* Green tint — arrived/departed early */
tr.bfl-flights__details-row[data-status="arrived-early"] td {
    background: var(--early-bg) !important;
    border-left-color: var(--good-text) !important;
    border-bottom-color: rgba(94,120,44,0.15) !important;
    border-right-color: rgba(94,120,44,0.15) !important;
}

/* Orange tint — delayed or arrived late */
tr.bfl-flights__details-row[data-status="delayed"] td,
tr.bfl-flights__details-row[data-status="arrived-late"] td {
    background: var(--delay-bg) !important;
    border-left-color: var(--bfl-orange) !important;
    border-bottom-color: rgba(192,76,40,0.15) !important;
    border-right-color: rgba(192,76,40,0.15) !important;
}

/* Red tint — cancelled */
tr.bfl-flights__details-row[data-status="cancelled"] td {
    background: var(--cancel-bg) !important;
    border-left-color: var(--cancel-text) !important;
    border-bottom-color: rgba(155,44,44,0.15) !important;
    border-right-color: rgba(155,44,44,0.15) !important;
}

.bfl-flights__details { padding: 18px 20px 20px 20px; }

.bfl-flights__details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px 24px;
}.bfl-flights__detail dt,
.bfl-flights__detail dd { margin: 0; padding: 0; text-align: left; }



.bfl-flights__detail { display: flex; flex-direction: column; gap: 4px; }

.bfl-flights__detail-label {
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-secondary) !important;
    margin-bottom: 2px;
}

.bfl-flights__detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scheduled time in delayed dropdown — explicitly Open Sans so Poppins from dt doesn't bleed */
.bfl-flights__detail-value--sched {
    font-family: 'Open Sans', sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Weather icon — hard cap so it never renders at full Weatherbit icon size */
.bfl-flights__weather-icon {
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0;
    object-fit: contain;
}

/* ─── Cell styles ─────────────────────────────────────────────────── */

/* Time — date on top, time below; delayed time in orange */
.bfl-flights__cell--time { min-width: 100px; }

.bfl-flights__date-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    display: block;
}

.bfl-flights__time-display {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: nowrap;       /* keep on one line so row height stays uniform */
}

.bfl-flights__time {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.bfl-flights__time--delayed { color: var(--text-delay); }

/* "was 8:29 PM" shown inline in a smaller muted style */
.bfl-flights__original-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Airline — logo + name, name truncates to keep row height uniform */
.bfl-flights__cell--airline { min-width: 140px; }

.bfl-flights__airline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bfl-flights__airline-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
}

.bfl-flights__airline-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

/* Flight number */
.bfl-flights__flight-number {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.3s;
}

/* Location */
.bfl-flights__cell--location {
    font-size: 13px;
    color: var(--text-primary);
    max-width: 200px;
}

/* Gate / baggage */
.bfl-flights__gate,
.bfl-flights__baggage-num {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

/* ─── Status badges ───────────────────────────────────────────────── */
.bfl-flights__cell--status { white-space: nowrap; overflow: visible; }

.bfl-flights__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 148px;
    max-width: 185px;
    text-align: center;
    box-sizing: border-box;
    letter-spacing: 0.1px;
}

.bfl-flights__status svg { flex-shrink: 0; }

/* ── Status pill colours ──────────────────────────────────────────────
   Logical system:
   Blue   = active / in progress (in flight, on time upcoming, boarding)
   Green  = positive outcome (on time, arrived/departed early)
   Orange = warning / negative (delayed, arrived late)
   Gray   = completed neutral (arrived on time, departed)
   Red    = bad (cancelled)
   All contrast ratios verified WCAG 2.1 AA (≥4.5:1)
   ─────────────────────────────────────────────────────────────────── */

/* Upcoming on-time / scheduled / boarding = BFL Blue (active, in queue) */
/* #093547 on #e8eff2 = ~8.5:1 ✓ */
.bfl-flights__status--on-time,
.bfl-flights__status--boarding,
.bfl-flights__status--scheduled,
.bfl-flights__status--in-flight { background: var(--inflight-bg); color: var(--inflight-text); }

/* In-flight progress bar pill */
.bfl-flights__status--in-flight-progress { color: var(--inflight-text); }

/* Arrived/departed on time or early = Green (positive) */
/* #5E782C on #eef2e8 = ~6.1:1 ✓ */
.bfl-flights__status--arrived-early { background: var(--early-bg); color: var(--early-text); }

/* Arrived/departed neutral (within ±5 min) = Gray (completed) */
/* #484D56 on #eeeef0 = 7.4:1 ✓ */
.bfl-flights__status--arrived,
.bfl-flights__status--departed { background: var(--departed-bg); color: var(--departed-text); }

/* Delayed / arrived late = Orange (warning) */
/* #C04C28 on #fff3ed = 5.2:1 ✓ */
.bfl-flights__status--delayed,
.bfl-flights__status--arrived-late { background: var(--delay-bg); color: var(--delay-text); }

.bfl-flights__status--cancelled { background: var(--cancel-bg); color: var(--cancel-text); }

/* ─── Expand button ───────────────────────────────────────────────── */
.bfl-flights__cell--expand { width: 44px; text-align: center; overflow: visible; }

.bfl-flights__expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    transition: color 0.15s, background 0.15s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.bfl-flights__expand-btn:hover { background: var(--border-light); color: var(--text-secondary); }
.bfl-flights__expand-btn:active { background: var(--bfl-blue); color: #fff; }
.bfl-flights__expand-btn:focus         { outline: none; }
.bfl-flights__expand-btn:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; box-shadow: none; border-radius: 4px; z-index: 2; }
.bfl-flights__expand-btn[aria-expanded="true"] { transform: rotate(180deg); color: var(--bfl-blue); }

/* ─── Day dividers ────────────────────────────────────────────────── */
─── Tomorrow divider ──────────────────────────────────────
   Visually unmissable break between today and tomorrow.
   Transparent row (not a white card) so it reads as a
   section header, not another flight row. Orange label
   and top border rule signal the day change clearly.
   ──────────────────────────────────────────────────────── */
.bfl-flights__day-divider-row td {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-left: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    white-space: normal !important;
    padding-top: 28px !important;
    padding-bottom: 8px !important;
}

.bfl-flights__day-divider-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 12px 18px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--bfl-blue);
    border-top: none;
    margin: 0;
}

.bfl-flights__day-divider-icon {
    font-size: 16px;
    line-height: 1;
}

/* "Tomorrow" — orange, large, impossible to miss */
.bfl-flights__day-divider-label {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    color: var(--bfl-blue);
}

.bfl-flights__day-divider-date {
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* ─── Panel visibility ────────────────────────────────────────────── */
.bfl-flights__panel { display: none; }
.bfl-flights__panel--active { display: block; }

/* ─── Empty state ─────────────────────────────────────────────────── */
.bfl-flights__empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.bfl-flights__empty h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.bfl-flights__empty p { color: var(--text-muted); margin: 0; }

/* ─── Mobile cards ────────────────────────────────────────────────── */
.bfl-flights__cards { display: none; }

.bfl-flights__card {
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.15s;
    border-left: 4px solid var(--border-medium);
}

.bfl-flights__card[data-status="on-time"],
.bfl-flights__card[data-status="in-flight"],
.bfl-flights__card[data-status="boarding"]       { border-left-color: var(--bfl-blue); }
.bfl-flights__card[data-status="arrived-early"]  { border-left-color: var(--good-text); }
.bfl-flights__card[data-status="arrived"],
.bfl-flights__card[data-status="departed"]       { border-left-color: var(--border-medium); }
.bfl-flights__card[data-status="delayed"],
.bfl-flights__card[data-status="arrived-late"]   { border-left-color: var(--bfl-orange); }
.bfl-flights__card[data-status="cancelled"]      { border-left-color: var(--cancel-text); }

.bfl-flights__card-header {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

.bfl-flights__card-header:active  { background: rgba(0,0,0,0.02); }
.bfl-flights__card-header:focus   { outline: none; }
.bfl-flights__card-header:focus-visible { outline: 2px solid var(--focus-color); outline-offset: -2px; box-shadow: none; border-radius: 12px; }

.bfl-flights__card-top       { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.bfl-flights__card-airline   { display: flex; align-items: center; gap: 8px; }
.bfl-flights__card-main      { margin-bottom: 12px; }
.bfl-flights__card-flight    { margin-bottom: 4px; }
.bfl-flights__direction-arrow { display: none; }

.bfl-flights__card-destination { display: flex; align-items: baseline; gap: 8px; }

.bfl-flights__destination-code {
    font-family: 'Poppins', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--bfl-blue);
    letter-spacing: 1px;
}

.bfl-flights__destination-city { font-size: 14px; color: var(--text-secondary); }

.bfl-flights__card-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.bfl-flights__card-gate   { text-align: right; }

.bfl-flights__label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.bfl-flights__card-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-top: 12px;
    margin-top: 10px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--bfl-blue);
    font-weight: 500;
}

.bfl-flights__expand-icon { transition: transform 0.2s; }
.bfl-flights__card-header[aria-expanded="true"] .bfl-flights__expand-icon { transform: rotate(180deg); }

.bfl-flights__card-details {
    padding: 0 16px 16px;
    background: var(--departed-bg); /* default: neutral gray for completed flights */
}

/* Status-aware card detail backgrounds (mobile) — matches table row logic */
.bfl-flights__card[data-status="on-time"] .bfl-flights__card-details,
.bfl-flights__card[data-status="in-flight"] .bfl-flights__card-details,
.bfl-flights__card[data-status="boarding"] .bfl-flights__card-details,
.bfl-flights__card[data-status="scheduled"] .bfl-flights__card-details {
    background: var(--inflight-bg);
}
.bfl-flights__card[data-status="arrived-early"] .bfl-flights__card-details {
    background: var(--early-bg);
}
.bfl-flights__card[data-status="delayed"] .bfl-flights__card-details,
.bfl-flights__card[data-status="arrived-late"] .bfl-flights__card-details {
    background: var(--delay-bg);
}
.bfl-flights__card[data-status="cancelled"] .bfl-flights__card-details {
    background: var(--cancel-bg);
}

.bfl-flights__day-divider-card { padding: 18px 0 4px; background: transparent; margin: 0; }

/* ─── Responsive: cards at 900px ─────────────────────────────────── */
@media (max-width: 900px) {
    .bfl-flights__table-wrapper { display: none; }
    .bfl-flights__cards { display: block; }
    .bfl-flights__day-filter-btn { flex: 1; }
    /* Hide desktop button groups — replaced by native selects on mobile */
    .bfl-flights__day-filter  { display: none !important; }
    .bfl-flights__sort-toggle { display: none !important; }
}

/* On desktop: row wrappers are transparent to layout (display:contents),
   so all controls sit inline in the parent flex row as before.
   Row 2 (mobile selects) is also hidden. */
.bfl-flights__filter-row   { display: contents; }
.bfl-flights__filter-row--2 { display: none; }

/* ─── Mobile: 600px ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    .bfl-flights { padding: 0 0 20px; }

    .bfl-flights__tabs {
        position: sticky;
        top: 0;
        z-index: 100;
        border-radius: 0;
        margin-bottom: 12px;
    }

    .bfl-flights__tab { flex: 1; text-align: center; font-size: 15px; padding: 12px 0; }

    /* ── Mobile filters: 3 explicit rows ────────────────────────────
       Row 1: Search — full width
       Row 2: All Airlines — full width  (mobile-only select)
       Row 3: All Days (50%) | Sort: Time/City (50%)
       Desktop: row divs use display:contents so all controls stay inline.
    ─────────────────────────────────────────────────────────────── */
    .bfl-flights__filters {
        padding: 10px 12px;
        border-radius: 0;
        gap: 8px;
        display: flex;
        flex-direction: column;
    }

    /* Each row is a full-width flex container */
    .bfl-flights__filter-row {
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }

    /* Row 1: search full width, hide the desktop airline-wrap */
    .bfl-flights__filter-row--1 .bfl-flights__search {
        flex: 1 1 100%;
        min-width: 0;
    }
    .bfl-flights__filter-row--1 .bfl-flights__airline-wrap { display: none; }

    /* Row 2: airline select full width */
    .bfl-flights__filter-row--2 { display: flex; }
    .bfl-flights__filter-row--2 .bfl-flights__mobile-select {
        flex: 1 1 100%;
    }

    /* Row 3: days + sort each take equal half */
    .bfl-flights__filter-row--3 { display: flex; }
    .bfl-flights__filter-row--3 .bfl-flights__mobile-select {
        flex: 1 1 0;
    }

    /* ── Shared styles: all inputs and selects ───────────────────── */
    .bfl-flights__search-input,
    .bfl-flights__mobile-select {
        height: 40px;
        font-size: 16px; /* ≥16px prevents iOS auto-zoom */
        font-family: inherit;
        color: var(--text-primary);
        background-color: #fafbfc;
        border: 1.5px solid var(--border-ui);
        border-radius: 8px;
        box-sizing: border-box;
        width: 100%;
    }

    /* Selects: custom chevron arrow */
    .bfl-flights__mobile-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
        padding: 0 28px 0 10px;
        appearance: none;
        -webkit-appearance: none;
        cursor: pointer;
    }

    /* Show mobile-only selects */
    .bfl-flights__mobile-select { display: block; }

    .bfl-flights__mobile-select:focus,
    .bfl-flights__search-input:focus {
        outline: none;
        border-color: var(--bfl-blue);
        box-shadow: var(--focus-ring);
    }

    .bfl-flights__card { border-radius: 10px; }
    .bfl-flights__card-header { padding: 14px; }
    .bfl-flights__destination-code { font-size: 22px; }
    .bfl-flights__destination-city { font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bfl-flights__card-flight .bfl-flights__flight-number { font-size: 12px; color: var(--text-secondary); }
    .bfl-flights__direction-arrow { display: inline; font-size: 12px; color: var(--text-muted); }
    .bfl-flights__card-main { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
    .bfl-flights__card-flight { flex-shrink: 0; margin-bottom: 0; }
    .bfl-flights__status { min-width: 130px; font-size: 11px; padding: 4px 8px; }
    .bfl-flights__pagination { padding: 13px 18px; font-size: 13px; }
    .bfl-flights__details-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .bfl-flights__expand-text { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   ELEMENTOR PRO / HELLO THEME COMPATIBILITY
   Elementor resets <button> and <table> elements globally.
   Parent-scoped selectors beat Elementor specificity cleanly.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Kill column dividers Elementor injects into table cells ─────── */
.bfl-flights .bfl-flights__table tbody td {
    border-left: none !important;
    border-right: none !important;
}
/* Restore the intentional left accent and right close on rows */
.bfl-flights .bfl-flights__table tbody td:first-child {
    border-left: 4px solid var(--border-medium) !important;
}
.bfl-flights .bfl-flights__table tbody td:last-child {
    border-right: 1px solid var(--border-light) !important;
}
/* Status-based left accent — scoped for Elementor specificity */
.bfl-flights .bfl-flights__row[data-status="on-time"]       td:first-child { border-left-color: var(--bfl-blue)      !important; }
.bfl-flights .bfl-flights__row[data-status="in-flight"]     td:first-child { border-left-color: var(--bfl-blue)      !important; }
.bfl-flights .bfl-flights__row[data-status="boarding"]      td:first-child { border-left-color: var(--bfl-blue)      !important; }
.bfl-flights .bfl-flights__row[data-status="arrived-early"] td:first-child { border-left-color: var(--good-text)     !important; }
.bfl-flights .bfl-flights__row[data-status="arrived"]       td:first-child { border-left-color: var(--border-medium) !important; }
.bfl-flights .bfl-flights__row[data-status="departed"]      td:first-child { border-left-color: var(--border-medium) !important; }
.bfl-flights .bfl-flights__row[data-status="delayed"]       td:first-child { border-left-color: var(--bfl-orange)    !important; }
.bfl-flights .bfl-flights__row[data-status="arrived-late"]  td:first-child { border-left-color: var(--bfl-orange)    !important; }
.bfl-flights .bfl-flights__row[data-status="cancelled"]     td:first-child { border-left-color: var(--cancel-text)   !important; }

/* thead — no column dividers */
.bfl-flights .bfl-flights__table thead th {
    border-left: none !important;
    border-right: none !important;
}

/* ── Restore filter bar card look Elementor wipes ────────────────── */
.bfl-flights .bfl-flights__filters {
    background: var(--card-bg) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 14px 16px !important;
}

/* ── Tab bar ─────────────────────────────────────────────────────── */
.bfl-flights .bfl-flights__tab {
    font-family: 'Poppins', sans-serif !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    padding: 16px 20px 13px !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin-bottom: -1px !important;
    width: auto !important;
    display: inline-block !important;
}
.bfl-flights .bfl-flights__tab:hover {
    color: var(--text-primary) !important;
    background: transparent !important;
}
.bfl-flights .bfl-flights__tab--active {
    color: var(--bfl-blue) !important;
    border-bottom-color: var(--bfl-orange) !important;
    background: transparent !important;
}
.bfl-flights .bfl-flights__tab:active {
    color: var(--bfl-blue) !important;
    background: transparent !important;
}

/* ── Day filter buttons (Today / Tomorrow) ───────────────────────── */
.bfl-flights .bfl-flights__day-filter-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 42px !important;
    padding: 0 18px !important;
    border: 1.5px solid var(--border-ui) !important;
    border-radius: 8px !important;
    background: #fafbfc !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
    width: auto !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    transition: background 0.15s, border-color 0.15s, color 0.15s !important;
}
.bfl-flights .bfl-flights__day-filter-btn:hover {
    border-color: var(--bfl-blue) !important;
    color: var(--bfl-blue) !important;
    background: #fff !important;
}
.bfl-flights .bfl-flights__day-filter-btn--active,
.bfl-flights .bfl-flights__day-filter-btn--active:hover {
    background: var(--bfl-blue) !important;
    border-color: var(--bfl-blue) !important;
    color: #fff !important;
}

/* ── Sort buttons ────────────────────────────────────────────────── */
.bfl-flights .bfl-flights__sort-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    height: 38px !important;
    padding: 0 14px !important;
    border: 1.5px solid var(--border-ui) !important;
    border-radius: 8px !important;
    background: #fafbfc !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
    width: auto !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    transition: background 0.15s, border-color 0.15s, color 0.15s !important;
}
.bfl-flights .bfl-flights__sort-btn:hover {
    border-color: var(--bfl-blue) !important;
    color: var(--bfl-blue) !important;
    background: #fff !important;
}
.bfl-flights .bfl-flights__sort-btn--active,
.bfl-flights .bfl-flights__sort-btn--active:hover {
    background: var(--bfl-blue) !important;
    border-color: var(--bfl-blue) !important;
    color: #fff !important;
}

/* ── Expand chevron button ───────────────────────────────────────── */
.bfl-flights .bfl-flights__expand-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    width: auto !important;
}
.bfl-flights .bfl-flights__expand-btn:hover {
    background: var(--border-light) !important;
    color: var(--text-secondary) !important;
}

/* ── Card toggle button ──────────────────────────────────────────── */
.bfl-flights .bfl-flights__card-header {
    display: block !important;
    width: 100% !important;
    padding: 16px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-align: left !important;
    color: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

/* ── SVGs inside buttons ─────────────────────────────────────────── */
.bfl-flights button svg {
    display: inline-block !important;
    flex-shrink: 0 !important;
    vertical-align: middle !important;
    fill: none !important;
}

/* ── Search input — Elementor squashes border-radius and border color ─ */
.bfl-flights .bfl-flights__search-input {
    border-radius: 8px !important;
    border: 1.5px solid var(--border-ui) !important;
    padding: 0 14px 0 44px !important;
    height: 42px !important;
    font-size: 14px !important;
    font-family: 'Open Sans', sans-serif !important;
    background-color: #fafbfc !important;
    box-shadow: none !important;
    color: var(--text-primary) !important;
    width: 100% !important;
}
.bfl-flights .bfl-flights__search-input:focus {
    border-color: var(--bfl-blue) !important;
    background-color: #fff !important;
    box-shadow: var(--focus-ring) !important;
    outline: none !important;
}

/* ── Airline dropdown ─────────────────────────────────────────────── */
.bfl-flights .bfl-flights__airline-select {
    border-radius: 8px !important;
    border: 1.5px solid var(--border-ui) !important;
    height: 42px !important;
    background-color: #fafbfc !important;
    box-shadow: none !important;
    color: var(--text-secondary) !important;
    font-size: 14px !important;
    font-family: 'Open Sans', sans-serif !important;
}

/* ── Box-sizing ──────────────────────────────────────────────────── */
.bfl-flights, .bfl-flights * { box-sizing: border-box; }

.bfl-flights__weather-forecast-label { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ─── Loading state (v3.0.0) ─────────────────────────────────────── */
/* Shown while REST endpoint fetch is in progress on initial page load */

.bfl-flights__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-secondary);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
}

.bfl-flights__loading p {
    margin: 12px 0 0;
}

.bfl-flights__loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-medium);
    border-top-color: var(--bfl-blue);
    border-radius: 50%;
    animation: bfl-spin 0.8s linear infinite;
}

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