﻿/* Site.css - Pilot-Oriented Flight Windows (SkyGauge-Inspired, Fully Readable) */

/* Base Body */
body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0d1b2a; /* deep navy cockpit feel */
    color: #f0f0f0;
    margin: 10px; /* reduced margin for phones */
    overflow-x: hidden; /* prevent unwanted horizontal scroll */
    box-sizing: border-box;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw; /* full width of viewport */
    height: 100vh; /* full height of viewport */
    height: 100dvh;
    background: rgba(0, 0, 0, 0.9); /* semi-transparent gray */
    z-index: 9998; /* just below the loader */
    pointer-events: auto; /* blocks clicks behind */
    display: none; /* hidden until loading */
}

#global-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10000;
}

#loading-text {
    font-size: 10vw;
    font-weight: bold;
    color: #87cefa; /* sky-blue */
    text-align: center;
    text-shadow: 2px 2px 0 #0d1b2a, -2px 2px 0 #0d1b2a, 2px -2px 0 #0d1b2a, -2px -2px 0 #0d1b2a;
}

#loading-text .dots {
    display: inline-block;
    animation: blink-dots 1s infinite;
}

@keyframes blink-dots {
0%, 20%, 100% {
    opacity: 0;
}

50% {
    opacity: 1;
}
}

/* Headings */
h2 {
    font-size: 2rem;
    color: #f0f0f0;
    border-bottom: 2px solid #ffa500; /* bright accent orange */
    padding-bottom: 5px;
}

h3 {
    font-size: 1.5rem;
    margin-top: 30px;
    color: #ffa500;
}

#time-to-fly-icon {
    position: absolute; /* Fix to viewport, so stays put while scrolling */
    top: 10px; /* 20px up from the bottom — adjust as needed */
    right: 10px; /* 20px in from the left — adjust as needed */
    z-index: 999; /* Make sure it's above other content */
}

#time-to-fly-icon img {
    width: 40px; /* Control the size of the icon */
    height: 40px;
}

.toggle-search-btn {
    display: none; /* JS will show it when needed */
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(to bottom, #f0f4f9, #d9e3ef);
    color: #2d3a4a;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.toggle-search-btn:hover {
    background: linear-gradient(to bottom, #e8eef5, #cdd9e8);
}

.toggle-search-btn:active {
    transform: scale(0.97);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

@media (prefers-color-scheme: dark) {
    .toggle-search-btn {
        background: linear-gradient(to bottom, #3a3f46, #2b2f34);
        color: #f1f1f1;
        box-shadow: 0 2px 5px rgba(0,0,0,0.6);
    }

    .toggle-search-btn:hover {
        background: linear-gradient(to bottom, #43484f, #34383e);
    }
}

/* -------------------------- */
/* Top Controls: Search, Favorites, Checkboxes */
/* -------------------------- */
.top-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    margin-top: 10px;
    margin-bottom: 20px;
}

/* Each form / control group */
.control-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Location search box */
.input-location {
    padding: 10px 15px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #1a2a44;
    background-color: #112240;
    color: #f0f0f0;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
}

    .input-location::placeholder {
        color: #a0a0a0;
    }

/* Buttons */
.btn-clear-search {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    color: #888;
    line-height: 1;
}

.btn-search,
.btn-fav {
    padding: 10px 15px;
    font-size: 1rem;
    border-radius: 5px;
    border: none;
    background-color: #ffa500;
    color: #0d1b2a;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
}

    .btn-search:hover,
    .btn-fav:hover {
        background-color: #ffb733;
    }

.btn-remove {
    padding: 10px 15px;
    font-size: 1rem;
    border-radius: 5px;
    border: none;
    background-color: #c0392b; /* red */
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
}

.btn-remove:hover {
    background-color: #e74c3c;
}

/* Favorites dropdown */
.favorite-select {
    padding: 10px 15px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #1a2a44;
    background-color: #112240;
    color: #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
}

.favorite-select option {
    background-color: #112240;
    color: #f0f0f0;
}

/* Checkbox container */
.checkbox-container {
    display: flex;
    gap: 15px;
    align-items: center;
    font-weight: bold;
    font-size: 1rem;
}

.checkbox-container label {
    cursor: pointer;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    margin-right: 5px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#showEvening:not(:checked) ~ .flight-windows .evening {
    display: none;
}

/* Radio Button container */
.radiobutton-container {
    display: flex;
    gap: 15px;
    align-items: center;
    font-weight: bold;
    font-size: 1rem;
}

.radiobutton-container label {
    cursor: pointer;
    user-select: none;
}

/* Optional spacing */
.section {
    margin-top: 20px;
}

/* Global link styles — changed from lime green to bright blue */
a, a:visited {
    color: #1E90FF; /* DodgerBlue — bright, readable on dark background */
    text-decoration: none;
}

a:hover, a:focus {
    color: #63B8FF; /* lighter blue on hover/focus */
    text-decoration: underline;
}

a:active {
    color: #187BCD; /* slightly darker when active */
}

/* ppg.report link styling (keeps class-specific control but updated color to match global links) */
.ppg-link {
    color: #1E90FF; /* bright blue */
    font-weight: 500;
    text-decoration: none;
    align-content: flex-start;
}

.ppg-link:hover,
.ppg-link:focus {
    color: #63B8FF; /* lighter blue on hover/focus */
    text-decoration: underline;
}

.ppg-link:active {
    color: #187BCD; /* darker blue when clicked */
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: hidden; /* prevent horizontal scroll */
}

    /* Round only the header and last row; keep table body flush */
    .table-responsive.table-rounded {
        border-radius: 6px;
        overflow: hidden; /* clip corners */
        background: #112240; /* match header background so no seam shows */
        border: 1px solid rgba(255,255,255,0.03);
        box-shadow: 0 6px 18px rgba(0,0,0,0.45);
        padding: 0;
        margin-bottom: 14px; /* add space between consecutive rounded tables (morning / evening) */
    }

        /* Allow rounded corners to apply to cells cleanly */
        .table-responsive.table-rounded table {
            width: 100%;
            border-collapse: separate; /* required for rounded cell corners */
            border-spacing: 0;
            margin: 0;
            background: transparent;
        }

        /* Header cells inherit wrapper background (no visible seams) */
        .table-responsive.table-rounded thead th,
        .table-responsive.table-rounded thead td {
            background: transparent; /* wrapper already has desired color */
            color: #ffa500;
            font-weight: 700;
            position: relative; /* preserves sticky behavior */
            z-index: 3;
        }

        /* Round header corners — only on the first header row (title row) */
        .table-responsive.table-rounded thead tr:first-child th:first-child,
        .table-responsive.table-rounded thead tr:first-child td:first-child {
            border-top-left-radius: 6px;
        }

        .table-responsive.table-rounded thead tr:first-child th:last-child,
        .table-responsive.table-rounded thead tr:first-child td:last-child {
            border-top-right-radius: 6px;
        }

        /* Ensure second header row (column labels) is not rounded */
        .table-responsive.table-rounded thead tr:nth-child(2) th:first-child,
        .table-responsive.table-rounded thead tr:nth-child(2) th:last-child {
            border-top-left-radius: 0;
            border-top-right-radius: 0;
        }

        /* Round bottom corners on the last visible row */
        .table-responsive.table-rounded tbody tr:last-child td:first-child {
            border-bottom-left-radius: 6px;
        }

        .table-responsive.table-rounded tbody tr:last-child td:last-child {
            border-bottom-right-radius: 6px;
        }

        /* Keep alternating/hover rows subtle over the wrapper */
        .table-responsive.table-rounded tbody tr:nth-child(even) {
            background-color: rgba(255,255,255,0.02);
        }

        .table-responsive.table-rounded tbody tr:nth-child(odd) {
            background-color: rgba(255,255,255,0.01);
        }

        .table-responsive.table-rounded tbody tr:hover {
            background-color: rgba(255,255,255,0.06);
        }

        /* Ensure sticky header remains on top */
        .table-responsive.table-rounded thead tr:first-child {
            position: sticky;
            top: 0;
            z-index: 4;
        }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    table-layout: auto;
    box-sizing: border-box;
    word-wrap: break-word; /* force long text to wrap */
    overflow-wrap: break-word;
}

.window-header {
    text-align: center;
    padding: 10px 0;
}

.window-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 4px; /* small gap above link */
}

.ppg-link-wrapper {
    margin-top: 2px;
}

.ppg-link {
    font-size: 0.85rem; /* smaller text */
    font-weight: 500;
    color: #1E90FF; /* bright blue */
    text-decoration: none;
}

    .ppg-link:hover {
        text-decoration: underline;
    }

.dewfont {
    font-size: 0.75em;
}

thead tr:first-child td {
    font-weight: bold;
    background: #112240; /* cockpit navy */
    color: #ffa500;
    font-size: 1.1rem;
}

/* Table Cells */
th, td {
    padding: 10px 8px; /* slightly smaller padding for phones */
    text-align: center;
    border: 1px solid #1a2a44;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* With Strobe = warning */
.warning, .warning td, .warning th {
    background-color: #ffc300;
    color: #000;
    font-weight: bold;
}

/* Smooth = green */
.success, .success td, .success th {
    background-color: #28a745;
    color: #fff;
    font-weight: bold;
}

/* Bumpy = orange */
.bumpy, .bumpy td, .bumpy th {
    background-color: #ffb347;
    color: #000;
    font-weight: bold;
}

/* Very Bumpy = dark orange */
.verybumpy, .verybumpy td, .verybumpy th {
    background-color: #ff8c42;
    color: #000;
    font-weight: bold;
}

/* Wind High = orange trending toward red */
.windhigh, .windhigh td, .windhigh th {
    background-color: #ff5a26;
    color: #fff;
    font-weight: bold;
}

/* Info = sunrise/sunset */
.info, .info td, .info th {
    background-color: #ff7f50;
    color: #fff;
    font-weight: bold;
}

/* Danger = thermic / time to land / other hazards */
.danger, .danger td, .danger th {
    background-color: #e63946;
    color: #fff;
    font-weight: bold;
}

/* Secondary = fallback */
.secondary, .secondary td, .secondary th {
    background-color: #495057;
    color: #fff;
    font-weight: bold;
}

/* Table Hover Effect */
tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.08);
    cursor: default;
}

/* Alternating row gradients */
tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
}

tbody tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Sticky table header */
thead tr:first-child {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* SkyGauge Ad */
.skygauge-ad {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #0d1b2a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

    .skygauge-ad img {
        width: 32px;
        height: 32px;
    }

    /* Tooltip positioned just to the left and shown for 5 seconds */
    .skygauge-ad .tooltip {
        position: absolute;
        right: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background-color: #0d1b2a;
        color: #fff;
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 0.9rem;
        white-space: normal;
        opacity: 0;
        pointer-events: none;
        max-width: 400px;
        min-width: 200px;
        width: auto;
        text-align: left;
        box-shadow: 0 4px 10px rgba(0,0,0,0.4);
        animation: showTooltip 5s ease-in-out forwards;
    }

    .skygauge-ad:hover .tooltip,
    .skygauge-ad:focus .tooltip {
        opacity: 1;
    }

@keyframes showTooltip {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* -------------------------- */
/* Responsive / Mobile Adjustments */
/* -------------------------- */
@media (max-width: 1024px) {
    table {
        font-size: 1.1rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .top-controls,
    .control-group {
        flex-direction: column;
        gap: 15px;
    }

    .input-location,
    .btn-search,
    .btn-add-fav,
    .favorite-select {
        width: 100%;
        margin-bottom: 5px;
    }

    th, td {
        padding: 8px 5px;
        font-size: 1rem;
    }

    .table-responsive {
        overflow-x: hidden;
        width: 100%;
    }
}

/* --- Added: responsive wrapper for top icon + About link --- */
.top-about-group {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;      /* allow the About link to wrap under the icon at narrow widths */
    z-index: 1100;
}

/* keep the existing icon sizing but ensure it behaves as an inline block inside the flex container */
    .top-about-group .top-about-group-icon img,
    #time-to-fly-icon {
        width: 40px;
        height: 40px;
        display: block;
    }

/* ensure the About link sits next to the icon and wraps beneath it when needed */
.top-about-group .top-about-link {
    position: static;     /* no absolute positioning — now flow-controlled by .top-about-group */
    margin: 0;
    white-space: nowrap;  /* keep the word "About" together; will wrap as a whole under the icon */
}

.back-link {
    text-align: center;
    width: 100%;
    display: block;
    margin-bottom: 50px;
}

/* mobile tweak: keep layout readable when viewport is very narrow */
@media (max-width: 420px) {
    .top-about-group {
        gap: 6px;
        right: 8px;
        top: 8px;
    }

    .top-about-group .top-about-link {
        font-size: 0.95rem;
    }
}

/* keep existing fallback that previously set .top-about-link for very small screens */
@media (max-width: 600px) {
    .top-about-group { right: 8px; top: 8px; }
}