/* === GLOBALE STYLES === */
* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; width: 100%; 
    font-family: 'Poppins', sans-serif; display: flex; flex-direction: column;
    background-color: #f4f4f9; color: #333;
}

/* === HEADER === */
header {
    position: sticky;
    top: 0;
    z-index: 10000; /* Ændret til 10000 */
    flex-shrink: 0; height: 50px; background: #ffffff; border-bottom: 2px solid #eaeaea;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

header h1 { margin: 0; font-size: 22px; font-weight: 700; color: #333; letter-spacing: -0.5px; }
.accent { color: #6688cc; font-weight: 600; margin: 0 2px; }

.header-controls { display: flex; gap: 10px; align-items: center; }
.menu-container { position: relative; }
.hamburger-btn {
    background: #ffffff; border: 1px solid #ddd; border-radius: 4px;
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #555; transition: all 0.2s;
}
.hamburger-btn:hover { background: #f4f4f9; border-color: #ccc; }
.dropdown-menu {
    position: absolute; top: 44px; right: 0; background: #ffffff;
    border: 1px solid #eaeaea; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 140px; display: none; flex-direction: column; 
    z-index: 10001; /* Ændret fra 100 til 10001 */ 
    overflow: hidden;
}
.dropdown-menu.show { display: flex; }
.dropdown-menu a {
    text-decoration: none; color: #333; padding: 10px 16px; font-size: 13px;
    font-weight: 500; border-bottom: 1px solid #f4f4f9; transition: background 0.2s, color 0.2s; cursor: pointer;
}
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background: #f9f9f9; color: #6688cc; }

/* === APP WRAPPER & LAYOUT === */
#app-wrapper { flex-grow: 1; padding: 15px; display: flex; flex-direction: column; width: 100%; }
#main-layout { display: flex; flex-direction: column; gap: 15px; width: 100%; height: 100%; }
#visuals-column { display: flex; flex-direction: column; gap: 12px; width: 100%; }
#menu-column { display: flex; flex-direction: column; gap: 12px; width: 100%; }

#globe-container { width: 100%; height: auto; aspect-ratio: 1 / 1; position: relative; cursor: grab; touch-action: none; background: #eef2f5; border-radius: 6px; overflow: hidden; }
#merc-wrap { width: 100%; aspect-ratio: 2 / 1; flex-shrink: 0; position: relative; background: #c8dff0; border-radius: 6px; overflow: hidden; cursor: grab; touch-action: none; }
#merc-canvas { width: 100%; height: 100%; display: block; }

#mobile-scroll-btns { position: fixed; top: 65px; right: 15px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.scroll-btn {
    background: rgba(255, 255, 255, 0.9); border: 1px solid #aaa; border-radius: 8px;
    width: 44px; height: 44px; font-size: 18px; color: #333; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer; display: flex; justify-content: center; align-items: center; user-select: none; -webkit-tap-highlight-color: transparent;
}
.scroll-btn:active { background: #e0e0e0; }

.desktop-only { display: none; }
.mobile-only { display: block; font-size: 10px; color: #666; text-align: center; margin-top: 15px; padding-bottom: 20px; }
.credit-text a { color: #0055cc; text-decoration: none; font-weight: 600; }

/* === DESKTOP OVERRIDES === */
@media (min-width: 800px) {
    html, body { height: 100vh; overflow: hidden; }
    #app-wrapper { height: calc(100vh - 50px); overflow: hidden; }
    #main-layout { flex-direction: row; align-items: stretch; height: 100%; overflow: hidden; }
    #visuals-column { width: 60%; height: 100%; display: flex; justify-content: center; align-items: center; position: relative; }
    #globe-container { max-width: 100%; max-height: 100%; width: 100%; flex-shrink: 1; }
    #menu-column { width: 40%; height: 100%; max-height: 100%; overflow: hidden; padding-right: 4px; }
    #marker-panel { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
    #mobile-scroll-btns { display: none; } 
    .mobile-only { display: none; }
    .desktop-only { display: block; position: absolute; bottom: 0; left: 0; text-align: left; font-size: 10px; color: #666; }
}

#marker-panel::-webkit-scrollbar { width: 6px; }
#marker-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* === UI KNAPPER & PANELER === */
.global-controls { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.globe-btn { background: #f0f0f0; color: #333; border: 1px solid #bbb; border-radius: 4px; padding: 6px 12px; font-family: inherit; font-size: 12px; cursor: pointer; transition: 0.2s; }
.globe-btn:hover { background: #e0e0e0; }
.globe-input { border: 1px solid #bbb; border-radius: 4px; padding: 2px 6px; font-family: inherit; font-size: 11px; }

#marker-panel { width: 100%; background: #f4f4f9; display: none; flex-direction: column; }
.panel-card { background: #ffffff; border: 1px solid #e4e4e4; border-radius: 8px; padding: 12px; margin-bottom: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.03); transition: opacity 0.2s; }
.hint { font-size: 11px; color: #555; line-height: 1.4; padding: 8px; background: #eef2f5; border-radius: 6px; border: 1px solid #ddd; flex-shrink: 0; }
#route-panel { margin-top: 8px; padding-top: 12px; border-top: 2px dashed #ddd; display: none; flex-shrink: 0; }
#route-result { margin-top: 10px; font-weight: 600; font-size: 13px; color: #00aa00; text-align: right; border-top: 1px solid #ccc; padding-top: 6px; margin-bottom: 20px;}
/* Giver profil-knappen en 'aktiv' tilstand når sidebaren er åben */
.hamburger-btn.active-profile-btn {
    background: #eef2f5 !important;
    border-color: #6688cc !important;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
}

/* === MODALS === */
/* === MODALS === */
.cookie-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 10005; /* Ændret fra 9999 til 10005 for at lægge sig foran headeren (z-index 10000) */ display: none; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; }
.cookie-overlay.show { display: flex; opacity: 1; }
.cookie-modal { background: #ffffff; width: 90%; max-width: 500px; border-radius: 12px; padding: 25px; box-shadow: 0 15px 35px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; transform: translateY(20px); transition: transform 0.3s ease; }
.cookie-overlay.show .cookie-modal { transform: translateY(0); }
.cookie-modal h2 { margin: 0; font-size: 20px; color: #333; }
.cookie-modal p { margin: 0; font-size: 13px; color: #555; line-height: 1.5; }
.cookie-category { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid #eaeaea; }
.cookie-category-info { flex: 1; padding-right: 15px; }
.cookie-category-info strong { display: block; font-size: 14px; margin-bottom: 2px; color: #333; }
.cookie-category-info span { font-size: 11px; color: #777; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #6688cc; }
input:checked + .slider:before { transform: translateX(20px); }
input:disabled + .slider { background-color: #e0e0e0; cursor: not-allowed; }
input:disabled + .slider:before { background-color: #999; }

.cookie-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.btn-cookie { flex: 1; padding: 10px 15px; border-radius: 6px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.2s; border: none; min-width: 120px; }
.btn-accept { background: #6688cc; color: white; }
.btn-accept:hover { background: #5577bb; }
.btn-reject { background: #ffd9d9; color: #aa0000; }
.btn-reject:hover { background: #ffcccc; }
.btn-save { background: #f0f0f0; color: #333; border: 1px solid #ccc; width: 100%; }
.btn-save:hover { background: #e4e4e4; }

/* === MAGIC LINK (LOGIN FORM) === */
.magic-link-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 800px) {
    .magic-link-group {
        flex-direction: row;
    }
}

/* === TOAST NOTIFICATIONS === */
#toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-msg { background: rgba(30, 30, 30, 0.9); color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 13px; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: fadeinout 4.5s forwards; }
@keyframes fadeinout { 0% { opacity: 0; transform: translateY(10px); } 10% { opacity: 1; transform: translateY(0); } 90% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(10px); } }
.sidebar-overlay {
    z-index: 9998;
}

.user-sidebar {
    z-index: 9999;
}

#mobile-scroll-btns {
    z-index: 90;
}

/* === USER SIDEBAR === */
.sidebar-overlay {
    position: fixed; top: 50px; left: 0; width: 100%; height: calc(100vh - 50px);
    background: rgba(0,0,0,0.5); z-index: 1999; display: none; opacity: 0; transition: opacity 0.3s ease;
}
.sidebar-overlay.show { display: block; opacity: 1; }

.user-sidebar {
    position: fixed; top: 50px; right: 0; width: 100%; height: calc(100vh - 50px);
    background: #ffffff; box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    z-index: 2000; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
}
.user-sidebar.show { transform: translateX(0); }

.sidebar-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; border-bottom: 1px solid #eaeaea; background: #f9f9f9;
}
.sidebar-dropdown-container { position: relative; }

.close-sidebar-btn { background: none; border: none; font-size: 28px; cursor: pointer; color: #777; line-height: 1; padding: 0; }
.close-sidebar-btn:hover { color: #333; }

.sidebar-content { flex-grow: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }

.sidebar-nav-btn {
    display: block; padding: 12px 16px; background: #fff; border: 1px solid #eaeaea;
    border-radius: 8px; color: #444; text-decoration: none; font-weight: 500; font-size: 14px;
    transition: all 0.2s; cursor: pointer; text-align: left;
}
.sidebar-nav-btn:hover { background: #f4f4f9; border-color: #ddd; }
.sidebar-nav-btn.active { background: #eef2f5; border-color: #6688cc; color: #6688cc; font-weight: 600; }

#sidebar-dynamic-content { margin-top: 15px; border-top: 2px dashed #eaeaea; padding-top: 20px; }
.sidebar-footer { padding: 15px 20px; border-top: 1px solid #eaeaea; background: #f9f9f9; }

@media (min-width: 800px) {
    .user-sidebar { width: 400px; }
}
/* Hvis siden er RTL, spejles ikoner og tekstjusteringer automatisch */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

/* Sørg for at ikoner og menuer placerer sig korrekt i højre side i stedet for venstre */
html[dir="rtl"] header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .header-controls {
    flex-direction: row-reverse;
}

/* Sørg for at dropdown-menuer åbner mod venstre i stedet for højre, så de ikke ryger ud af skærmen */

