/* =========================================
   1. VARIABLER OG RESET
   ========================================= */
:root {
    --primary: #FA5900;
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --bg-sidebar: #000000;
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --border: #333333;
}

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

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* Standard PC: Låser scroll på body */
}

/* =========================================
   2. HOVEDLAYOUT (DESKTOP)
   ========================================= */
.admin-wrapper {
    display: grid;
    grid-template-columns: 260px 1fr; /* 260px sidebar, resten innhold */
    height: 100vh;
    width: 100%;
}

/* Skjul mobil-ting på PC */
.mobile-toggle-btn { display: none; }
.desktop-only { display: inline-block; }

/* Overlay (Kun for mobil) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 900;
    backdrop-filter: blur(3px);
}

/* =========================================
   3. SIDEBAR (MENY)
   ========================================= */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    overflow-y: auto;
    z-index: 1000;
    height: 100%;
}

.brand {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu ul { list-style: none; }

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.3s;
    border-left: 4px solid transparent;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background-color: #1a1a1a;
    color: #fff;
    border-left-color: var(--primary);
}

.sidebar-icon {
    width: 24px;
    margin-right: 15px;
    filter: grayscale(100%);
    transition: 0.3s;
}

.sidebar-menu li a:hover .sidebar-icon, 
.sidebar-menu li a.active .sidebar-icon { 
    filter: none; 
}

/* =========================================
   4. INNHOLD (MAIN CONTENT)
   ========================================= */
.main-content {
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Scroller innholdet */
    position: relative;
    background-color: var(--bg-dark);
}

/* Top Bar */
.top-bar {
    background-color: var(--bg-panel);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 800;
}

.user-info { font-weight: bold; color: #fff; display: flex; align-items: center; gap: 10px; }

.logout-btn {
    color: #ff4d4d;
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid #ff4d4d;
    padding: 5px 15px;
    border-radius: 4px;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.logout-btn:hover { background: #ff4d4d; color: #fff; }

/* Page Content */
.page-content { padding: 30px; }

h1.page-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

/* =========================================
   5. KOMPONENTER
   ========================================= */

/* KORT */
.card, .dash-card {
    background: var(--bg-panel);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

/* KNAPPER */
.btn, .btn-outline, .btn-cta, .btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    cursor: pointer;
    line-height: 1.2;
    border: none;
}

.btn, .btn-cta { background-color: var(--primary); color: #fff; }
.btn:hover, .btn-cta:hover { background-color: #e04e00; transform: translateY(-1px); }

.btn-outline { background-color: transparent; border: 1px solid #555; color: #ccc; }
.btn-outline:hover { border-color: var(--primary); color: #fff; background-color: rgba(250, 89, 0, 0.1); }

.btn-small { padding: 5px 10px; font-size: 0.8rem; }

/* SKJEMA */
input[type="text"], input[type="password"], input[type="email"], 
input[type="number"], input[type="date"], input[type="time"], 
textarea, select {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    width: 100%;
    font-size: 1rem;
    outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }

/* TABELLER */
.admin-table-wrapper { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border-radius: 8px;
    overflow: hidden;
    min-width: 600px;
}
.admin-table th, .admin-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background-color: #252525; color: var(--primary); font-weight: bold; text-transform: uppercase; font-size: 0.85rem; }
.admin-table tr:hover { background-color: #2a2a2a; }

/* DASHBOARD */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}
.dash-card { display: flex; align-items: center; transition: transform 0.2s; }
.dash-card:hover { transform: translateY(-5px); border-color: var(--primary); }
.dash-icon { font-size: 2rem; margin-right: 20px; color: var(--primary); }
.dash-info h3 { font-size: 2rem; margin: 0; color: #fff; }
.dash-info span { color: var(--text-muted); text-transform: uppercase; font-size: 0.85rem; }

/* ALERTS */
.alert { padding: 15px; margin-bottom: 20px; border-radius: 5px; font-weight: bold; display: flex; align-items: center; gap: 10px; }
.alert-success { background: rgba(40,167,69,0.2); color: #28a745; border: 1px solid #28a745; }
.alert-error { background: rgba(220,53,69,0.2); color: #dc3545; border: 1px solid #dc3545; }

/* TRENERE & PARTNERE */
.staff-list { display: flex; flex-direction: column; gap: 15px; max-width: 1000px; }
.staff-card { display: flex; align-items: center; background-color: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 20px; transition: background 0.2s; }
.staff-card:hover { border-color: var(--primary); background-color: #252525; }
.staff-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-right: 25px; border: 2px solid var(--primary); flex-shrink: 0; }
.staff-info { flex-grow: 1; }
.staff-info h3 { margin: 0 0 5px 0; font-size: 1.2rem; color: #fff; }
.staff-meta { display: block; color: #aaa; font-size: 0.9rem; margin-bottom: 5px; }
.staff-actions { display: flex; gap: 10px; }

.partner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.partner-card { background: #fff; padding: 20px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px solid #ccc; height: 100%; transition: transform 0.2s; }
.partner-card:hover { transform: translateY(-5px); border-color: var(--primary); }
.partner-img { max-width: 100%; max-height: 80px; object-fit: contain; margin-bottom: 15px; }
.partner-actions { margin-top: 10px; width: 100%; display: flex; justify-content: center; gap: 10px; }


/* =========================================
   6. MOBIL RESPONSIVITET (Override)
   ========================================= */
@media (max-width: 1000px) {
    
    /* Skjul PC-ting */
    .desktop-only { display: none !important; }

    /* 1. LÅS OPP SCROLLING (Viktig fiks!) */
    body {
        overflow: auto !important;
        height: auto !important;
    }

    .main-content {
        overflow: visible !important;
        height: auto !important;
    }

    /* 2. Endre grid til blokk (dette fikser den ødelagte layouten du så) */
    .admin-wrapper {
        display: block; 
        position: relative;
        height: auto !important;
    }

    /* 3. Flytt sidebar UT av skjermen */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px; 
        width: 260px;
        height: 100%;
        transition: left 0.3s ease-in-out;
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
        z-index: 2000;
    }

    .sidebar.active { left: 0; }

    /* 4. Vis meny-knappen */
    .mobile-toggle-btn {
        display: block;
        background: transparent;
        border: none;
        color: var(--primary);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 5px 10px;
        margin-right: 10px;
    }

    /* 5. Innholdsjusteringer */
    .page-content { padding: 15px; }
    .top-bar { padding: 10px 15px; position: sticky; top: 0; z-index: 800; }
    .admin-wrapper-split { grid-template-columns: 1fr !important; }

    /* 6. Lister */
    .staff-card { flex-direction: column; text-align: center; }
    .staff-img { margin-right: 0; margin-bottom: 15px; }
    .staff-actions { width: 100%; margin-top: 15px; justify-content: center; }
    .partner-grid { grid-template-columns: 1fr 1fr; }
}