body.dark-mode.theme-high-contrast .music-modal {
    border: 3px solid var(--primary);
    box-shadow: 0 0 0 4px #000, 0 4px 32px #0008;
}
.collapse-footer-fixed .theme-label {
    display: block;
    transition: opacity 0.2s, height 0.2s;
    opacity: 1;
    height: auto;
    overflow: visible;
}
.collapse-footer-fixed.footer-collapsed .theme-label {
    opacity: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}
/* Footer toggle button */

/* Collapse button styled as theme-item */

.collapse-footer-fixed {
    position: fixed;
    right: 34px;
    bottom: 15px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.collapse-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.0rem;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.85;
    box-shadow: 0 2px 8px var(--shadow);
}
.collapse-swatch:hover {
    background: var(--bg-primary);
    opacity: 1;
}

.control-bar.collapsed {
    display: none !important;
}
/* ============================================
   CSS VARIABLES AND THEMES
   ============================================ */

:root {
    --primary: #2563eb;
    --secondary: #1e40af;
    --accent: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);

    --transition: all 0.3s ease;
}

body.dark-mode {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Dark Mode Themes */
body.dark-mode.theme-calm {
    --primary: #6366f1;
    --secondary: #4f46e5;
    --accent: #8b5cf6;
}

body.dark-mode.theme-neon {
    --primary: #00ff88;
    --secondary: #00cc66;
    --accent: #ff00ff;
}

body.dark-mode.theme-high-contrast {
    --primary: #ffff00;
    --secondary: #ffff00;
    --accent: #ffffff;
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
}

body.dark-mode.theme-forest {
    --primary: #34d399;
    --secondary: #10b981;
    --accent: #6ee7b7;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-wrapper {
    width: 44vw;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    display: flex;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    padding: 30px 20px 24px;
    text-align: center;
    border-bottom: 2px solid var(--border);
}

.time-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.time {
    font-size: clamp(5.6rem, 11vh, 7.2rem);
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    line-height: 1;
}

.date {
    font-size: 1.5rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: lowercase;
    text-align: center;
}

.date-muted {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
    letter-spacing: 0.04em;
    text-align: center;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 20px;
    overflow: hidden;
}

section {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

section h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--primary);
}

.calendar-header,
.weather-header {
    display: grid;
    
}

.calendar-header {
    grid-template-columns: auto 1fr;
    margin-bottom: 10px;
    gap: 10px;
    position: relative;
}

.calendar-header h2,
.weather-header h2 {
    margin-bottom: 0;
}

.calendar-header .date-muted {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
    opacity: 0.88;
    font-weight: 500;
}

/* ============================================
   CALENDAR
   ============================================ */


.calendar-section {
    order: 2;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.calendar-header {
    align-items: center;
}

.calendar-month {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
}

.calendar-month:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

.calendar-month h3 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--primary);
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 4px;
    color: var(--text-secondary);
    font-weight: 500;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    background-color: var(--primary);
    color: white;
    font-weight: 700;
}

.calendar-day.clickable:hover {
    background-color: var(--accent);
    transform: scale(1.1);
}

/* ============================================
   WEATHER
   ============================================ */

.weather-section {
    order: 1;
    flex: 0 0 auto;
}

.weather-header {
    grid-template-columns: auto 1fr auto;
    margin-bottom: 16px;
    gap: 10px;
}

.weather-header .date {
    justify-self: center;
    font-size: 1.2rem;
    opacity: 0.9;
}

.city-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.city-select:hover,
.city-select:focus {
    border-color: var(--primary);
    outline: none;
}

.weather-forecast {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.weather-card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.weather-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.weather-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.weather-icon {
    font-size: 1.7rem;
    margin: 6px 0;
}

.weather-temp {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 3px;
    white-space: pre;
}

.weather-temp-min {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    opacity: 0.7;
}

.weather-conditions {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 5px;
    opacity: 0.8;
}

.weather-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   CONTROL BAR
   ============================================ */

.control-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-top: 2px solid var(--border);
    background-color: var(--bg-secondary);
    position: relative;
}

.control-group-center {
    display: flex;
    gap: 15px;
}

.theme-inline {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: absolute;
    right: 80px; /* Flyt ind fra højre, så der er plads til collapse-knap */
    top: 50%;
    transform: translateY(-50%);
}

.theme-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.theme-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1;
}

.theme-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.75;
}

.theme-swatch:hover,
.theme-swatch.active {
    transform: scale(1.08);
    border-color: var(--primary);
    opacity: 1;
}

.theme-swatch[data-theme="calm"] {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.theme-swatch[data-theme="light"] {
    background: linear-gradient(135deg, #f8fafc 0%, #dbeafe 100%);
}

.theme-swatch[data-theme="neon"] {
    background: linear-gradient(135deg, #00ff88 0%, #ff00ff 100%);
}

.theme-swatch[data-theme="high-contrast"] {
    background: linear-gradient(135deg, #ffff00 0%, #ffffff 100%);
}

.theme-swatch[data-theme="forest"] {
    background: linear-gradient(135deg, #34d399 0%, #6ee7b7 100%);
}

.control-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background-color: var(--bg-primary);
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.control-btn:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   MODALS
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--primary);
}

/* ============================================
   THEME SELECTOR MODAL
   ============================================ */

.theme-modal {
    position: relative;
    min-width: 300px;
}

.theme-modal h3 {
    margin-bottom: 20px;
    color: var(--primary);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background-color: var(--bg-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.theme-option:hover {
    border-color: var(--primary);
}

.theme-option.active {
    border-color: var(--primary);
    background-color: var(--bg-primary);
}

.theme-preview {
    width: 60px;
    height: 60px;
    border-radius: 6px;
}

.theme-preview.calm {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.theme-preview.neon {
    background: linear-gradient(135deg, #00ff88 0%, #ff00ff 100%);
}

.theme-preview.high-contrast {
    background: linear-gradient(135deg, #ffff00 0%, #ffffff 100%);
}

.theme-preview.forest {
    background: linear-gradient(135deg, #34d399 0%, #6ee7b7 100%);
}

/* ============================================
   CALENDAR MODAL
   ============================================ */

.calendar-modal {
    position: relative;
    min-width: 600px;
}

.detailed-calendar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    height: 100%;
}

.calendar-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
}

.calendar-view h3 {
    color: var(--primary);
    margin-bottom: 8px;
    text-align: center;
}

.calendar-table {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-header {
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    font-size: 0.8rem;
}

.calendar-cell {
    height: clamp(24px, 2.6vh, 34px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
}

.calendar-cell.other-month {
    opacity: 0.3;
    cursor: default;
}

.calendar-cell.today {
    background-color: var(--primary);
    color: white;
    font-weight: 700;
}

.calendar-cell.holiday {
    background-color: color-mix(in srgb, var(--primary) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary) 60%, transparent);
    /* color: var(--primary); */
    font-weight: 600;
}

.calendar-cell.today.holiday {
    background: linear-gradient(
        140deg,
        color-mix(in srgb, var(--primary) 92%, white 8%) 0%,
        color-mix(in srgb, var(--secondary) 88%, black 12%) 100%
    );
    color: #fff;
    border: 2px solid var(--accent);
    font-weight: 700;
}

.important-dates {
    margin-top: 8px;
}

.important-dates h4 {
    color: var(--primary);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.important-dates ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
}

.important-dates li {
    padding: 5px 7px;
    margin-bottom: 4px;
    /* Fjern ekstra margin mellem rækker, da grid bruges */
    background-color: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ============================================
   MUSIC PLAYER MODAL
   ============================================ */

.music-modal {
    position: relative;
    min-width: 500px;
    max-width: 600px;
    min-height: 700px;
    max-height: 90vh;
    height: 700px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: visible;
}

.music-modal h3 {
    color: var(--primary);
    margin-bottom: 20px;
}

.music-player {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.now-playing {
    background-color: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.track-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--border);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

.progress {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

.player-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.player-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background-color: var(--bg-secondary);
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-btn:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
}

.player-btn svg {
    width: 24px;
    height: 24px;
}

.playlist {
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.playlist h4 {
    color: var(--primary);
    margin-bottom: 12px;
}

.playlist-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: none;
    overflow-y: visible;
}

.playlist-item {
    padding: 12px;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.playlist-item:hover {
    background-color: var(--border);
    border-left-color: var(--primary);
}

.playlist-item.playing {
    background-color: var(--primary);
    color: white;
    border-left-color: var(--primary);
    font-weight: 600;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .page-wrapper {
        width: 86vw;
    }

    .weather-forecast {
        grid-template-columns: repeat(2, 1fr);
    }

    .detailed-calendar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-wrapper {
        width: 94vw;
    }

    .time {
        font-size: clamp(4rem, 10vw, 5rem);
    }

    .weather-header {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 8px;
    }

    .calendar-header {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 6px;
        position: static;
    }

    .calendar-header .date-muted {
        position: static;
        transform: none;
    }

    .date {
        font-size: 1.2rem;
    }

    .header {
        padding: 20px 10px;
    }

    .main-content {
        padding: 10px;
        gap: 10px;
    }

    section {
        padding: 15px;
    }

    .detailed-calendar {
        grid-template-columns: 1fr;
    }

    .calendar-cell {
        height: 28px;
        font-size: 0.78rem;
    }

    .music-modal {
        min-width: 90vw;
    }

    .control-bar {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
        padding-right: 10px;
    }

    .control-group-center {
        gap: 10px;
    }

    .theme-inline {
        position: static;
        transform: none;
        width: auto;
        justify-content: flex-end;
    }

    .theme-label {
        font-size: 0.62rem;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }
}
