/* Custom styles for the Astronomy Seeing application */

/* Base styles */
body {
    font-family: Arial, sans-serif;
    background-color: #111;
    color: #fff;
    margin: 0;
    padding: 0;
}

.container {
    max-width: none;
    margin: 0 auto;
    padding: 10px 20px;
}

/* Header styles */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    padding: 10px 20px;
    margin-bottom: 20px;
}

#locationForm {
    display: flex;
    align-items: center;
}

#locationForm label {
    margin-right: 10px;
    color: #fff;
}

#location {
    padding: 8px 12px;
    border-radius: 4px;
    background-color: #333;
    color: #fff;
    border: 1px solid #444;
    cursor: pointer;
    font-size: 14px;
}

h1 {
    margin: 0;
    font-size: 24px;
}

/* Condition indicators */
.condition-indicator {
    display: inline-block;
    margin-left: 15px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    position: relative;
    cursor: help;
}

.condition-good {
    background-color: #28a745;
    color: white;
}

.condition-poor {
    background-color: #dc3545;
    color: white;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: normal;
    text-transform: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Date selector styles */
.date-selector {
    margin-bottom: 20px;
    padding: 10px 20px;
    border-bottom: 1px solid #333;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.date-selector label {
    margin-right: 10px;
    font-size: 16px;
    font-weight: normal;
}

.date-selector input {
    padding: 8px 12px;
    border-radius: 4px;
    background-color: #333;
    color: #fff;
    border: 1px solid #444;
    cursor: pointer;
    font-size: 16px;
    min-width: 120px;
    text-align: center;
    margin: 0;
    box-sizing: border-box;
}

.nav-button {
    padding: 8px 15px;
    border-radius: 4px;
    background-color: #222;
    color: #fff;
    border: 1px solid #444;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
    min-width: 40px;
    text-align: center;
    margin: 0;
    box-sizing: border-box;
    white-space: nowrap;
}

.nav-button:hover {
    background-color: #333;
}

.date-selector .buttons {
    display: flex;
    gap: 12px;
}

.date-selector button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Flatpickr customization */
.flatpickr-calendar.dark {
    background: #2a2a2a;
    border-color: #444;
    box-shadow: 0 3px 13px rgba(0, 0, 0, 0.3);
}

.flatpickr-day.flatpickr-disabled {
    color: #555 !important;
}

.flatpickr-day.selected {
    background: #3366cc !important;
    border-color: #3366cc !important;
}

/* Hide days that don't have data with a stronger effect */
.flatpickr-day.flatpickr-disabled {
    opacity: 0.2;
}

/* Table styles */
.header-level {
    background-color: #222;
}

.header-parameter {
    background-color: #333;
}

.new-day {
    background-color: #222;
    font-weight: bold;
    padding: 10px !important;
    text-align: left !important;
}

/* Base row styles */
.hour-row {
    background-color: #1a1a1a;
}

/* Sun position based styling */
.hour-row.night {
    background-color: #15152a;
}

.hour-row.astronomical-dawn {
    background-color: #19163a;
}

.hour-row.nautical-dawn {
    background-color: #1e224e;
}

.hour-row.dawn {
    background-color: #243358;
}

.hour-row.daytime {
    background-color: #1a1a1a;
}

.hour-row.dusk {
    background-color: #2d3352;
}

.hour-row.nautical-dusk {
    background-color: #222243;
}

.hour-row.astronomical-dusk {
    background-color: #1c1c38;
}

.time {
    font-weight: bold;
    position: relative;
}

.time.highlighted {
    background-color: rgba(255, 180, 0, 0.15);
}

/* Colored cells */
.coloured {
    font-weight: bold;
}

/* Legend for sun positions */
.sun-position-legend {
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background-color: #111;
    max-width: 1200px;
}

/* Desktop legend - shown at top on desktop only */
.sun-position-legend.desktop-legend {
    margin: 0 auto 15px;
    border-bottom: 1px solid #333;
    display: flex;
}

/* Mobile legend - hidden by default on desktop */
.sun-position-legend.mobile-legend {
    margin: 15px auto 0;
    border-top: 1px solid #333;
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 300;
}

.legend-color {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    border: none;
    border-radius: 3px;
}

/* Moon and sun time indicators */
.date-day {
    font-weight: bold;
    padding-left: 10px;
    margin-right: 10px;
}

pre {
    margin: 5px 0;
    font-family: Arial, sans-serif;
}

pre.astronomy-times {
    font-size: 16px;
    font-weight: bold;
    margin: 8px 0;
    color: #ddd;
    background-color: #2c2c2c;
    padding: 8px;
    border-radius: 4px;
    display: inline-block;
}

pre.astronomy-times .time-value {
    font-size: 18px;
    padding: 0 2px;
}

pre.astronomy-times .sun-time {
    color: #ccaa44;
}

pre.astronomy-times .moon-time {
    color: #88aacc;
}

pre.astronomy-times .time-value {
    transition: all 0.2s ease;
    display: inline-block;
}

pre.astronomy-times .time-value:hover {
    transform: scale(1.1);
    text-shadow: 0 0 5px currentColor;
}

/* Twilight data table styling */
.astronomy-periods {
    margin-top: 10px;
    background-color: #1e1e2d;
    padding: 10px;
    border-radius: 4px;
}

.twilight-table {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 0.9em;
}

.twilight-table th,
.twilight-table td {
    padding: 6px 10px;
    border: none;
    text-align: left;
    color: rgba(255, 255, 255, 0.7); /* Faded text color */
}

.twilight-table tr {
    border-bottom: 1px solid rgba(80, 80, 80, 0.2);
}

.twilight-table tr:last-child {
    border-bottom: none;
}

.twilight-table th {
    background-color: #2c2c40;
    color: rgba(221, 221, 221, 0.85); /* Slightly faded header text */
    font-weight: normal;
}

.twilight-table tr:nth-child(odd) {
    background-color: #222233;
}

.twilight-table tr:nth-child(even) {
    background-color: #282838;
}

/* Side-by-side tables layout */
.twilight-tables-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
}

.twilight-table-column {
    flex: 1;
    min-width: 300px;
}

/* Celestial indicators in first column */
.indicator-cell {
    position: relative;
    width: 30px;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
}

.sun-icon, .moon-icon {
    position: relative;
    font-size: 18px;
    display: inline-block;
    margin-right: 10px; /* Add margin to give space for the arrow */
}

.direction-arrow {
    position: absolute;
    font-size: 14px;
    right: -10px;
}

.direction-arrow.up {
    top: -8px;
}

.direction-arrow.down {
    top: -8px;
}

.sun-icon {
    color: #ccaa44;
}

.moon-icon {
    color: #88aacc;
}

/* Colors based on quality - muted version */
.quality-1 {
    background-color: #c45555;
    color: #fff;
}

.quality-2 {
    background-color: #c47744;
    color: #fff;
}

.quality-3 {
    background-color: #c4a444;
    color: #000;
}

.quality-4 {
    background-color: #88a444;
    color: #000;
}

.quality-5 {
    background-color: #55a455;
    color: #000;
}

/* Cloud cover colors based on percentage - muted version */
.clouds-0 {
    background-color: #2c2c4c;
    color: #ccc;
}

.clouds-20 {
    background-color: #4a4a66;
    color: #ccc;
}

.clouds-40 {
    background-color: #686878;
    color: #fff;
}

.clouds-60 {
    background-color: #878787;
    color: #fff;
}

.clouds-80 {
    background-color: #a8a898;
    color: #000;
}

.clouds-100 {
    background-color: #d8d8b8;
    color: #000;
}

/* Jet Stream colors - muted version */
.jet-15 {
    background-color: #a8b844;
}

.jet-16 {
    background-color: #b8b044;
}

.jet-17 {
    background-color: #b8a644;
}

.jet-18 {
    background-color: #b89c44;
}

.jet-19 {
    background-color: #b89444;
}

.jet-20 {
    background-color: #b88a44;
}

/* Temperature gradient colors - muted version */
.gradient-0 {
    background-color: #44bb44;
    color: #000;
}

.gradient-05 {
    background-color: #77b844;
    color: #000;
}

.gradient-06 {
    background-color: #88b844;
    color: #000;
}

.gradient-07 {
    background-color: #99b844;
    color: #000;
}

.gradient-08 {
    background-color: #a8b844;
    color: #000;
}

.gradient-09 {
    background-color: #b8b844;
    color: #000;
}

.gradient-10 {
    background-color: #b8b244;
    color: #000;
}

.gradient-11 {
    background-color: #b8a844;
    color: #000;
}

.gradient-14 {
    background-color: #b85544;
    color: #fff;
}

.gradient-15 {
    background-color: #b84444;
    color: #fff;
}

.gradient-20 {
    background-color: #b83344;
    color: #fff;
}

.gradient-24 {
    background-color: #b82244;
    color: #fff;
}

/* Bad Layers colors */
.layer-000 {
    background-color: #00002a;
    color: #fff;
}

.layer-001 {
    background-color: #0c935c;
    color: #fff;
}

.layer-005 {
    background-color: #8c9361;
    color: #fff;
}

.layer-010 {
    background-color: #8f935d;
    color: #fff;
}

.layer-015 {
    background-color: #929358;
    color: #fff;
}

.layer-020 {
    background-color: #959354;
    color: #fff;
}

.layer-025 {
    background-color: #899367;
    color: #fff;
}

.layer-030 {
    background-color: #829471;
    color: #fff;
}

.layer-036 {
    background-color: #7e9477;
    color: #fff;
}

.layer-042 {
    background-color: #789480;
    color: #fff;
}

.layer-091 {
    background-color: #5b97af;
    color: #fff;
}

.layer-103 {
    background-color: #5397bb;
    color: #fff;
}

/* Responsive design */
@media (max-width: 1024px) {
    .container {
        padding: 10px;
    }

    .table-seeing th,
    .table-seeing td {
        padding: 5px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0;
    }

    header > div {
        flex-wrap: wrap;
        gap: 10px;
    }

    h1 {
        margin-bottom: 0;
        font-size: 16px;
        white-space: nowrap;
        flex-shrink: 1;
        min-width: 0;
    }

    h1 a {
        font-size: 16px;
    }

    .page-links {
        display: flex;
        gap: 10px;
        margin-left: 0;
        flex-shrink: 0;
    }

    .page-links a {
        font-size: 13px;
        white-space: nowrap;
    }

    #locationForm {
        margin-top: 0;
        flex-basis: 100%;
        justify-content: center;
    }

    #location {
        width: auto;
        margin-top: 0;
    }

    .table-seeing {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .table-seeing th,
    .table-seeing td {
        padding: 4px;
        font-size: 12px;
    }

    .date-selector {
        padding: 8px 10px;
        margin: 0;
    }

    .date-navigation {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 8px;
    }

    .date-selector label {
        display: none;
    }

    .date-selector input {
        flex: 1;
        min-width: 110px;
        margin-right: 8px;
        font-size: 14px;
        padding: 6px 10px;
    }

    .date-selector .nav-button {
        padding: 6px 12px;
        font-size: 14px;
        min-width: auto;
    }

    .date-selector #todayBtn {
        min-width: 60px;
    }

    .date-selector #prevBtn,
    .date-selector #nextBtn {
        min-width: 35px;
    }

    .sun-position-legend.desktop-legend {
        display: none;
    }

    .sun-position-legend.mobile-legend {
        display: flex;
        padding: 10px;
        gap: 8px;
    }

    .legend-item {
        margin-bottom: 5px;
    }

    pre.astronomy-times {
        font-size: 12px;
        padding: 6px;
        display: block;
        white-space: pre-wrap;
        word-break: break-word;
    }

    pre.astronomy-times .time-value {
        font-size: 12px;
    }

    .condition-indicator {
        display: inline-block;
        margin-left: 10px;
        padding: 3px 5px !important;
        border-radius: 4px;
        font-size: 12px !important;
        font-weight: bold;
        text-transform: uppercase;
        position: relative;
        cursor: help;
    }
}

@media (max-width: 480px) {
    pre.astronomy-times {
        line-height: 1.8;
    }

    .date-selector {
        padding: 8px;
    }

    .date-selector label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .date-selector input {
        min-width: 85px;
        font-size: 13px;
        padding: 5px 8px;
    }

    .date-selector .nav-button {
        padding: 5px 8px;
        font-size: 13px;
    }

    .date-selector #todayBtn {
        min-width: 48px;
    }

    .date-selector #prevBtn,
    .date-selector #nextBtn {
        min-width: 28px;
        padding: 5px 6px;
    }

    .date-navigation > div {
        gap: 4px;
    }
}