/*
 * SWISS Virtual Pilot Console — Main Stylesheet
 * ============================================================
 * Unminified, token-driven replacement for pilotconsole.min.css.
 * Requires tokens.css to be loaded FIRST.
 *
 * Token mapping:
 *   #c00 / #CC0000    → var(--color-primary)
 *   #ad0000 / #b30000 → var(--color-primary-hover)
 *   #f2f2f2 / #f5f5f5 → var(--color-surface-legacy)
 *   #cdcdcd / #e5e5e5 → var(--color-border-legacy)
 *   #46413e            → var(--color-accent)
 *   #666 / #666666     → var(--color-text-muted)
 *   #fff / #ffffff     → var(--color-background)
 *   #000 / #000000     → var(--color-text)
 *   #1e1e1e            → var(--color-text)
 *   #008e17            → var(--color-success)
 *   #f3a200            → var(--color-warning)
 *   #0d82b9            → var(--color-info)
 *
 * Milestone: M002 — CSS Token Architecture
 * Slice: S01 — Design Token Layer + Pilot Console CSS Rewrite
 * ============================================================
 */


/* ========== BASE / LAYOUT ========== */

body {
    width: 100vw;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    overflow-x: hidden;
    transition: background-color 1s, color 1s;
}

.body-container {
    width: 80vw;
    margin-left: 10vw;
    /* Clear the 75px fixed navbar — replaces the old navbar-box min-height:200px spacer */
    padding-top: 75px;
    box-sizing: border-box;
}

.body {
    padding-top: 50px;
    margin-bottom: 150px;
}

.row {
    margin-top: 10px;
}

.row > div {
    margin-bottom: 10px;
}

.nomargin {
    margin: 0;
}

.imgauto {
    width: 100%;
}

.float-right {
    float: right;
}

.inline-block {
    display: inline-block;
}

@media (max-width: 992px) {
    .mobile-hidden {
        display: none;
    }
}


/* ========== HOMEPAGE ALERT ========== */

.homepage-alert {
    width: 100%;
    background-color: var(--color-surface-legacy);
    color: var(--color-text);
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 2px;
    padding-bottom: 2px;
}

.homepage-alert a {
    color: var(--color-primary);
}

.homepage-alert a:hover {
    color: var(--color-primary-hover);
}


/* ========== TABLE ========== */

.table-placeholder {
    overflow-x: auto;
}

.table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    table-layout: fixed;
    border: 1px solid var(--color-border-legacy);
}

.table > thead {
    background-color: var(--color-surface-legacy);
}

.table > thead > tr > th {
    padding: 10px;
    padding-top: 20px;
    padding-bottom: 20px;
}

.table > tbody > tr {
    border: 1px solid var(--color-border-legacy);
}

.table > tbody > tr > td {
    padding: 10px;
}

.table > tbody > tr:nth-child(even) {
    background-color: var(--color-surface-legacy);
}


/* ========== NAVBAR ========== */

/*
 * Navbar box — zero-height wrapper so the fixed navbar doesn't push content.
 * body-container carries its own padding-top to clear the 75px fixed bar.
 */
.navbar-box {
    height: 0;
}

.navbar {
    z-index: 2000;
    position: fixed;
    width: 100vw;
    height: 75px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-background);
    box-sizing: border-box;
}

.navbar a {
    text-decoration: none;
}

.navbar-logo {
    position: fixed;
    width: 200px;
    left: 25px;
    top: 20px;
}

/* nav list — pushed to the right of the logo space */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
    position: relative; /* establishes containing block for .navbar-menu absolute children */
}

/* Each top-level link / dropdown toggle */
.navbar-masterlink {
    position: relative;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    padding: var(--space-2) var(--space-3);
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.navbar-masterlink:hover {
    color: var(--color-primary);
}

/* Hamburger button — hidden on desktop, shown on mobile */
.navbar-expand {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text);
    cursor: pointer;
    padding: var(--space-2);
    margin-left: auto;
    line-height: 1;
}

/* ── Dropdown menus — compact floating panels ── */
.navbar-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    min-width: 200px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--space-2) 0;
    /* Default hidden state */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

/* Initial page-load state: same as default hidden — no animation flash */
.navbar-menu.shrunkstart {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Open state */
.navbar-menu.expanded {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Closing state — matches hidden */
.navbar-menu.shrunk {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Dropdown items */
.navbar-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    /* Dark-mode fix: --color-text is properly overridden in dark mode;
       the old --color-accent (#46413e) was not, making text near-invisible. */
    color: var(--color-text);
    font-size: var(--font-size-sm);
    text-decoration: none;
    white-space: nowrap;
}

.navbar-menu-item:hover {
    background: var(--color-surface);
    color: var(--color-primary);
    cursor: pointer;
}

.navbar-menu-item > .icon {
    font-family: var(--font-piktos);
    display: inline-flex;
    justify-content: center;
    width: 24px;
    font-size: 20px;
    flex-shrink: 0;
}

.navbar-menu-item > .icon-image {
    height: 20px;
    width: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ── Mobile breakpoint ── */
@media (max-width: 992px) {

    /* Show hamburger */
    .navbar-expand {
        display: flex;
        align-items: center;
    }

    /* Mobile nav panel — hidden by default, shown when .expanded */
    .navbar-nav {
        position: fixed;
        top: 75px;
        left: 0;
        width: 100%;
        height: auto;
        max-height: calc(100vh - 75px);
        overflow-y: auto;
        background: var(--color-background);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-2) 0;
        gap: 0;
        margin-left: 0;
        z-index: 1000;
        display: none;
    }

    .navbar-nav.expanded {
        display: flex;
    }

    /* Full-width top-level links in mobile */
    .navbar-masterlink {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: left;
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-base);
    }

    /* Inline submenus on mobile — no float, no shadow */
    .navbar-menu {
        position: static;
        transform: none;
        border: none;
        box-shadow: none;
        border-radius: 0;
        background: var(--color-surface);
        padding-left: var(--space-4);
        min-width: 0;
        width: 100%;
    }

    /* Re-apply hidden/visible states in mobile context */
    .navbar-menu.expanded {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .navbar-menu.shrunk,
    .navbar-menu.shrunkstart {
        display: none;
    }

    .navbar-menu-item {
        padding: var(--space-2) var(--space-4);
    }

    .theme-switcher {
        margin: var(--space-2) var(--space-4);
    }
}


/* ========== TYPOGRAPHY / UTILITIES ========== */

.page-title {
    color: var(--color-primary);
    font-size: xx-large;
    font-weight: 100;
    margin: 0;
    margin-bottom: 50px;
    transition: color 1s;
}

.page-title > small {
    font-size: large;
}

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

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

.text-red {
    color: var(--color-primary);
}

.text-grey {
    color: var(--color-accent);
}

.text-through {
    text-decoration: line-through;
}

.text-lightgray {
    color: var(--color-text-muted);
}

.pikto {
    color: var(--color-accent);
    font-family: var(--font-piktos);
}

.monospace-font {
    font-family: var(--font-mono);
}

.text-uppercase {
    text-transform: uppercase;
}

.text-bold {
    font-weight: 700;
}

a {
    color: var(--color-text);
    text-decoration: underline;
}

a:hover {
    color: var(--color-primary);
}


/* ========== MAPS (Leaflet overrides) ========== */

.leaflet-popup-content-wrapper {
    border-radius: 0;
}

.leaflet-popup-pane {
    width: auto;
}


/* ========== NOTIFICATIONS ========== */

.notifications-box {
    overflow-y: auto;
}

.notifications-box > p {
    text-align: center;
    opacity: 0.55;
}

.notification {
    width: 100%;
    border-bottom: 1px solid #8b8178; /* unique notification border — keep as-is */
    margin-bottom: 5px;
}

.container.notifications {
    padding-top: 0 !important;
}

.notification.read {
    opacity: 0.3;
    transition: opacity 0.5s;
}

.notification.read:hover {
    opacity: 1;
    transition: opacity 0.5s;
}

.notification h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
}

.notification .n-date {
    color: var(--color-text-muted);
}

.notification p {
    font-size: 15px;
    font-style: italic;
    color: var(--color-text);
}

.notification .mark-read {
    font-family: var(--font-piktos);
    margin-left: 5px;
    float: right;
}


/* ========== WIDGET ========== */

.widget {
    width: 100%;
    border: 1px solid var(--color-border-legacy);
    height: 100%;
    transition: background-color 1s, color 1s;
}

.widget > .title {
    display: block;
    width: 100%;
    margin: 0;
    background-color: var(--color-surface-legacy);
    color: var(--color-text-muted);
    padding: 10px;
    border-bottom: 1px solid var(--color-border-legacy);
    transition: background-color 1s, color 1s;
}

.widget > .container {
    margin: 0;
    padding: 15px;
    width: auto !important;
    max-width: none !important;
    word-wrap: break-word;
}

.widget > .container > pre {
    white-space: pre-wrap;
}


/* ========== BUTTONS / FORMS ========== */

.button,
[type=submit],
button,
input [type=button] {
    display: inline-block;
    color: var(--color-background);
    padding-top: 15px;
    padding-bottom: 15px;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
    background: var(--color-primary);
    border: none;
    width: 100%;
    text-align: center;
    margin-top: 5px;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    font: var(--font-weight-normal) 1.125rem var(--font-sans);
}

.button:first-letter,
[type=submit]:first-letter,
button:first-letter,
input [type=button]:first-letter {
    text-transform: uppercase;
}

.button:hover,
[type=submit]:hover,
button:hover,
input [type=button]:hover {
    color: var(--color-background);
    background-color: var(--color-primary-hover);
}

.button-small {
    display: inline-block;
    color: var(--color-background);
    text-transform: uppercase;
    padding: 5px;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
    background: var(--color-primary);
    border: none;
    text-align: center;
    margin-top: 5px;
    margin-bottom: 5px;
    letter-spacing: 1px;
    font: var(--font-weight-light) 1rem var(--font-sans);
}

.button-small:hover {
    color: var(--color-background);
}

.button-small.red {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.button-small.red:hover {
    background-color: var(--color-background);
    color: var(--color-primary);
    transition: background-color 0.3s, color 0.3s;
}

.button-small.green {
    background: var(--color-success);
    border: 1px solid var(--color-success);
}

.button-small.green:hover {
    background-color: var(--color-background);
    color: var(--color-success);
    transition: background-color 0.3s, color 0.3s;
}

input:not([type=button]):not([type=reset]):not([type=submit]):not([type=image]):not([type=checkbox]):not([type=radio]),
select {
    -ms-box-sizing: content-box;
    -moz-box-sizing: content-box;
    -webkit-box-sizing: content-box;
    box-sizing: border-box;
    text-align: left;
    background-color: var(--color-background);
    background-image: none;
    color: var(--color-text);
    height: 30px;
    width: 100%;
    font-size: 18px;
    border: 1.5px solid var(--color-border-legacy);
    padding: 25px 10px;
    margin-bottom: 20px;
    transition: border 0.2s;
    outline-style: none !important;
    font-family: var(--font-sans);
    transition: background-color 1s, color 1s;
}

input[type=date],
input[type=number],
select {
    line-height: 20px !important;
    padding: 13px 10px !important;
    height: unset !important;
    transition: background-color 1s, color 1s;
}

input:not([type=button]):not([type=reset]):not([type=submit]):not([type=image]):not([type=checkbox]):not([type=radio]):focus,
select:focus {
    border: 1.5px solid var(--color-text);
    transition: border 0.5s;
    outline-style: none !important;
}

textarea {
    box-sizing: content-box;
    background-color: var(--color-background);
    background-image: none;
    color: var(--color-text);
    font-size: 18px;
    border: 1.5px solid var(--color-border-legacy);
    margin: 5px 0 5px 0;
    padding: 1.5%;
    width: 98%;
    max-width: 97%;
    min-width: 97%;
    transition: border 0.2s;
    outline-style: none !important;
    font-family: var(--font-sans);
}

textarea:focus {
    border: 1.5px solid var(--color-text);
    transition: border 0.5s;
}

.switch-group > label,
.switch-group > p {
    display: inline-block;
    vertical-align: middle;
    padding: 0 !important;
}

.switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 16px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* slider unchecked — keep as-is */
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 3px;
    background-color: var(--color-background);
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

input:checked + .slider {
    background-color: #2bd900; /* ACARS/switch live green — keep as-is */
}

input:focus + .slider {
    box-shadow: 0 0 1px #2bd900; /* ACARS/switch live green — keep as-is */
}

input:checked + .slider:before {
    -webkit-transform: translateX(15px);
    -ms-transform: translateX(15px);
    transform: translateX(15px);
}

.slider.round {
    border-radius: 16px;
}

.slider.round:before {
    border-radius: 50%;
}

label {
    color: var(--color-text-muted);
    font-size: smaller;
    font-style: italic;
    display: block;
    padding: 10px;
    padding-left: 0;
}

.time-picker > select {
    position: relative;
    top: 10px;
    display: inline-block;
    width: 49%;
    padding: 4px !important;
    width: 57px;
}

.date-picker {
    position: relative;
    top: 10px;
    display: inline-block;
    width: 49%;
    padding: 4px 10px !important;
    min-width: 135px;
}


/* ========== MISC LAYOUT ========== */

hr {
    color: var(--color-border-legacy);
    background-color: var(--color-border-legacy);
    height: 1px;
    border: none;
}

.clock {
    position: fixed;
    right: 5px;
    bottom: 5px;
    transition: color 1s;
}

@media (max-width: 992px) {
    .clock {
        visibility: hidden;
    }
}


/* ========== FEEDBACK ========== */

#blackoverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #555; /* overlay backdrop — keep as-is */
    opacity: 0.8;
    z-index: 4000;
    text-align: center;
    display: none;
    overflow-y: hidden;
    overflow-x: hidden;
}

#blackoverlay > img {
    display: block;
    margin-top: 15%;
    margin-left: auto;
    margin-right: auto;
}

#blackoverlay > p {
    color: var(--color-background);
    font-size: 25px;
}

.swal2-container {
    z-index: 2000 !important;
}

.feedback-elements {
    display: none;
    z-index: 3500;
}

.feedback-darken {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: #555; /* overlay backdrop — keep as-is */
    opacity: 0.8;
    z-index: 3000;
}

.feedback-window {
    padding: 20px;
    position: fixed;
    width: 50%;
    max-height: 70%;
    padding-bottom: 10px;
    top: 10%;
    left: 30%;
    background-color: var(--color-background);
    border-radius: 1px;
    text-align: center;
    z-index: 3500;
    overflow-y: auto;
}

.feedback-window h1 {
    color: var(--color-primary);
    font-size: 35px;
}

.feedback-window span.inverted {
    width: 40px;
    height: 40px;
    display: inline-block;
    color: var(--color-primary);
    background-color: var(--color-background);
    border-radius: 2px;
    line-height: 40px;
    border: 1px solid var(--color-primary);
    transition: background 0.3s;
}

.askmelater {
    text-decoration: underline;
    text-transform: capitalize;
}

.askmelater:hover {
    color: var(--color-primary);
    cursor: pointer;
}

.feedback-window span:hover {
    background-color: var(--color-background);
    color: var(--color-background);
    cursor: pointer;
    background-color: var(--color-primary);
    transition: background 0.3s;
}

.feedback-window .selected {
    color: var(--color-background) !important;
    background-color: var(--color-primary) !important;
    transition: background 0.3s;
}

.feedback-window .please-give-note {
    display: none;
    color: var(--color-primary);
}

.feedback-window cite {
    color: var(--color-text-muted);
}


/* ========== FORUM / COMMUNITY ========== */

.category {
    color: var(--color-text-muted);
    background-color: var(--color-surface-legacy);
    position: relative;
}

.category > .button-small {
    position: absolute;
    right: 5px;
    top: 15px;
}

.category > .remove-thread {
    right: 230px;
}

@media (max-width: 992px) {
    .category > .button-small {
        position: relative;
        display: inline-block;
        left: 5px;
        top: auto;
    }

    .category > .remove-thread {
        margin-right: 5px;
    }
}

.category > p {
    padding: 10px;
    font-weight: 700;
}

.forum {
    width: 96%;
    margin-left: 2%;
    margin-right: 2%;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border-legacy);
}

.forum > .info {
    width: 40%;
}

.forum .name {
    margin: 0;
    padding: 0;
    color: var(--color-primary);
    text-decoration: none;
}

.forum .name:hover {
    text-decoration: underline;
}

.name > p {
    margin: 0;
}

.description {
    font-style: italic;
    margin: 0;
    font-size: smaller;
}

.forum-head {
    color: var(--color-background);
    background-color: var(--color-primary);
    padding: 1px;
}

.thread {
    width: 98%;
    margin-left: 2%;
    margin-bottom: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--color-border-legacy);
}

.thread > .name {
    margin: 0;
    padding: 0;
    color: var(--color-primary);
    text-decoration: none;
}

.thread > .name:hover {
    text-decoration: underline;
}

.forum-description {
    font-weight: 400 !important;
    font-style: italic !important;
}

.date {
    float: right;
    margin: 0;
}

.last-update {
    clear: right;
    float: right;
    margin: 0;
}

.last-thread {
    width: 50%;
    font-size: smaller;
}

.answer {
    border-top: 2px solid var(--color-border-legacy);
    border-left: 2px solid var(--color-border-legacy);
    padding: 5px;
    margin-bottom: 15px;
}

.signature {
    margin-top: 10px;
    width: 20%;
    border-top: 1px solid var(--color-surface-legacy);
    padding: 0;
}


/* ========== DOWNLOADS / DONATIONS ========== */

.download-box {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    flex-direction: row;
}

.download-block {
    width: 300px;
    height: 350px;
    border: 1px solid var(--color-border-legacy);
    padding: 15px;
    margin: 15px;
    position: relative;
    display: inline-block;
    vertical-align: top;
}

.download-block > .download-link {
    border-top: 1px solid var(--color-border-legacy);
    padding: 15px;
    padding-left: 0;
    width: calc(100% - 15px);
    display: block;
    position: absolute;
    bottom: 0;
    text-decoration: none;
    color: var(--color-primary);
    vertical-align: middle;
    transition: color 1s;
}

.download-info {
    max-height: 70px;
    overflow-y: auto;
}

.donation-table {
    width: 95vw;
    position: absolute;
    left: 2.5vw;
    text-align: center;
}

.donation-mean {
    width: 350px;
    height: 600px;
    background-color: var(--color-surface-legacy);
    position: relative;
    text-align: center;
    display: inline-block;
    margin: 20px;
    vertical-align: top;
    border-radius: 5px;
    padding: 25px;
}

.donation-link {
    width: 100%;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    height: 50px;
    position: absolute;
    bottom: 0;
    left: 0;
    line-height: 35px;
    margin: 0;
}

.donation-iconplaceholder {
    display: block;
    width: 150px;
    height: 150px;
    line-height: 150px;
    margin-left: 90px;
    padding: 10px;
    padding-bottom: 0;
}

.donation-icon {
    width: 100%;
}

.donation-iconfont {
    width: 100%;
    font-family: var(--font-piktos);
    font-size: 120px;
}

.donation-title {
    color: var(--color-accent);
    padding: 10px;
    padding-top: 0;
    line-height: 25px;
    height: 50px;
    margin-top: 25px;
}

.donation-text {
    color: var(--color-accent);
    text-align: justify;
    padding: 10px;
    font-size: larger;
}

.donation-text > cite {
    padding-top: 5px;
    color: #acacac; /* unique donation cite color — keep as-is */
    font-style: italic;
    font-size: smaller;
}


/* ========== ARTICLES ========== */

.articleview {
    width: 350px;
    display: inline-block;
    height: auto;
    border: 1px solid var(--color-border-legacy);
    height: 600px;
    vertical-align: top;
    margin-bottom: 30px;
    margin-left: 9%;
    position: relative;
}

.articleview a {
    border-top: 1px solid var(--color-border-legacy);
    padding: 15px;
    padding-left: 0;
    width: calc(100% - 15px);
    display: block;
    position: absolute;
    bottom: 0;
    text-decoration: none;
    color: var(--color-primary);
    vertical-align: middle;
    transition: color 1s;
}

.articleview a:hover {
    color: var(--color-primary-hover);
}

.articleview > .content {
    padding: 15px;
    padding-top: 0;
}

.articleview > .content > label {
    position: absolute;
    bottom: 50px;
}

.articleview > img {
    width: 100%;
    height: 260px;
}

.articleview .button-small {
    width: 96%;
}

.articlepreview {
    position: absolute;
    top: 362px;
    height: 125px;
    max-height: 125px;
    overflow-y: auto;
    width: calc(100% - 30px);
    text-align: justify;
}

@media (max-width: 992px) {
    .articleview {
        width: 90%;
        margin-left: 5%;
    }

    .articleview > img {
        height: auto;
    }

    .articlepreview {
        top: auto;
        height: 150px;
        max-height: 150px;
    }
}


/* ========== ALERTS ========== */
/* Bootstrap-style alert component — hardcoded colors preserved intentionally */

.alert {
    padding: 8px 35px 8px 14px;
    margin-bottom: 18px;
    color: #c09853;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    background-color: #fcf8e3;
    border: 1px solid #fbeed5;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
}

.alert-heading {
    color: inherit;
}

.alert .close {
    float: right;
    text-decoration: none;
    color: #b94a48;
}

.alert .close:hover {
    color: #ad1a17;
}

.alert-danger,
.alert-error {
    color: #b94a48;
    background-color: #f2dede;
    border-color: #eed3d7;
}

/* Alert dark-mode overrides */
[data-theme="dark"] .alert {
    background-color: #332b00;
    color: #ffd666;
    border-color: #665500;
    text-shadow: none;
}

[data-theme="dark"] .alert-danger,
[data-theme="dark"] .alert-error {
    background-color: #330000;
    color: #ff6666;
    border-color: #660000;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .alert {
        background-color: #332b00;
        color: #ffd666;
        border-color: #665500;
        text-shadow: none;
    }

    :root:not([data-theme]) .alert-danger,
    :root:not([data-theme]) .alert-error {
        background-color: #330000;
        color: #ff6666;
        border-color: #660000;
    }
}


/* ========== SCHEDULE / BOOKINGS ========== */

.divertaction-timepicker {
    max-width: 250px;
}

.divertaction-timepicker > .date-picker {
    width: 100%;
}

.divertaction-timepicker > .time-picker {
    display: flex;
    justify-content: space-between;
}

.divertaction-timepicker > .time-picker > select {
    width: 49%;
}

.routemap {
    width: 100%;
    height: 400px;
    margin-bottom: 10px;
}

.book-table > tbody > tr > td:nth-of-type(even) {
    background-color: var(--color-surface-legacy);
}

.book-table > tbody > tr > td {
    vertical-align: top;
}

.schedule-mode-switcher {
    margin-top: 7px;
    margin-bottom: 7px;
    width: 100%;
    color: var(--color-text-muted);
}

.schedule-mode-switcher a:first-child {
    border-right: 2px solid var(--color-border-legacy);
}

.schedule-mode-switcher a {
    box-sizing: border-box;
    display: inline-block;
    height: auto;
    min-height: 50px;
    line-height: 50px;
    vertical-align: middle;
    font-weight: 700;
    width: 50%;
    text-decoration: none;
    text-align: center;
    background-color: var(--color-surface-legacy);
    transition: background-color 0.3s, color 0.3s;
}

.schedule-mode-switcher a:not(.active):hover {
    background-color: var(--color-border-legacy);
    color: var(--color-text);
    transition: background-color 0.3s, color 0.3s;
}

.schedule-mode-switcher .active {
    color: var(--color-primary);
    cursor: default;
    background-color: var(--color-border-legacy);
}

.hour-selector {
    text-align: center;
    margin-top: 7px;
    margin-bottom: 7px;
    width: 100%;
}

.hour-selector span {
    color: var(--color-primary);
    display: inline-block;
    border: 1px solid var(--color-primary);
    border-radius: 5px;
    padding: 2px;
    margin: 2px;
}

.hour-selector span.selected {
    background-color: var(--color-primary);
    color: var(--color-background);
}

.hour-selector span:not(.deactivated):hover {
    background-color: var(--color-primary);
    color: var(--color-background);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.hour-selector span.deactivated {
    border: 1px solid var(--color-border-legacy);
    color: var(--color-border-legacy);
}

.box-status {
    float: right;
    padding: 3px;
    font-weight: 400;
    font-size: 23px;
}

.box-status.green {
    color: var(--color-background);
    background-color: var(--color-success);
}

.box-status.yellow {
    color: var(--color-background);
    background-color: var(--color-warning);
}

.box-status.red {
    color: var(--color-background);
    background-color: var(--color-primary);
}

.auto-complete {
    background-color: var(--color-surface-legacy);
    width: 100%;
    padding: 5px;
    display: block;
}


/* ========== LOGIN / AUTH ========== */

.resetpw-form {
    width: 40%;
    margin-left: 30%;
    margin-top: 200px;
    text-align: left;
    position: relative;
}

@media (max-width: 992px) {
    .resetpw-form {
        width: 90vw;
        margin-left: 5vw;
    }
}

.login-form {
    width: 30%;
    margin-left: 35%;
    margin-top: 200px;
    text-align: center;
    position: relative;
}

.login-form-eye > button {
    position: relative;
    z-index: 1000;
    background: 0 0;
    float: right;
    width: 80px;
    margin-top: -80px;
}

.login-form-forget {
    width: 100%;
    text-align: left;
    margin-bottom: 15px;
}

.login-form-forget > a {
    text-transform: capitalize;
    color: var(--color-primary);
    padding-bottom: 2px;
}

.login-form-forget > a:hover {
    color: var(--color-primary-hover);
}

.login-form-title {
    color: var(--color-text-muted);
}

.login-form-title > img {
    width: 100%;
}

.eye-password-invisible {
    height: 40px;
}

.eye-password-visible {
    height: 40px;
}

@media (max-width: 992px) {
    .login-form {
        width: 90vw;
        margin-left: 5vw;
    }
}

.greeting {
    margin-bottom: 15px;
    color: var(--color-primary);
}


/* ========== PROFILE / COMAIL ========== */

.pilot-profile-link {
    color: var(--color-text-muted);
}

.pilot-info a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.comail-box {
    padding: 20px;
    margin: 50px 0;
    border: 2px solid var(--color-primary);
    background: var(--color-background);
    text-decoration: none;
    color: var(--color-primary);
    width: 100%;
    text-align: center;
    transition: all 0.2s ease-in-out;
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
}

.comail-box a {
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--color-primary);
}

.comail-box:hover > a {
    color: var(--color-background);
}

.comail-box:hover > .comail-message {
    color: var(--color-primary);
}

.comail-box:hover {
    color: var(--color-background);
    background-color: var(--color-primary);
    transition: all 0.5s ease-in-out;
}

.comail-message {
    position: absolute;
    left: -8px;
    top: -8px;
}


/* ========== OPERATIONS / ACARS ========== */

.operations-center {
    width: 100%;
    border-radius: 10px;
    font-weight: 700;
}

.operations-center p {
    line-height: 27px;
}

.operations-center p > small {
    font-weight: 400;
}

.operations-center.offline {
    color: var(--color-primary);
    opacity: 0.6;
}

.acarsmap-box {
    border: 1px solid var(--color-border-legacy);
}

.acarsmap-box > .header {
    background-color: var(--color-surface-legacy);
    height: 50px;
    color: var(--color-text-muted);
    padding-left: 15px;
    padding-right: 15px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.acarsmap-live {
    display: inline-block;
    height: 30px;
    width: 55px;
    text-transform: uppercase;
    background-color: #2bd900; /* ACARS live green — keep as-is */
    color: var(--color-background);
    line-height: 30px;
    text-align: center;
    font-size: smaller;
    border-radius: 4px;
}

.acarsmap {
    width: 100%;
    height: 400px;
    min-height: 350px;
}

.notams-table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    border: 1px solid var(--color-border-legacy);
}

.notams-table thead {
    color: var(--color-background);
    background-color: var(--color-primary);
    font-size: 20px;
}

.notams-table th {
    font-weight: lighter;
}

.notams-table tr:nth-child(2n) {
    background-color: var(--color-surface-legacy);
}

.notams-table td {
    padding: 20px;
    color: var(--color-text-muted);
}

.notams-table th,
td {
    padding: 10px;
}

.notams-table a {
    text-decoration: none;
    color: var(--color-primary);
}

.notams-table a:visited {
    color: var(--color-text-muted);
}


/* ========== WEATHER / NEWS / SOCIAL ========== */

.instagram-image {
    width: 100%;
}

.container.instagram {
    padding: 0;
}

.instagram-text {
    padding: 15px;
}

.box-weather {
    display: inline-block;
    width: 50%;
    text-align: center;
    vertical-align: top;
}

.box-weather > .icon {
    color: var(--color-accent);
    font-size: 50px;
}

.box-weather > .main {
    color: var(--color-primary);
}

.box-weather > .main > p {
    color: var(--color-text);
    font-size: 30px;
}

.box-weather > .details {
    font-size: 14px;
    color: var(--color-text-muted);
}

.news > h1 {
    font-size: 20px;
    font-weight: 400;
}

.news > p {
    font-size: 14px;
    color: var(--color-text-muted);
}

.news > p > a {
    color: var(--color-info);
}

.discord-widget > iframe {
    width: 100%;
    max-height: 670px;
    min-height: 300px;
    height: 670px;
}


/* ========== FLYPAD ========== */

.flypad-block {
    width: 80vw;
    margin-left: 10vw;
}

.flypad-back {
    font-size: x-large;
    color: var(--color-primary);
    margin-right: 5px;
    transition: color 1s;
}

.flypad-nightmodeblock {
    position: absolute;
    margin-right: 10vw;
    right: 0;
}

@media (max-width: 992px) {
    .flypad-nightmodeblock {
        position: absolute;
        left: 1vw;
        top: 0;
    }
}

.download-loadsheet {
    float: right;
    margin-right: 5px;
}

.flypad-map {
    height: 350px;
}


/* ========== MISC LAYOUT (continued) ========== */

.forum-widget {
    background-color: var(--color-surface-legacy);
    position: relative;
}

.forum-bottom {
    position: absolute;
    bottom: 150px;
}

@media (max-width: 992px) {
    .forum-bottom {
        position: relative;
        bottom: auto;
    }
}

.container.md {
    text-align: center;
}

.container.md > cite {
    color: var(--color-text-muted);
}

.container.md > h1 {
    margin-bottom: 0;
}

.container.md > .description {
    margin-top: 20px;
    max-height: 170px;
    overflow-y: auto;
    font-size: 15px;
    text-align: left;
}


/* ========== MESSENGER (from M001) ========== */
/*
 * Duplicated from comail_show.tpl inline <style>.
 * The inline styles remain in comail_show.tpl for now — S04 will remove
 * the inline duplicate once this file is the canonical source.
 */

.conversation-thread {
    margin-top: 16px;
}

.conversation-msg {
    padding: 10px 14px;
    margin-bottom: 12px;
    border-left: 4px solid #555; /* overlay/neutral — keep as-is */
    background: rgba(255, 255, 255, 0.04);
}

.conversation-msg.sent {
    border-left-color: #e74c3c; /* conversation sent border — keep as-is */
}

.conversation-msg.received {
    border-left-color: #2ecc71; /* conversation received border — keep as-is */
}

.conversation-msg .msg-meta {
    font-size: 0.85em;
    margin-bottom: 6px;
}

.conversation-msg .msg-content {
    margin: 0;
}


/* ========== THEME SWITCHER ========== */

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--color-background);
    border: 1.5px solid var(--color-text);
    border-radius: 100vw;
    padding: 2px;
    margin-left: 15px;
    flex-shrink: 0;
}

.theme-switcher__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border: none;
    border-radius: 100vw;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.theme-switcher__btn svg {
    display: block;
    width: 14px;
    height: 14px;
}

.theme-switcher__btn--auto {
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    line-height: 1;
    padding: 0 5px;
}

.theme-switcher__btn[aria-checked="true"] {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.theme-switcher__btn:hover {
    color: var(--color-text);
}

.theme-switcher__btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Dark mode refinements for theme switcher */
:root[data-theme="dark"] .theme-switcher {
    border: 1px solid rgba(255, 255, 255, 0.35);
}

:root[data-theme="dark"] .theme-switcher__btn {
    color: rgba(255, 255, 255, 0.3);
}

:root[data-theme="dark"] .theme-switcher__btn[aria-checked="true"] {
    background: #2a2a2a;
    color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-switcher {
        border: 1px solid rgba(255, 255, 255, 0.35);
    }

    :root:not([data-theme]) .theme-switcher__btn {
        color: rgba(255, 255, 255, 0.3);
    }

    :root:not([data-theme]) .theme-switcher__btn[aria-checked="true"] {
        background: #2a2a2a;
        color: #ffffff;
    }
}

/* ========== QR MODAL (FlyPad home) ========== */

.qr-link {
    color: var(--color-text-muted);
    font-size: 11px;
    text-decoration: none;
}

.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.qr-modal-box {
    position: relative;
    background: var(--color-surface);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--color-border);
}

.qr-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: var(--color-text-muted);
    font-size: 24px;
    text-decoration: none;
    font-weight: 300;
}

.qr-caption {
    margin-top: 15px;
    color: var(--color-text-muted);
    font-size: 12px;
}
