/* ═══════════════════════════════════════════════════════════
   nav.css — Sidebar (desktop ≥1024px) + bundmenu (mobil)
   + tilføj-sheet (bottom sheet / modal)
═══════════════════════════════════════════════════════════ */

/* ── App-skal ── */
/* Desktop: sidebar + indhold side om side */
@media (min-width: 1024px) {
    .app {
        display: flex;
        height: 100svh;
        max-width: none;
        overflow: hidden;
        animation: none;
    }
    main { margin-top: 0; }
}

@media (max-width: 1023px) {
    .app {
        display: block;
        height: auto;
        max-width: 100%;
        overflow: visible;
    }
    main { margin-top: 0; }
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR (desktop ≥1024px)
═══════════════════════════════════════════════════════════ */
#sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    height: 100svh;
    overflow-y: auto;
    position: sticky;
    top: 0;
}

@media (max-width: 1023px) {
    #sidebar { display: none; }
}

/* Logo øverst */
.sidebar-header {
    padding: var(--s-5) var(--s-4) var(--s-4);
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--s-3);
}

.sidebar-logo {
    height: 26px;
    width: auto;
    display: none;
}
[data-theme="dark"]  .sidebar-logo--dark  { display: block; }
[data-theme="light"] .sidebar-logo--light { display: block; }
/* Fallback: ingen data-theme sat (script endnu ikke kørt) */
:root:not([data-theme]) .sidebar-logo--dark { display: block; }

/* Override generic nav rule from components.css */
#sidebar-nav { overflow-x: visible; overflow-y: visible; }
#bottom-nav  { overflow-x: visible; }

/* Nav-knapper */
#sidebar-nav {
    flex: 1;
    padding: 0 var(--s-2);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 10px var(--s-3);
    border-radius: var(--r-md);
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    text-align: left;
    cursor: pointer;
    min-height: 40px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.nav-item:hover    { background: var(--surface-2); color: var(--text); }
.nav-item.active   { background: var(--surface-2); color: var(--text); }
.nav-item.active:hover { background: var(--surface-2); }

.nav-icon  { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
.nav-label { flex: 1; }

/* Sidebar bund: Tilføj-knap + profil + indstil + log ud */
.sidebar-bottom {
    padding: var(--s-3) var(--s-2);
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#sidebar-add-btn {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    font-size: 14px;
    border-radius: var(--r-md);
    height: 44px;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    margin-bottom: var(--s-3);
    transition: opacity 0.15s;
}
#sidebar-add-btn:hover  { opacity: 0.88; }
#sidebar-add-btn:active { opacity: 0.72; transform: scale(0.98); }

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-md);
    margin-bottom: var(--s-1);
}

.sidebar-profile-info {
    flex: 1;
    min-width: 0;
}
.sidebar-profile-info .p-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-profile-info .p-hh {
    font-size: 11px;
    color: var(--faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#logout-btn {
    background: transparent;
    color: var(--faint);
    padding: 0 var(--s-1);
    height: 28px;
    width: 28px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}
#logout-btn:hover { color: var(--red-text); }

/* ═══════════════════════════════════════════════════════════
   INDHOLDS-WRAPPER
═══════════════════════════════════════════════════════════ */
#content-wrap {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--s-6) var(--s-8);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 1023px) {
    #content-wrap {
        padding: var(--s-5) var(--s-5) calc(80px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 640px) {
    #content-wrap {
        padding: var(--s-4) var(--s-4) calc(80px + env(safe-area-inset-bottom, 0px));
    }
}

/* ═══════════════════════════════════════════════════════════
   BUNDMENU (mobil <1024px)
═══════════════════════════════════════════════════════════ */
#bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bar);
    border-top: 1px solid var(--line);
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: stretch;
    -webkit-backdrop-filter: saturate(180%) blur(0px);
}

@media (max-width: 1023px) {
    #bottom-nav { display: flex; }
}

.bot-tab {
    background: transparent;
    color: var(--faint);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    border-radius: 0;
    min-height: 44px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    transition: color 0.15s;
}

.bot-icon  { display: flex; align-items: center; justify-content: center; will-change: transform; transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1); }
.bot-label { font-size: 10px; font-weight: 600; }

.bot-tab.active            { color: var(--text); background: var(--surface-2); border-radius: var(--r-md); }
.bot-tab.active .bot-icon  { transform: scale(1.08); }
.bot-tab:active .bot-icon  { transform: scale(0.88); }

/* Center "+" knap */
.bot-add {
    flex: none;
    width: 64px;
    color: transparent; /* ingen farvestatus */
}
.bot-add::after { display: none; }

.bot-add-ring {
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: var(--on-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 16px var(--shadow);
    transform: translateY(-8px);
    transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), opacity 0.15s;
    will-change: transform;
}
.bot-add:hover  .bot-add-ring { transform: translateY(-10px) scale(1.04); }
.bot-add:active .bot-add-ring { transform: translateY(-5px) scale(0.92); opacity: 0.88; }

/* ═══════════════════════════════════════════════════════════
   TILFØJ-SHEET (bottom sheet mobil / modal desktop)
═══════════════════════════════════════════════════════════ */
#add-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-end;
}
#add-sheet.hidden { display: none; }

.add-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    animation: fadeIn 0.22s ease-out;
}

.add-panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: var(--s-3) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom, 0px));
    animation: sheetUp 0.3s cubic-bezier(0.32,0.72,0,1);
    max-height: 92svh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.add-handle {
    width: 36px; height: 4px;
    background: var(--dash);
    border-radius: var(--r-pill);
    margin: 0 auto var(--s-4);
}

.add-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s-4);
}

/* Interne faner i sheetet */
.add-tabs {
    display: flex;
    gap: var(--s-1);
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 3px;
    margin-bottom: var(--s-5);
}

.add-tab {
    flex: 1;
    height: 34px;
    border-radius: calc(var(--r-md) - 3px);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.add-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 4px var(--shadow);
}

.add-pane         { display: none; }
.add-pane.active  { display: block; animation: sectionIn 0.15s ease-out; }

/* Stil quick-add-formen inde i sheetet */
.add-pane .quick-add-form {
    grid-template-columns: 1fr 1fr;
}

/* Desktop: modal i centrum */
@media (min-width: 1024px) {
    #add-sheet {
        align-items: center;
        justify-content: center;
    }
    .add-panel {
        width: 520px;
        border-radius: var(--r-xl);
        padding-bottom: var(--s-6);
        animation: slideUp 0.22s ease-out;
    }
}

/* ═══════════════════════════════════════════════════════════
   MOBILPROFIL  (vises i bundmenuens "Mere"-strøm hvis nødv.)
   Lang-toggle i Indstillinger
═══════════════════════════════════════════════════════════ */
#lang-toggle {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    height: 38px;
    padding: 0 var(--s-4);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
#lang-toggle:hover { color: var(--text); background: var(--surface-2); }

/* ═══════════════════════════════════════════════════════════
   MOBIL HEADER (kun <1024px)
═══════════════════════════════════════════════════════════ */
#mobile-header {
    display: none;
}

@media (max-width: 1023px) {
    #mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: env(safe-area-inset-top, 0px) var(--s-4) 0;
        height: calc(52px + env(safe-area-inset-top, 0px));
        background: var(--bar);
        border-bottom: 1px solid var(--line);
        position: sticky;
        top: 0;
        z-index: 800;
        flex-shrink: 0;
    }
}

.mobile-logo { display: none; }
[data-theme="dark"]  .mobile-logo--dark  { display: block; }
[data-theme="light"] .mobile-logo--light { display: block; }
:root:not([data-theme]) .mobile-logo--dark { display: block; }

#mobile-avatar-btn {
    background: transparent;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   PROFIL-SHEET (mobil)
═══════════════════════════════════════════════════════════ */
#profile-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-end;
}
#profile-sheet.hidden { display: none; }

.profile-user-row {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding-bottom: var(--s-4);
    margin-bottom: var(--s-3);
    border-bottom: 1px solid var(--line);
}
.profile-user-row .p-name { font-size: 15px; font-weight: 600; color: var(--text); }
.profile-user-row .p-hh  { font-size: 12px; color: var(--faint); }

.profile-sheet-item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    padding: var(--s-3) var(--s-3);
    border-radius: var(--r-md);
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    margin-bottom: 2px;
}
.profile-sheet-item:hover { background: var(--surface-2); }
.profile-sheet-item.danger { color: var(--red-text); }

.profile-sheet-section {
    margin-bottom: var(--s-4);
}
.profile-sheet-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--faint);
    margin-bottom: var(--s-2);
}
