/* Custom styles for the Astronomy Seeing application */

html {
    scrollbar-gutter: stable;
}

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

/* Number input spinner resets */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Forecast header and controls */
.forecast-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 130;
    display: block;
    height: 74px;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #303846;
    background: linear-gradient(110deg, #11151b 0%, #101318 58%, #151923 100%);
}

.forecast-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 32px, 1200px);
    height: 100%;
    margin: 0 auto;
}

.forecast-header h1,
.forecast-header h1 a {
    margin: 0;
    color: #f6f8fc;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.forecast-header .forecast-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.forecast-brand img {
    flex: 0 0 30px;
    object-fit: contain;
}

.forecast-header .page-links {
    display: flex;
    align-items: stretch;
    height: 38px;
    box-sizing: border-box;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid #465269;
    border-radius: 6px;
    background: #171c25;
}

.forecast-header .page-links .view-mode-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    color: #d2d9e5;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.forecast-header .page-links .view-mode-option + .view-mode-option {
    border-left-color: #465269;
}

.forecast-header .page-links .view-mode-option:hover {
    background: #202734;
    color: #fff;
}

/* User Menu in Header */
.user-menu-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 10px 0 6px;
    box-sizing: border-box;
    background: #171c25;
    border: 1px solid #303846;
    border-radius: 6px;
    color: #f6f8fc;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.user-menu-toggle:hover {
    background: #202734;
    border-color: #465269;
}

.user-menu-toggle:focus-visible {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.25);
}

.user-menu-toggle.is-active {
    background: #202734;
    border-color: #465269;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2b3648 0%, #1e2634 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f6f8fc;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-menu-name {
    max-width: none;
    white-space: nowrap;
    color: #f6f8fc;
}

.user-menu-chevron {
    color: #8c9baf;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s ease;
    flex-shrink: 0;
}

.user-menu-toggle.is-active .user-menu-chevron {
    transform: rotate(180deg);
    color: #f6f8fc;
}

.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 260px;
    box-sizing: border-box;
    background: #141922;
    border: 1px solid #2e3746;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 4px 12px -2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 6px;
    z-index: 1000;
    display: none;
}

.user-dropdown-menu.show {
    display: block;
    animation: userMenuFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes userMenuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-header {
    padding: 8px 10px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.user-dropdown-user-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.user-dropdown-admin-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: #c5d1e0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.user-dropdown-user-email {
    font-size: 12.5px;
    color: #c5d1e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.user-dropdown-divider {
    height: 1px;
    background: #252e3d;
    margin: 5px 0;
    border: none;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #d2d9e5;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.user-dropdown-item svg {
    color: #8c9baf;
    transition: color 0.12s ease;
    flex-shrink: 0;
}

.user-dropdown-item:hover {
    background: #202735;
    color: #ffffff;
}

.user-dropdown-item:hover svg {
    color: #f6f8fc;
}

.user-dropdown-item-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

.user-dropdown-item-logout:hover svg {
    color: #fca5a5;
}

@media (max-width: 480px) {
    .user-menu-name {
        display: none;
    }
    .user-menu-toggle {
        padding: 0 8px;
    }
}

.container.forecast-container {
    width: min(100% - 32px, 1200px);
    padding: 0;
    margin: 0 auto;
    background: transparent;
}

.forecast-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 0;
    padding: 12px 0;
    border-bottom: 1px solid #303846;
}

.forecast-toolbar-controls,
.forecast-toolbar-controls form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.forecast-toolbar-controls {
    min-width: 0;
    flex: 1;
}

.forecast-toolbar-controls label {
    flex: 0 0 auto;
    color: #f1f5f9;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.forecast-toolbar #date,
.forecast-toolbar #location,
.forecast-toolbar .nav-button {
    height: 36px;
    box-sizing: border-box;
    border: 1px solid #465269;
    border-radius: 6px;
    background: #171c25;
    color: #f8fafc;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.forecast-toolbar #date {
    width: 136px;
    padding: 0 10px;
    text-align: center;
}

.forecast-toolbar #location {
    min-width: 270px;
    max-width: 360px;
    padding: 0 36px 0 12px;
    cursor: pointer;
}

.forecast-toolbar .nav-button {
    min-width: 36px;
    padding: 0 12px;
}

.forecast-toolbar #todayBtn { min-width: 64px; }

.forecast-toolbar #date:hover,
.forecast-toolbar #location:hover,
.forecast-toolbar .nav-button:hover { border-color: #70819c; background: #202734; }

.forecast-toolbar #date:focus-visible,
.forecast-toolbar #location:focus-visible,
.forecast-toolbar .nav-button:focus-visible,
.forecast-view-switch .view-mode-option:focus-visible { outline: 3px solid rgba(59, 130, 246, .35); outline-offset: 2px; }

.forecast-view-switch {
    display: flex;
    align-items: stretch;
    height: 31px;
    box-sizing: border-box;
    flex: 0 0 auto;
    border-color: #465269;
    border-radius: 6px;
    background: #171c25;
}
.forecast-view-switch .view-mode-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 0 12px;
    color: #d2d9e5;
    font-size: 12.5px;
    font-weight: 500;
    text-align: center;
}
.forecast-view-switch .view-mode-option + .view-mode-option {
    border-left-color: #465269;
}
.forecast-view-switch .view-mode-option:hover {
    background: #202734;
    color: #fff;
}
.forecast-header .page-links .view-mode-option.active,
.forecast-view-switch .view-mode-option.active { background: #2373ee; color: #fff; font-weight: 600; }
.forecast-view-switch .view-mode-option.active:hover {
    background: #2373ee;
    color: #fff;
}

@media (max-width: 1024px) {
    .forecast-toolbar { align-items: flex-start; flex-direction: column; padding: 18px 0; }
    .forecast-toolbar-controls { flex-wrap: wrap; }
    .forecast-view-switch { align-self: center; }
}

@media (max-width: 640px) {
    .forecast-header { height: 62px; }
    .forecast-header-inner { min-height: 0; }
    .forecast-header h1, .forecast-header h1 a { font-size: 16px; }
    .forecast-toolbar { gap: 16px; min-height: 0; }
    .forecast-toolbar-controls, .forecast-toolbar-controls form { width: 100%; flex-wrap: wrap; }
    .forecast-toolbar-controls label { width: 100%; }
    .forecast-toolbar #date { flex: 1; width: auto; }
    .forecast-toolbar #location { width: 100%; max-width: none; }
    .forecast-view-switch { align-self: stretch; }
    .forecast-view-switch .view-mode-option { flex: 1; }
}

@media (max-width: 768px) {
    .forecast-header .forecast-header-inner { display: flex !important; flex-direction: row; gap: 12px; }
    .forecast-header .page-links { display: flex; grid-column: auto; grid-row: auto; margin: 0 !important; }
    .forecast-toolbar .forecast-view-switch { display: flex; grid-column: auto; grid-row: auto; margin: 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;
}

.view-mode-switch {
    display: flex;
    background-color: #222;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
}

.view-mode-option {
    padding: 7px 11px;
    color: #aaa;
    font-size: 13px;
    text-decoration: none;
}

.view-mode-option + .view-mode-option {
    border-left: 1px solid #444;
}

.view-mode-option:hover {
    background-color: #2d2d2d;
    color: #fff;
}

.view-mode-option.active {
    background-color: #365a8d;
    color: #fff;
    font-weight: bold;
}

.mobile-view-label {
    display: none;
}

#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: 0;
    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;
}

.js-tooltip-target {
    cursor: help;
}

.js-tooltip {
    position: fixed;
    max-width: min(360px, calc(100vw - 16px));
    padding: 10px 14px;
    border: 1px solid #fff;
    border-radius: 5px;
    background: #f3f4f6;
    color: #111827;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    z-index: 2000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.75);
}

.js-tooltip.is-visible {
    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 */
:root {
    --forecast-header-height: 74px;
    --forecast-sticky-height: 74px;
    --table-header-level-height: 0px;
}

.header-level {
    background-color: #222;
}

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

.table-seeing tr.header-level th {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--forecast-sticky-height) - 1px);
    z-index: 85;
    background-color: #222;
    background-image: none;
    box-shadow: none;
    border-bottom: 0;
    padding-top: 12px;
    padding-bottom: 12px;
    line-height: 1.2;
    font-weight: normal;
}

.table-seeing tr.header-parameter th {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--forecast-sticky-height) + var(--table-header-level-height) - 2px);
    z-index: 84;
    background-color: #333;
    background-image: none;
    box-shadow: none;
    border-top: 0;
    border-bottom: 0;
    text-align: left;
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 1.25;
    font-weight: normal;
}

.table-seeing tr.header-parameter th:nth-child(2) {
    text-align: center;
}

.table-seeing tr.header-level th,
.table-seeing tr.header-parameter th {
    background-clip: padding-box;
    border-left: 0;
    border-right: 0;
}

.table-seeing tr.header-level th.section-header {
    border-left: 1px solid #4d5560;
    border-right: 1px solid #4d5560;
}

.table-seeing tr.header-level th.section-tail {
    border-left: 1px solid #4d5560;
}

.table-seeing tr.header-parameter th:nth-child(4),
.table-seeing tr.header-parameter th:nth-child(7),
.table-seeing tr.header-parameter th:nth-child(10),
.table-seeing tr.header-parameter th:nth-child(13),
.table-seeing tr.header-parameter th:nth-child(16) {
    border-left: 1px solid #4d5560;
}

.table-seeing tr.header-parameter th:nth-child(6),
.table-seeing tr.header-parameter th:nth-child(9),
.table-seeing tr.header-parameter th:nth-child(12),
.table-seeing tr.header-parameter th:nth-child(15),
.table-seeing tr.header-parameter th:nth-child(17) {
    border-right: 1px solid #4d5560;
}

.table-seeing .mobile-only {
    display: none;
}

.table-seeing {
    border-collapse: separate;
    border-spacing: 0;
}

.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;
}

.aurora-kp,
.aurora-probability {
    min-width: 48px;
    font-weight: bold;
    text-align: left;
}

.aurora-low {
    background-color: #253047;
    color: #b9c7da;
}

.aurora-medium {
    background-color: #506b2d;
    color: #f2ffd9;
}

.aurora-high {
    background-color: #7c2f74;
    color: #fff;
}

/* 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;
}

.legend-history-row {
    margin: 0 auto 10px;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: #111;
    max-width: 1200px;
    border-bottom: 1px solid #333;
}

.history-controls-sticky {
    position: relative;
    background-color: #111;
}

.history-controls-sticky.is-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--forecast-header-height, 74px) - 1px);
    z-index: 120;
}

.legend-history-row .sun-position-legend.desktop-legend {
    margin: 0;
    padding: 0;
    border-bottom: none;
    max-width: none;
    flex: 1;
}

/* 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: 0;
}

.day-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.day-heading {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.next-day-marker {
    margin-left: 2px;
    color: #9abbe8;
    font-size: 9px;
    vertical-align: super;
}

pre {
    margin: 5px 0;
    font-family: inherit;
}

.astronomy-times {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1 1 auto;
    gap: 16px;
    min-width: 0;
    font-size: 16px;
    font-weight: bold;
    margin: 0;
    color: #ddd;
    padding: 8px 0;
}

.astronomy-times .astronomy-detail {
    white-space: nowrap;
}

.astronomy-times .event-group-icon {
    display: inline-block;
    margin-right: 4px;
    font-size: 18px;
    line-height: 1;
    vertical-align: middle;
}

.astronomy-times .sun-group-icon {
    color: #f2d77c;
}

.astronomy-times .moon-group-icon {
    color: #dcecff;
}

.astronomy-times .event-times {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.astronomy-times .event-time {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

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

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

.astronomy-times .sun-event {
    color: #f2d77c;
    font-size: 16px;
}

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

.astronomy-times .moon-event {
    color: #dcecff;
    font-size: 16px;
}

.astronomy-times .moon-not-visible-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #375477;
    color: #dcecff;
    font-size: 14px;
    line-height: 1.2;
    text-transform: uppercase;
}

.astronomy-times .full-moon-badge {
    background-color: #fff;
    color: #000;
}

.astronomy-times .moon-phase-badge {
    display: inline-block;
    min-width: 52px;
    padding: 4px 8px;
    border: 1px solid #fff;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #26384f;
    color: #fff;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
}

.astronomy-times .moon-phase-name-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #444465;
    color: #fff;
    font-size: 14px;
    line-height: 1.2;
    text-transform: uppercase;
}

.astronomy-times .moon-altitude-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    line-height: 1.2;
}

.astronomy-times .moon-altitude-low {
    background-color: #397343;
}

.astronomy-times .moon-altitude-medium {
    background-color: #9a6b24;
}

.astronomy-times .moon-altitude-high {
    background-color: #9a3d45;
}

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

.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;
}

.astronomy-periods-summary,
.mobile-day-events,
.astronomy-periods-events-only {
    display: none;
}

.astronomy-event-group,
.astronomy-badge-group {
    display: contents;
}

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

.twilight-table th:first-child {
    width: 60%;
}

.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;
}

.history-slider {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 10px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.history-slider[hidden] {
    display: none !important;
}

.history-toggle-link-row {
    margin: 0 0 0 auto;
    white-space: nowrap;
}

.history-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 6px 10px;
    font-size: 14px;
}

.history-toggle-icon {
    margin-right: 3px;
}

.history-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.history-slider-title {
    color: #ddd;
    font-size: 15px;
    font-weight: 600;
}

.history-slider-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 28px;
}

.history-slider label {
    color: #ddd;
    font-weight: normal;
    white-space: nowrap;
}

.history-hour-slider {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.history-hour-slider::-webkit-slider-thumb {
    cursor: grab;
}

.history-hour-slider:active::-webkit-slider-thumb {
    cursor: grabbing;
}

.history-hour-slider::-moz-range-thumb {
    cursor: grab;
}

.history-hour-slider:active::-moz-range-thumb {
    cursor: grabbing;
}

.history-hour-slider.loading {
    opacity: 0.6;
}

.history-date-picker {
    width: 120px;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #222;
    color: #ddd;
    font-size: 12px;
}

.history-hour-ticks {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(25, minmax(0, 1fr));
    font-family: inherit;
    font-size: 13px;
    color: #cfcfcf;
    font-weight: 600;
}

.history-hour-ticks span {
    text-align: center;
    white-space: nowrap;
    transform-origin: center;
    transition: color 0.12s ease, transform 0.12s ease;
}

.history-hour-ticks span.active-hour {
    color: #ffd54f;
    font-weight: 700;
    transform: scale(1.08);
}

.history-now-button {
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #222;
    color: #fff;
    border: 1px solid #444;
    cursor: pointer;
    font-size: 12px;
}

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

/* 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) {
    :root {
        --forecast-header-height: 56px;
        --forecast-sticky-height: 56px;
    }

    .container {
        padding: 0;
    }

    header > div {
        box-sizing: border-box;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto auto;
        gap: 10px;
    }

    h1 {
        margin-bottom: 0;
        font-size: 16px;
        white-space: nowrap;
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    h1 a {
        font-size: 16px;
    }

    .page-links {
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
        margin-left: 0 !important;
    }

    .view-mode-switch {
        grid-column: 1 / -1;
        grid-row: 4;
        min-width: 0;
        margin-left: 0;
    }

    .view-mode-option {
        box-sizing: border-box;
        flex: 1;
        min-width: 0;
        padding: 6px 9px;
        font-size: 12px;
        text-align: center;
    }

    .desktop-view-label {
        display: none;
    }

    .mobile-view-label {
        display: inline;
    }

    .location-picker {
        grid-column: 1 / -1;
        grid-row: 3;
        min-width: 0;
        width: 100%;
    }

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

    #location {
        box-sizing: border-box;
        max-width: 100%;
        width: 100%;
        margin-top: 0;
    }

    .forecast-header {
        height: auto;
        padding: 8px 0;
    }

    .forecast-header-inner,
    .container.forecast-container {
        width: calc(100% - 8px);
    }

    .forecast-header h1,
    .history-controls-sticky {
        display: none;
    }

    .forecast-header .page-links {
        flex: 1;
        height: auto;
    }

    .forecast-header .page-links .view-mode-option {
        padding: 10px 8px;
        font-size: 14px;
    }

    .forecast-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        padding: 10px 0;
        margin-bottom: 8px;
    }

    .forecast-toolbar-controls {
        display: contents;
    }

    .forecast-toolbar #dateForm {
        grid-column: 1;
        grid-row: 1;
        width: auto;
        flex-wrap: nowrap;
        gap: 6px;
        min-width: 0;
    }

    .forecast-toolbar #locationForm {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .forecast-toolbar .forecast-view-switch {
        grid-column: 2;
        grid-row: 1;
        align-self: stretch;
        height: auto;
    }

    .forecast-toolbar #date,
    .forecast-toolbar #location,
    .forecast-toolbar .nav-button {
        height: 40px;
    }

    .forecast-toolbar .flatpickr-wrapper {
        flex: 1 1 auto;
        min-width: 0;
    }

    .forecast-toolbar #date {
        width: 100%;
        min-width: 0;
        padding: 0 6px;
    }

    .forecast-toolbar #prevBtn,
    .forecast-toolbar #nextBtn {
        flex: 0 0 40px;
    }

    .forecast-toolbar .nav-button {
        min-width: 40px;
        padding: 0 10px;
    }

    .forecast-toolbar .forecast-view-switch .view-mode-option {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 56px;
        padding: 0 10px;
        font-size: 13px;
    }

    .table-seeing {
        table-layout: auto;
    }

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

    .table-seeing td.new-day {
        white-space: normal;
        padding: 8px 4px !important;
    }

    .table-seeing .desktop-only {
        display: none !important;
    }

    .table-seeing .mobile-only {
        display: table-cell;
    }

    .table-seeing tr.header-parameter th {
        border-left: 0;
        border-right: 0;
    }

    .table-seeing tr.header-parameter th:nth-child(3),
    .table-seeing tr.header-parameter th:nth-child(7),
    .table-seeing tr.header-parameter th:nth-child(10),
    .table-seeing tr.header-parameter th:nth-child(14),
    .table-seeing tr.header-parameter th:nth-child(16) {
        border-left: 1px solid #4d5560;
    }

    .table-seeing tr.header-parameter th:nth-child(16) {
        border-right: 1px solid #4d5560;
    }

    .indicator-cell {
        width: 18px;
    }

    .sun-icon, .moon-icon {
        font-size: 14px;
        margin-right: 6px;
    }

    .direction-arrow {
        font-size: 11px;
        right: -7px;
    }

    .date-day {
        padding-left: 0;
    }

    .day-heading {
        align-self: stretch;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
    }

    .day-header-content {
        gap: 0;
    }

    .astronomy-times .moon-not-visible-badge,
    .astronomy-times .moon-phase-badge,
    .astronomy-times .moon-phase-name-badge,
    .astronomy-times .moon-altitude-badge {
        padding: 3px 6px;
        font-size: 11px;
    }

    .astronomy-periods {
        margin-top: 8px;
        padding: 0;
    }

    .astronomy-periods-summary {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px 12px;
        padding: 8px 10px;
        color: rgba(255, 255, 255, 0.8);
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        list-style: none;
    }

    .astronomy-periods-summary::-webkit-details-marker {
        display: none;
    }

    .astronomy-periods-summary::after {
        content: '';
        width: 7px;
        height: 7px;
        margin: -3px 4px 0 auto;
        border-right: 2px solid #9abbe8;
        border-bottom: 2px solid #9abbe8;
        transform: rotate(45deg);
        transition: transform .15s ease;
    }

    .astronomy-periods[open] > .astronomy-periods-summary::after {
        margin-top: 3px;
        transform: rotate(-135deg);
    }

    .astronomy-periods[open] > .twilight-tables-container {
        padding: 0 6px 6px;
    }

    .astronomy-periods.astronomy-periods-events-only {
        display: block;
    }

    .day-header-content > .astronomy-times {
        display: none;
    }

    .mobile-day-events {
        display: block;
        padding: 0 10px 8px;
    }

    .mobile-day-events .astronomy-times {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 0;
    }

    .mobile-day-events .astronomy-event-group,
    .mobile-day-events .astronomy-badge-group {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
    }

    .twilight-tables-container {
        gap: 6px;
    }

    .twilight-table-column {
        flex: 1 1 100%;
        min-width: 0;
    }

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

    .twilight-table td:last-child {
        white-space: nowrap;
    }

    .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;
    }

    .legend-history-row {
        margin: 0 auto 10px;
        padding: 8px 10px;
    }

    .history-controls-sticky {
        position: relative;
    }

    .history-controls-sticky.is-sticky {
        position: -webkit-sticky;
        position: sticky;
        top: calc(var(--forecast-header-height, 56px) - 1px);
        z-index: 120;
    }

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

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

    .day-header-content {
        align-items: flex-start;
        flex-direction: column;
    }

    .astronomy-times {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
        box-sizing: border-box;
        gap: 6px 10px;
        margin: 0;
        font-size: 12px;
        padding: 6px 0 0;
    }

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

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

    .history-slider {
        gap: 8px;
    }

    .history-slider-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-slider-actions {
        width: 100%;
        justify-content: space-between;
    }

    .history-hour-ticks {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .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;
    }
}

@media (max-width: 380px) {
    .table-seeing th,
    .table-seeing td {
        padding: 3px 2px;
        font-size: 11px;
    }
}

.app-dialog {
    width: min(420px, calc(100vw - 32px));
    padding: 22px 22px 18px;
    box-sizing: border-box;
    background: #141922;
    color: #e4eaf3;
    border: 1px solid #2e3746;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    font-family: inherit;
}

.app-dialog::backdrop {
    background: rgba(6, 9, 14, 0.72);
}

.app-dialog-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 600;
    color: #f6f8fc;
}

.app-dialog-message {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.5;
    color: #aebacb;
    overflow-wrap: anywhere;
}

.app-dialog-input {
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 18px;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    color: #f6f8fc;
    background: #0e1219;
    border: 1px solid #2e3746;
    border-radius: 8px;
}

.app-dialog-input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

.app-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.app-dialog-btn {
    padding: 8px 16px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
}

.app-dialog-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.app-dialog-btn-primary {
    background: #2563eb;
    color: #fff;
}

.app-dialog-btn-primary:hover {
    background: #1d4ed8;
}

.app-dialog-btn-secondary {
    background: #202734;
    color: #c0ccdc;
    border-color: #2e3746;
}

.app-dialog-btn-secondary:hover {
    background: #28313f;
}

.app-dialog-btn-danger {
    background: #c0392b;
    color: #fff;
}

.app-dialog-btn-danger:hover {
    background: #a93226;
}
