/* ==================== BASIS LAYOUT ==================== */
body {
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* FIX: undgår horisontal scroll globalt */
    font-family: "Segoe UI", sans-serif;
    font-size: 16px;
    color: var(--text-color);
    position: relative;
}

/* Fast baggrund via pseudo-element */
body::before {
    content: "";
    position: fixed;
    inset: 0; /* shorthand for top:0; left:0; width:100%; height:100% */
    background-image: url("/static/images/backgrounds/clear.jpeg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1; /* bag alt indhold */
    pointer-events: none; /* klik går igennem */
}

/* Sne skjult uden for sæson */

/* Wrapper for hver linje i Nedbør-sektionen */
.rain-line {
    margin: 2px 0;       /* Lidt afstand mellem linjerne */
}

.hidden {
    display: none !important;
}

/* ==================== GLOBAL TEXT SAFETY ==================== */
/* NY: forhindrer ALLE overflow issues */
label, .label, .value, p, span {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ==================== TEMA FARVER ==================== */
:root {
    --bg-color: #f9f9f9;
    --text-color: #111;
    --muted-text-color: #888;
    --box-bg: rgba(255, 255, 255, 0.65);
    --border-color: #333;
    --section-bg: rgba(255, 255, 255, 0.3);
    --error-color: #d9534f;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #111;
        --text-color: #eee;
        --muted-text-color: #aaa;
        --box-bg: rgba(30, 30, 30, 0.65);
        --border-color: #999;
        --section-bg: rgba(42, 42, 42, 0.4);
        --error-color: #ff6b6b;
    }
}

/* ==================== STIGNING (GRØN) ==================== */
.value-blink-up {
    animation: blinkUpLight 1s ease-out;
}

@keyframes blinkUpLight {
    0% {
        background-color: #4CAF50;
    }
    100% {
        background-color: rgba(255, 255, 255, 0.65);
    }
}

@media (prefers-color-scheme: dark) {
    .value-blink-up {
        animation: blinkUpDark 1s ease-out;
    }

    @keyframes blinkUpDark {
        0% {
            background-color: #4CAF50;
        }
        100% {
            background-color: rgba(30, 30, 30, 0.65);
        }
    }
}

/* ==================== FALD (BLÅ) ==================== */
.value-blink-down {
    animation: blinkDownLight 1s ease-out;
}

@keyframes blinkDownLight {
    0% {
        background-color: #0078FF;
    }
    100% {
        background-color: rgba(255, 255, 255, 0.65);
    }
}

@media (prefers-color-scheme: dark) {
    .value-blink-down {
        animation: blinkDownDark 1s ease-out;
    }

    @keyframes blinkDownDark {
        0% {
            background-color: #0078FF;
        }
        100% {
            background-color: rgba(30, 30, 30, 0.65);
        }
    }
}

/* ==================== NEUTRAL (GRÅ) ==================== */
.value-blink-neutral {
    animation: blinkNeutralLight 1s ease-out;
}

@keyframes blinkNeutralLight {
    0% {
        background-color: #CCCCCC;
    }
    100% {
        background-color: rgba(255, 255, 255, 0.65);
    }
}

@media (prefers-color-scheme: dark) {
    .value-blink-neutral {
        animation: blinkNeutralDark 1s ease-out;
    }

    @keyframes blinkNeutralDark {
        0% {
            background-color: #CCCCCC;
        }
        100% {
            background-color: rgba(30, 30, 30, 0.65);
        }
    }
}

.status-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
}

/* ONLINE / OK */
.status-ok {
  background-color: #2ecc71;
}

/* DEGRADED */
.status-degraded {
  background-color: #f1c40f;
}

/* FAILED / OFFLINE */
.status-failed {
  background-color: #e74c3c;
}

.status-dot {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
  cursor: pointer;
}

/* Tooltip */
.status-dot::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 999;
}

/* Tooltip arrow */
.status-dot::before {
  content: "";
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(0,0,0,0.85) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Show on hover */
.status-dot:hover::after,
.status-dot:hover::before {
  opacity: 1;
}

.flash-container { margin-bottom: 1rem; }
.flash.error { background-color: #fdd; color: #900; padding: 0.5rem; border-radius: 4px; }
.flash.info  { background-color: #def; color: #036; padding: 0.5rem; border-radius: 4px; }
.flash-container { margin-bottom: 1rem; }
.flash.error { background-color: #fdd; color: #900; padding: 0.5rem; border-radius: 4px; }

.form-spacer {
    margin-bottom: 1.5rem; /* justér efter behov */
}

/* ==================== CONTAINERS ==================== */

/* FIX: auto-responsiv grid */
.temp-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* ==================== BOX ==================== */
.temp-box {
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    background-color: var(--box-bg);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);

    /* FIX */
    overflow: hidden;
    text-align: center;
}

/* ==================== STATS GRID ==================== */

/* FIX: fleksibel label/value */
.temp-box .temp-stats {
    display: grid;
    gap: 6px 12px;
}

.temp-box .stat {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
}

.temp-box .label {
    text-align: left;
    justify-self: start;   /* sikrer venstre i grid */
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: break-word;
}

.temp-box .value {
    text-align: right;
    justify-self: end;   /* sikrer højre i grid */
    white-space: nowrap;
}

/* Kommentar */
#kommentar {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.85rem;
}

/* ==================== CANVAS / GRAF ==================== */

/* FIX: responsive charts */
canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 180px;
}

/* ====================
   WIND VALUE – (specifik for wind)
   ==================== */
.wind-stats .wind-value {
    display: inline-grid;
    grid-template-columns: 5ch 5ch;   /* kompas | grader */
    column-gap: 10px;                 /* større afstand mellem kompas og grader */

    justify-content: end;
    justify-items: center;

    width: fit-content;               /* kompakt boks */
}

.wind-stats .wind-value span {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

/* Typografi */
.wind-stats .wind-value span:first-child {
    font-weight: 700;
    text-align: left;
}

.wind-stats .wind-value span:last-child {
    font-weight: 500;
    opacity: 0.75;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Giver lidt mere luft mellem label og value specifikt for wind */
.wind-stats .stat > .wind-value {
    margin-left: 70px;   /* kun for wind, ikke andre temp-stats */
}

/* ==================== HISTORIK ==================== */

.historik-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* 🔥 FIX: fleksibel bredde */
.historik-col,
.historik-end {
    flex: 1 1 300px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background-color: var(--box-bg);
}


/* ==================== KNAPPER ==================== */
.fancy-button {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin-top: 16px;
    margin-bottom: 16px;
}

.fancy-button:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.fancy-button_details {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: inline-flex;
    margin: 16px auto;
    text-decoration: none;
}

.fancy-button_details:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.button-center {
    text-align: center;
}

/* ==================== VERSION FOOTER ==================== */
.version-footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    text-align: center;
    color: #888;
}

/* ==================== VEJR-BAGGRUND ==================== */
body.weather-clear::before {
    background-image: url("/static/images/backgrounds/clear.jpeg");
}

body.weather-clouds::before {
    background-image: url("/static/images/backgrounds/cloudy.jpeg");
}

body.weather-rain::before {
    background-image: url("/static/images/backgrounds/rain.jpeg");
}

body.weather-drizzle::before {
    background-image: url("/static/images/backgrounds/drizzle.jpeg");
}

body.weather-thunderstorm::before {
    background-image: url("/static/images/backgrounds/thunder.jpeg");
}

body.weather-snow::before {
    background-image: url("/static/images/backgrounds/snow.jpeg");
}

body.weather-atmosphere::before {
    background-image: url("/static/images/backgrounds/fog.jpeg");
}

body.weather-unknown::before {
    background-image: url("/static/images/backgrounds/main_blur.png");
}

/* ==================== TERMINAL/HOVED-CONTAINER ==================== */
.terminal-box {
    background-color: var(--box-bg);
    backdrop-filter: blur(12px);
    border: 2px solid var(--border-color);
    padding: 20px;
    max-width: 1000px;
    margin: auto;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
}

.terminal-box h3 {
    text-align: center;
}

/* ==================== TYPOGRAFI ==================== */
.title {
    font-size: 2.2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.25em;
}

.subtitle {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 0.5em;
    color: #999;
}

.main-title {
    font-size: 2.5rem;
}

.sub-title {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.25em;
}

.sub-page-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    border-bottom: 3px solid currentColor;
    padding-bottom: 6px;
    margin-bottom: 20px;
    text-align: center;
}

/* ==================== ICONS ==================== */
.icons {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* ==================== BACKEND CHANGELOG ==================== */
.changelog {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #333;
}

.changelog ul li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.version-links a,
.version-links a:visited,
.version-links a:hover,
.version-links a:active,
.version-links a:focus {
    color: inherit;
    text-decoration: none;
}

.version-links a:hover {
    text-decoration: underline;
}

/* ==================== VEJR-INFO ==================== */
.weather-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.weather-icon {
    width: 60px;
    height: 60px;
}

.weather-details {
    display: flex;
    flex-direction: column;
    font-size: 1rem;
}

.weather-line {
    margin-bottom: 4px;
}

.uv-label {
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ==================== ACCORDION SEKTIONER ==================== */
.section {
    border: 1px solid #ccc;
    margin: 10px 0;
    border-radius: 5px;
    overflow: hidden;
}

.section-header {
    padding: 12px 16px;
    background-color: var(--section-bg);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.section-header .arrow {
    font-size: 1.2em;
    transition: transform 0.2s;
}

.section-content {
    display: none;
    padding: 10px 20px;
}

.nowrap {
    white-space: nowrap;
}

.last-update {
    text-align: center;
    margin: 0.1em 0 0.5em;
    font-size: 0.9rem;
    color: #888;
}

/* ==================== FORECAST ==================== */
/* ==================== FORECAST ==================== */
/* ---------- FORECAST GRID ---------- */

/* FIX: auto-fit */
.forecast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.forecast-col {
    padding: 10px;
    border-radius: 8px;
    background: var(--section-bg);
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
}

.forecast-col > strong {
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;

    opacity: 0.85;
    margin-bottom: 6px;
}

.alert-red {
    color: #ff5f56;
    font-weight: 600;
}

.alert-orange {
    color: #ffbd2e;
    font-weight: 600;
}

.alert-yellow {
    color: #ffd60a;
    font-weight: 600;
}

.alert-none {
    color: #9aa0a6;
}
.forecast-col ul {
    margin: 6px 0 0 16px;
    padding: 0;
}

.forecast-col ul li {
    font-size: 13px;
    opacity: 0.85;
    line-height: 1.35;
}
.forecast-day,
.forecast-block {
    margin-bottom: 20px;
}

.forecast-day h4,
.forecast-block h4 {
    margin: 6px 0 10px;
    font-size: 15px;
    font-weight: 600;
}


/* ==================== DESKTOP-ONLY ELEMENTER ==================== */
.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
}

/* ==================== RESPONSIVE ==================== */
/* Mobil fallback */
@media (max-width: 600px) {

    .temp-container {
        grid-template-columns: 1fr;
    }

    .temp-box .temp-stats {
        grid-template-columns: 1fr;
    }

    .label,
    .value {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .historik-container {
        flex-direction: column;
    }
}

/* ============================
   FALLBACK ERROR STYLES
   Dark-mode compatible
   ============================ */

.fallback-container {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: var(--bg-color);
}

.fallback-global {
    min-height: 100vh;
}

.fallback-box {
    max-width: 520px;
    text-align: center;
    padding: 3rem 2.5rem;
    border-radius: 8px;
    background-color: var(--box-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    backdrop-filter: blur(4px);
}

/* Ikon */
.fallback-icon {
    font-size: 4rem;
    color: var(--error-color);
    margin-bottom: 1.5rem;
}

/* Overskrifter */
.fallback-box h1,
.fallback-box h2 {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Fejltekst */
.fallback-error-text {
    color: var(--muted-text-color);
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Admin status */
.fallback-admin-status {
    font-size: 0.9rem;
    color: var(--muted-text-color);
    margin-bottom: 2rem;
}

/* Knap */
.fallback-btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: 4px;
    background-color: var(--section-bg);
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.fallback-btn:hover {
    background-color: var(--border-color);
    color: var(--bg-color);
}