/* ==========================================================================
   MSFS Aircraft Charts - shared front-end styles
   Used by: report.php, report_yearly.php, report_monthly.php, top_underdogs.php, statistics.php
   ========================================================================== */

body {
    font-family: 'Montserrat', Arial, sans-serif;
    margin: 20px;
    background: #1b2b40;
    color: #fff;
}

h2, h3 {
    margin: 20px 0 15px 0;
}

h2 {
    font-size: 36px;
}

h3 {
    font-size: 22px;
}

.menu-btn {
    background: #2d62a6;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #3a4f63;
}

.menu-btn:hover {
    background: #24405c;
}

/* --------------------------------------------------------------------------
   Shared top-level nav bar (includes/site_nav.php)
   -------------------------------------------------------------------------- */

.site-nav {
    display: flex;
    background: #0e1830;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.site-nav-link {
    flex: 1;
    text-align: center;
    padding: 14px 20px;
    color: #9fb0c8;
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 1px;
    border-bottom: 3px solid transparent;
}

.site-nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.site-nav-link.active {
    color: #fff;
    background: #2d62a6;
    border-bottom-color: #00c6f7;
}

/* --------------------------------------------------------------------------
   report.php - banner + Monthly/Yearly toggle header
   -------------------------------------------------------------------------- */

.banner-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.banner-img {
    max-width: 100%;
    height: auto;
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 40px 0 30px 0;
}

.toggle-label {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0 8px;
    transition: color 0.2s;
}

.toggle-label.inactive { color: #5a6378; }
.toggle-label.active { color: #fff; }

.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #00c6f7;
    border-radius: 12px;
    transition: .4s;
}

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

input:checked + .slider { background: #00c6f7; }
input:checked + .slider:before { transform: translateX(28px); }

.button-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px 0 30px 0;
    gap: 15px;
    flex-wrap: wrap;
}

.button-bar-left {
    display: flex;
    align-items: center;
}

.button-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.button-bar-right img {
    height: 50px;
    max-width: 100%;
    margin-left: 10px;
}

/* --------------------------------------------------------------------------
   Filter panel (report_yearly.php / report_monthly.php)
   -------------------------------------------------------------------------- */

.filter-container {
    background: #2d62a6;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.filter-header {
    padding: 12px 15px;
    background: #244f82;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.filter-header-static {
    padding: 12px 15px;
    background: #244f82;
    font-weight: bold;
}

.filter-header:hover {
    background: #1f456f;
}

.filter-arrow {
    transition: transform 0.3s ease;
}

.filter-arrow.collapsed {
    transform: rotate(-90deg);
}

.filter-box {
    padding: 15px;
    display: none;
}

.filter-box.open {
    display: block;
}

.filter-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 30px;
    flex-wrap: wrap; /* allow wrapping, but keep items intact */
}

.filter-item {
    display: flex;
    align-items: center;
    white-space: nowrap; /* keep label + input together */
}

.filter-item-full {
    width: 100%;
}

.filter-item.filter-item-year select {
    width: 75px;
}

.filter-item.filter-item-month select {
    width: 140px;
}

.group-families-toggle label {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    text-align: left;
    padding-right: 0;
    font-weight: normal;
    white-space: nowrap;
    cursor: pointer;
}

.group-families-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.filter-item label {
    width: 160px;
    text-align: right;
    padding-right: 10px;
    font-weight: bold;
}

.filter-item input,
.filter-item select {
    width: 200px;
    padding: 6px;
    border-radius: 4px;
    border: none;
}

.search-input {
    width: 260px;
}

.engine-filter {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.engine-filter label {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    text-align: left;
    padding-right: 0;
    font-weight: normal;
    white-space: nowrap;
}

.engine-filter input[type="radio"] {
    width: auto;
    margin: 0;
}

.speed-slider-wrap {
    flex: 1 1 320px;
    min-width: 240px;
    max-width: 100%;
    padding: 26px 16px 0 16px;
}

.speed-slider-ticks {
    position: relative;
    height: 18px;
    font-size: 14px;
    color: #cdd7e3;
    margin-bottom: 10px;
}

.speed-slider-ticks span {
    position: absolute;
    top: 0;
    white-space: nowrap;
}

.speed-slider-track-wrap {
    position: relative;
    height: 32px;
}

.speed-slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 18px;
    transform: translateY(-50%);
    background: #14202e;
    border-radius: 999px;
}

.speed-slider-fill {
    position: absolute;
    top: 50%;
    height: 14px;
    transform: translateY(-50%);
    background: #00c6f7;
    border-radius: 999px;
}

.speed-slider-handle {
    position: absolute;
    top: 50%;
    width: 24px;
    height: 24px;
    margin-left: -12px;
    transform: translateY(-50%);
    background: #fff;
    border: 3px solid #00c6f7;
    border-radius: 50%;
    cursor: grab;
    touch-action: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.speed-slider-handle:active {
    cursor: grabbing;
}

.speed-slider-handle:focus-visible {
    outline: 2px solid #00c6f7;
    outline-offset: 3px;
}

.speed-slider-value {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background: #1b2b40;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
}

.speed-slider-value::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1b2b40;
}

@media (max-width: 700px) {
    .speed-slider-wrap {
        flex: none;
        min-width: 0;
        width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }
}

@media (max-width: 700px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .filter-item label {
        width: auto;
        text-align: left;
        padding-right: 0;
        white-space: nowrap;
    }

    .filter-item input,
    .filter-item select {
        width: 100%;
    }

    .engine-filter {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.filter-divider {
    height: 1px;
    background: #3a4f63;
    margin: 20px 0;
}

.reset-btn {
    background: #1b2b40;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #3a4f63;
}

.reset-btn:hover {
    background: #24405c;
}

.filter-status {
    margin: 10px 15px 0 15px;
    padding: 6px 12px;
    display: inline-block;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.filter-status.active {
    background: #00b894;
    color: #fff;
}

.filter-status.inactive {
    background: #3a4f63;
    color: #ddd;
}

/* --------------------------------------------------------------------------
   Results tables
   -------------------------------------------------------------------------- */

table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 20px;
    color: #fff;
}

th, td {
    padding: 8px;
    border: 1px solid #3a4f63;
}

th {
    background: #2d62a6;
    font-weight: bold;
}

tr:nth-child(odd) {
    background: rgba(255,255,255,0.08);
}

tr:nth-child(even) {
    background: rgba(255,255,255,0.04);
}

.movement-up { color: #00ff7f; }
.movement-down { color: #ff6b6b; }
.movement-new { color: gold; }
.movement-same { color: #ccc; }

.pos { width: 40px; font-weight: bold; }
.movement { width: 70px; text-align: center; font-size: 18px; font-weight: bold; }
.weeks { width: 90px; text-align: center; white-space: nowrap; }
.votes { width: 60px; text-align: center; font-weight: bold; }
.platforms { width: 90px; text-align: center; white-space: nowrap; }
.marketplace { width: 70px; text-align: center; white-space: nowrap; }

.no-submissions-notice {
    color: #ff6b6b;
    font-weight: bold;
}

.summary-table {
    border-collapse: collapse;
    margin: 10px 0 20px 0;
    width: 350px;
}

.summary-table th,
.summary-table td {
    padding: 8px;
    border: 1px solid #3a4f63;
}

.summary-table th {
    background: #2d62a6;
    text-align: left;
    width: 180px;
}

.no-results-cell {
    text-align: center;
    padding: 40px 20px;
}

.no-results-cell p {
    font-size: 1.1rem;
    margin: 0 0 16px 0;
    color: #ccc;
}

/* --------------------------------------------------------------------------
   Legend box
   -------------------------------------------------------------------------- */

.legend-box {
    margin-top: 30px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    border: 1px solid #3a4f63;
}

.legend-box h3 {
    font-size: 18px;
    margin-top: 0;
}

.legend-box p {
    margin: 5px 0;
}

.legend-box ul {
    text-align: left;
    display: inline-block;
    margin: 10px 0;
}

/* --------------------------------------------------------------------------
   statistics.php - stat cards
   -------------------------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: #2d62a6;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.stat-card h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
}

.stat-card.full-width {
    grid-column: 1 / -1;
}

.stat-card-canvas-wrap {
    position: relative;
    height: 320px;
}

.stat-card-note {
    margin: 10px 0 0 0;
    font-size: 0.85em;
    color: #cfe0f5;
}

.stat-card table {
    margin-top: 0;
}

@media (max-width: 800px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   Developer link (opens the info popup)
   -------------------------------------------------------------------------- */

.developer-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.developer-link:hover {
    text-decoration: underline;
}

.developer-link:visited {
    color: inherit;
}

/* --------------------------------------------------------------------------
   Generic info popup (js/popup.js) — shared by the developer popup now,
   and an aircraft popup later. Nothing here is developer-specific.
   -------------------------------------------------------------------------- */

.info-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.info-modal-backdrop.open {
    display: flex;
}

.info-modal {
    background: #1b2b40;
    border: 1px solid #3a4f63;
    border-radius: 10px;
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 28px 24px 24px 24px;
    position: relative;
    color: #fff;
}

.info-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

.info-modal-loading {
    text-align: center;
    padding: 40px 0;
    color: #cfe0f5;
}

.info-modal-logo {
    display: block;
    max-width: 180px;
    max-height: 100px;
    margin: 0 auto 16px auto;
    object-fit: contain;
}

.info-modal-logo-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #2d62a6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    margin: 0 auto 16px auto;
}

.info-modal-title {
    text-align: center;
    margin: 0 0 4px 0;
    font-size: 26px;
}

.info-modal-title-icon {
    height: 28px;
    max-width: 60px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
}

.info-modal-image-wrap {
    position: relative;
    margin: 0 -24px 16px -24px;
    background: #0e1830;
    overflow: hidden;
}

.info-modal-image {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

.info-modal-image-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(14,24,48,0.7);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.info-modal-image-arrow:hover {
    background: rgba(14,24,48,0.9);
}

.info-modal-image-arrow-left {
    left: 10px;
}

.info-modal-image-arrow-right {
    right: 10px;
}

.info-modal-image-label {
    position: absolute;
    bottom: 8px;
    right: 12px;
    background: rgba(14,24,48,0.7);
    color: #cfe0f5;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
}

.info-modal-facts {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 4px 0 16px 0;
    padding: 12px 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.info-modal-fact {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-modal-fact-value {
    font-weight: bold;
    font-size: 15px;
}

.info-modal-fact-label {
    font-size: 11px;
    color: #9fb0c8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-modal-bullet-links {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
}

.info-modal-bullet-links li {
    padding: 4px 0;
}

.info-modal-bullet-links a {
    color: #00c6f7;
    text-decoration: none;
}

.info-modal-bullet-links a:hover {
    text-decoration: underline;
}

.info-modal-bullet-links a:visited {
    color: #00c6f7;
}

.info-modal-bullet-static {
    color: #00c6f7;
}

.info-modal-subtitle {
    text-align: center;
    color: #9fb0c8;
    margin: 0 0 16px 0;
}

.info-modal-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.info-modal-links-left {
    justify-content: flex-start;
}

.info-modal-columns {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.info-modal-column {
    flex: 1;
    min-width: 0;
}

.info-modal-column .info-modal-section-title {
    margin-top: 0;
}

@media (max-width: 500px) {
    .info-modal-columns {
        flex-direction: column;
        gap: 0;
    }
}

.info-modal-link-btn {
    background: #2d62a6;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
}

.info-modal-link-btn:hover {
    background: #24405c;
}

.info-modal-link-btn:visited {
    color: #fff;
}

.info-modal-section-title {
    font-size: 16px;
    margin: 20px 0 8px 0;
    border-top: 1px solid #3a4f63;
    padding-top: 16px;
}

.info-modal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-modal-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.info-modal-chart-wrap {
    position: relative;
    height: 200px;
    margin-top: 8px;
}

/* --------------------------------------------------------------------------
   Aircraft Randomizer
   -------------------------------------------------------------------------- */

.randomizer-intro {
    color: #9fb0c8;
    margin: 0 0 16px 0;
}

.randomizer-btn-wrap {
    text-align: center;
    margin: 24px 0;
}

.randomizer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background: #0078d4;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.randomizer-btn:hover {
    background: #005fa3;
}

.randomizer-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.randomizer-btn-icon {
    font-size: 24px;
}

.randomizer-btn.picking .randomizer-btn-icon {
    animation: randomizer-spin 0.6s linear infinite;
}

@keyframes randomizer-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.randomizer-card {
    max-width: 540px;
    margin: 0 auto 24px auto;
    background: #1b2b40;
    border: 1px solid #3a4f63;
    border-radius: 10px;
    overflow: hidden;
    color: #fff;
}

.randomizer-card-image-wrap {
    background: #0e1830;
    min-height: 80px;
}

.randomizer-card-image {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
}

.randomizer-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;
    color: #9fb0c8;
    font-size: 14px;
}

.randomizer-card-title {
    text-align: center;
    margin: 20px 24px 4px 24px;
    font-size: 24px;
}

.randomizer-card-title-icon {
    height: 28px;
    max-width: 60px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
}

.randomizer-card-facts {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 16px 24px 24px 24px;
    padding: 12px 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.randomizer-card-fact {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.randomizer-card-fact-value {
    font-weight: bold;
    font-size: 15px;
}

.randomizer-card-fact-label {
    font-size: 11px;
    color: #9fb0c8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.randomizer-no-match {
    max-width: 540px;
    margin: 0 auto 24px auto;
    text-align: center;
    color: #9fb0c8;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #3a4f63;
    border-radius: 10px;
    padding: 20px;
}
