/* css/base.css */

/* --- 1. VARIABLES --- */
:root {
    /* Identitet */
    --primary: #1b1d1f;
    --primary-light: #2d3436; 
    --primary-dark: #1976D2;  
    --primary-dark-hover: #1565C0;
    
    /* Status */
    --success: #52c41a;
    --danger: #ff4d4f;
    --danger-bg: #fff1f0;           
    --warning: #faad14;
    --warning-bg: #fffbe6;          
    --warning-dark: #d48806;
    
    /* Bakgrunner og overflater */
    --bg: #f5f7fa;
    --bg-secondary: #f0f2f5;
    --bg-active: #e8f0fe;
    --card-bg: #ffffff;
    --modal-overlay-bg: rgba(30, 41, 59, 0.75); /* En dyp blå-grå med gjennomsiktighet */
    --modal-blur: 4px;
    
    /* Tekst og linjer */
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #dfe6e9;
    --border-dark: #cbd5e1;      
    
    /* Dekorasjon */
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);

    /* Users */
    --user-pal: #51aa25;      
    --user-christian: #708fc4;
    --user-stian: #eb6264;   
    --user-default: var(--primary);

    /* System spesifikk */
    --primary-dark-10: rgba(25, 118, 210, 0.1);
    --primary-dark-05: rgba(25, 118, 210, 0.05);

    /* Størrelser */
    --sidebar-width: 260px;
    --sidebar-minimized-width: 70px;
    --header-height: 65px;
    --sidebar-icon-size: 18px;

    /* Mapping av Sidebar-farger til nytt system */
    --sidebar-bg: var(--bg-secondary);
    --sidebar-text: var(--text-muted);
    --sidebar-active-color: var(--primary-dark);
    --sidebar-hover-bg: var(--border);

}


.hidden { display: none !important; }
.desktop-only { display: block !important; }
.mobile-only { display: none !important; }
.show { display: block !important; }

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

input{
    font-size: 16px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

.p-10{ padding: 10px; }
.p-20{ padding: 20px; }
.p-30{ padding: 30px; }


.m-10{ margin: 10px; }
.m-20{ margin: 20px; }
.m-30{ margin: 30px; }
.m-40{ margin: 40px; }

.mt-5{ margin-top: 5px; }
.mt-10{ margin-top: 10px; }
.mt-15{ margin-top: 15px; }
.mt-20{ margin-top: 20px; }

.mb-0{ margin-bottom: 0px; }
.mb-5{ margin-bottom: 5px; }
.mb-10{ margin-bottom: 10px; }
.mb-15{ margin-bottom: 15px; } 
.mb-20{ margin-bottom: 20px; } 


.small{
    font-size: 0.75rem;
    font-weight: 600;
}


.small-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.catalog-module .sidebar,
.artist-module .sidebar,
.details-module .sidebar,
.inventory-module .sidebar,
.stickers-module .sidebar,
.planner-module .sidebar,
.profile-module .sidebar,
.reports-module .sidebar{
    display: none !important;
}

/* ************************************** */
/* Skjul moduler som ikke skal ha sidebar */
/* ************************************** */


.mobile-only-btn{
    display: none;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- 2. HEADER SYSTEM --- */
#mainHeader {
    background: var(--primary);
    padding: 10px 0;
    box-shadow: var(--shadow-sm);
    z-index: 1100;
    height: var(--header-height);
}

#headerInner {
    /*max-width: 1400px;*/
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#logo { filter: brightness(0) invert(1); height: 40px; }

#toggleMenuBtn {
    background: transparent; border: none; color: white;
    cursor: pointer; padding: 8px; display: flex; align-items: center;
}

#toggleMenuBtn svg { width: 32px; height: 32px; stroke: white; fill: none; }

#dropdownMenu {
    position: absolute;
    right: 20px;
    top: var(--header-height);
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    min-width: 220px;
    overflow: hidden;
}

#dropdownMenu a {
    display: block; padding: 12px 20px;
    text-decoration: none; color: white;
    font-size: 0.9rem; border-bottom: 1px solid var(--primary-light);
    transition: background 0.2s;
}

#dropdownMenu a:hover { background: var(--primary-light); }

#dropdownMenu span {
    display: block; padding: 15px 20px;
    color: var(--border); font-size: 11px; text-transform: uppercase;
}


/* --- OPPGRADERT SIDEBAR SYSTEM --- */
/* MÅ FIKSE JS OG HTML OGSÅ */
/* --- SIDEBAR BASE --- */
.app-wrapper {
    display: flex; 
    height: calc(100vh - var(--header-height)); 
    overflow: hidden;
    position: relative;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    overflow: hidden; /* Hindrer tekst-leak ved minimering */
}

/* --- MENY-STRUKTUR --- */
.sidebar-menu {
    list-style: none;
    padding: 0;
}

.menu-category {
    padding: 20px 25px 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    transition: opacity 0.2s;
}

/* --- SIDEBAR ITEMS --- */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 4px 12px;
    cursor: pointer;
    color: var(--sidebar-text);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-item span{
    margin-left: 6px;
}

.sidebar-item:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--text);
}

.sidebar-item.active {
    color: var(--primary-dark);
    background-color: var(--bg-active);
    font-weight: 600;
}

/* --- MINIMERT TILSTAND --- */
.sidebar.minimized {
    width: var(--sidebar-minimized-width);
}

.sidebar.minimized .sidebar-item {
    padding: 12px;
    justify-content: center;
}

.sidebar.minimized .sidebar-item .icon {
    margin-right: 0;
}

/* Skjul all tekst (span nr 2) og kategorier når minimert */
.sidebar.minimized .sidebar-item span:nth-child(2),
.sidebar.minimized .menu-category {
    opacity: 0;
    pointer-events: none;
}

/* --- FOOTER & MINIMER-KNAPP --- */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

#sidebar-minimize-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.sidebar.minimized #sidebar-minimize-btn {
    transform: rotate(180deg); /* Pilen peker andre vei */
}


.main-content {
    flex-grow: 1; 
    overflow-y: auto;
    height: 100%;
    background-color: var(--bg);
    padding: 0 20px;
}

@media (max-width: 768px) {


    .desktop-only{ display: none !important;}
    .mobile-only{ display: block !important;}

    .main-content{
        padding: 0 6px;
    }

    .app-wrapper {
        height: calc(100vh - 50px); /* Juster etter mobil-header høyde */
    }
    
    .sidebar {
        /* Bruk en fast piksel-verdi her for å overstyre 300px fra Notes */
        width: 260px !important; 
        left: -260px !important; 
        
        position: fixed;
        top: 50px;
        bottom: 0;
        z-index: 2000;
        overflow: visible !important;
        transition: left 0.3s ease;
    }
    
    .sidebar.open { 
        left: 0 !important; 
    }

    .mobile-only-btn {
        display: flex !important;
        position: absolute;
        left: 100%; /* Sitter nå fast på 260px-kanten istedenfor 300px */
        top: 150px;
        width: 40px;
        height: 40px;
        z-index: 2100;
        background: var(--bg);
        color: --var(--sidebar-bg);
        border: none;
        border-radius: 0 8px 8px 0;
        box-shadow: 4px 0 8px rgba(0, 0, 0, 0.1);
        cursor: pointer;
    }


    .catalog-module .sidebar,
    .catalog-module .mobile-only-btn,
    .artist-module .sidebar,
    .artist-module .mobile-only-btn,
    .details-module .sidebar,
    .details-module .mobile-only-btn,
    .inventory-module .sidebar,
    .inventory-module .mobile-only-btn,
    .stickers-module .sidebar,
    .stickers-module .mobile-only-btn,
    .planner-module .sidebar,
    .planner-module .mobile-only-btn,
    .profile-module .sidebar,
    .profile-module .mobile-only-btn {
        display: none !important;
    }
}