/* -----------------------------------------------------------
   GLOBAL LAYOUT & RESET
----------------------------------------------------------- */

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f3f3;
    color: #222;
}

a { color: #0055aa; text-decoration: none; }
a:hover { text-decoration: underline; }

input, select, textarea, button { font-family: inherit; }

/* -----------------------------------------------------------
   HEADER
----------------------------------------------------------- */

.header {
    background: #1b1f23;
    color: white;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo { height: 42px; width: auto; }

.header-title {
    font-size: 20px;
    font-weight: bold;
}

.header-right { font-size: 14px; }

.header-role { opacity: 0.85; }

.logout-link {
    color: #ff6666;
    font-weight: bold;
}
.logout-link:hover { text-decoration: underline; }

/* -----------------------------------------------------------
   SIDEBAR
----------------------------------------------------------- */

.layout { display: flex; }

.sidebar {
    width: 220px;
    background: #e9e9e9;
    padding: 18px 12px;
    min-height: calc(100vh - 60px);
    border-right: 1px solid #ccc;
}

.sidebar a {
    display: block;
    padding: 6px 4px;
    border-radius: 3px;
    margin-bottom: 4px;
    font-size: 14px;
    color: #222;
}

.sidebar a:hover { background: #d5d5d5; }

.nav-section-title {
    margin-top: 14px;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: bold;
    color: #444;
}

.main { flex: 1; padding: 20px; }

/* -----------------------------------------------------------
   CARDS
----------------------------------------------------------- */

.card {
    background: white;
    padding: 20px 20px;
    margin: 0 0 22px 0;
    border-radius: 8px;
    box-shadow: 0 0 4px rgba(0,0,0,0.07);
}

.card h2, .card h3 { margin-top: 0; }

/* -----------------------------------------------------------
   TABLES
----------------------------------------------------------- */

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.table th {
    background: #ececec;
    text-align: left;
    padding: 8px;
    font-weight: bold;
}

.table td {
    padding: 8px;
    border-top: 1px solid #ccc;
}

.table tr:nth-child(even) { background: #fafafa; }

/* Knapper i tabeller – bedre spacing (desktop og mobil) */
.table td form,
.table td .button {
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 6px;
}

/* -----------------------------------------------------------
   FORMS
----------------------------------------------------------- */

.form-section label {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
}

.input {
    width: 100%;
    padding: 7px;
    margin-top: 3px;
    border: 1px solid #aaa;
    border-radius: 4px;
    font-size: 14px;
}

textarea.input { resize: vertical; }

.checkbox-row { display: flex; align-items: center; gap: 6px; }
.inline-form { display: inline-block; }

/* -----------------------------------------------------------
   BUTTONS
----------------------------------------------------------- */

.button {
    display: inline-block;
    padding: 7px 14px;
    background: #0055aa;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-align: center;
}

.button:hover { background: #003f7d; }

.button.small { padding: 4px 8px; font-size: 12px; }

.button.red { background: #cc3333; }
.button.red:hover { background: #991f1f; }

.button.full { width: 100%; }

/* -----------------------------------------------------------
   BADGES
----------------------------------------------------------- */

.badge {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: white;
}
.badge-green { background: #2e9b41; }
.badge-yellow { background: #cc9922; }
.badge-red { background: #c93232; }
.badge-gray { background: #888; }

/* -----------------------------------------------------------
   GRID
----------------------------------------------------------- */

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* -----------------------------------------------------------
   MESSAGE BOXES
----------------------------------------------------------- */

.success-box {
    background: #d7f3d7;
    padding: 10px;
    border-left: 4px solid #2e9b41;
    margin-bottom: 14px;
}

.error-box {
    background: #f7dada;
    padding: 10px;
    border-left: 4px solid #c93232;
    margin-bottom: 14px;
}

.muted { color: #666; font-size: 14px; }

/* -----------------------------------------------------------
   LOGIN PAGE
----------------------------------------------------------- */

.login-wrapper {
    width: 100%;
    height: 100vh;
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    background: white;
    padding: 26px 28px;
    width: 360px;
    border-radius: 10px;
    box-shadow: 0 0 5px rgba(0,0,0,0.15);
    text-align: center;
}

.login-logo {
    height: 80px;
    width: auto;
    margin-bottom: 10px;
}

.login-footer-text { font-size: 13px; color: #666; margin-top: 20px; }

/* -----------------------------------------------------------
   FOOTER
----------------------------------------------------------- */

.footer {
    padding: 14px;
    text-align: center;
    font-size: 13px;
    color: #666;
}

/* -----------------------------------------------------------
   MOBILE DRAWER MENU SUPPORT
   Viktig: skjul mobil-elementer eksplisitt på desktop
----------------------------------------------------------- */

/* Hamburger-knapp: SKJULT på desktop */
.mobile-menu-btn {
    display: none;
    border: 1px solid rgba(255,255,255,0.25);
    background: transparent;
    color: white;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

/* Mobil-top i sidebar: SKJULT på desktop */
.mobile-sidebar-top {
    display: none;
}

.mobile-sidebar-title { font-weight: bold; color: #222; }

.mobile-sidebar-close {
    border: 1px solid #bbb;
    background: white;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

/* Backdrop */
.sidebar-backdrop { display: none; }

/* -----------------------------------------------------------
   MOBILE RESPONSIVE
----------------------------------------------------------- */

@media (max-width: 900px) {

    .header {
        position: sticky;
        top: 0;
        z-index: 2000;
        padding: 10px 12px;
    }

    .header-title { font-size: 16px; }
    .logo { height: 34px; }

    /* Header: unngå linjebryting (Logg ut deles i to) */
    .header-right {
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .logout-link { white-space: nowrap; }

    /* Vis hamburger på mobil */
    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
    }

    /* mindre støy i header på mobil */
    .header-user { display: none; }

    .layout { display: block; }

    .main { padding: 12px; }

    .card { padding: 16px; margin-bottom: 14px; }

    .input { padding: 10px; font-size: 16px; }

    .button { padding: 10px 14px; font-size: 16px; }

    /* Sidebar som drawer (HØYRE side) */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        height: 100vh;
        width: min(86vw, 340px);
        min-height: auto;
        border-right: none;
        border-left: 1px solid #ccc;
        z-index: 2500;
        transform: translateX(110%);
        transition: transform 0.2s ease;
        box-shadow: 0 0 10px rgba(0,0,0,0.25);
        padding: 14px 12px;
        overflow-y: auto;
        background: #e9e9e9;
    }

    body.sidebar-open .sidebar { transform: translateX(0); }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 2400;
    }

    body.sidebar-open .sidebar-backdrop { display: block; }

    /* Vis mobil-toppen i sidebar */
    .mobile-sidebar-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #ccc;
    }

    /* Tabeller: scroll på mobil */
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th, .table td { white-space: nowrap; }

    /* Tabellknapper: én per linje på mobil, store trykkflater */
    .table td { vertical-align: top; }

    .table td form { display: block; }

    .table td .button {
        width: 100%;
        box-sizing: border-box;
    }
}
.folder {
    cursor: pointer;
    user-select: none;
}
