/* =======================================================
   HARAGARN 5 – GLOBAL DARK THEME
   Author: J. Andreas Lindqvist
   Created: 2025-11-09
   Version: 2.0 (optimized & unified)
   Updated: 2025-11-20
========================================================== */

/* =======================================================
   🎨 FARGER OG VARIABLER
========================================================== */
:root {
    --bg-dark: #1e1e2f;
    --bg-card: #2f2f43;
    --bg-hover: #3b3b50;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-purple: #8e44ad;
    --accent-purple-light: #9b59b6;
    --accent-green: #27ae60;
    --accent-blue: #3498db;
    --accent-red: #e74c3c;
    --accent-yellow: #f1c40f;
    --border-radius: 12px;
    --shadow: 0 0 25px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease-in-out;
}



/* =======================================================
   🧩 GRUNNLEGGENDE STRUKTUR
========================================================== */
html, body {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: radial-gradient(circle at top, var(--bg-dark) 0%, #141422 100%);
    color: var(--text-primary);
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 36px 0 0 0;
    box-shadow: 2px 0 18px rgba(142,68,173,0.08);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-title {
    color: var(--accent-purple);
    margin-bottom: 34px;
    text-align: center;
    font-size: 1.7em;
    font-weight: bold;
    letter-spacing: 1px;
}

.sidebar-section {
    margin-bottom: 38px;
}

.sidebar-section-title {
    color: var(--accent-purple-light);
    margin-bottom: 8px;
    margin-left: 18px;
    font-size: 1.13em;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    text-align: left;
}

.sidebar h2 {
    color: var(--accent-purple);
    margin-bottom: 25px;
    text-align: center;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.25s ease-in-out;
    font-size: 1.05em;
    font-weight: 500;
}

.sidebar a:hover {
    color: var(--accent-purple-light);
    background: linear-gradient(90deg, rgba(142,68,173,0.32), rgba(142,68,173,0.12));
    box-shadow: 0 0 10px rgba(142,68,173,0.18);
    transform: translateX(3px);
}

.sidebar a.active {
    color: var(--accent-purple-light);
    background: linear-gradient(90deg, rgba(142,68,173,0.45), rgba(142,68,173,0.18));
    font-weight: bold;
    border-left: 5px solid var(--accent-purple);
    padding-left: 20px;
}

.sidebar-section:not(:last-child) {
    border-bottom: 1px solid rgba(142,68,173,0.10);
    padding-bottom: 10px;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: 20px;
    font-size: 1em;
    color: var(--text-secondary);
}
.sidebar-footer a {
    display: block;
    margin-top: 14px;
    color: var(--accent-red);
    font-weight: 600;
}
.sidebar-footer a:hover { color: #ff7675; }

/* Hovedinnhold */
.main-content {
    flex: 1;
    box-sizing: border-box;
    padding: 0;
    height: 100vh;
    background: radial-gradient(circle at top, #2b2b3d 0%, #1e1e2f 100%);
    color: var(--text-primary);
    display: block;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* Responsiv layout */
@media (max-width: 900px) {
    html, body {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        flex-shrink: 0;
        flex-direction: row;
        justify-content: space-around;
        padding: 12px 0;
        overflow-y: visible;
        overflow-x: auto;
    }
    
    .main-content {
        flex: 1;
        width: 100%;
        height: auto;
        padding: 12px 0;
    }
}



/* =======================================================
   🧾 INPUTS, KNAPPER & INTERAKSJON
========================================================== */
input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background-color: var(--bg-hover);
    color: var(--text-primary);
    margin-bottom: 10px;
    outline: none;
    transition: all 0.25s ease-in-out;
}
input::placeholder { color: #888; }
input:hover, select:hover {
    background-color: #3f3f56;
    box-shadow: 0 0 4px rgba(142, 68, 173, 0.5);
}
input:focus, select:focus {
    background-color: #4b4b63;
    box-shadow: 0 0 6px rgba(142, 68, 173, 0.7);
    border: 1px solid var(--accent-purple-light);
}

button {
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    color: white;
}
button.primary { background-color: var(--accent-purple); }
button.primary:hover { background-color: var(--accent-purple-light); }
button.success { background-color: var(--accent-green); }
button.success:hover { background-color: #2ecc71; }
button.danger { background-color: var(--accent-red); }
button.danger:hover { background-color: #ff6b6b; }



/* =======================================================
   💰 FELLESUTGIFTER / OPPGJØR
========================================================== */
.settlement-box {
    background: linear-gradient(145deg, #2f2f43, #262638);
    border-radius: 16px;
    box-shadow: 0 0 25px rgba(0,0,0,0.25);
    padding: 20px 25px;
    margin: 0 0 30px 0;
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    overflow-x: auto;
}

.settlement-box h2 {
    color: var(--accent-yellow);
    margin-bottom: 15px;
    text-align: center;
}

.settlement-user-block {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    position: relative;
    margin-bottom: 25px;
}

.settlement-msg { font-size: 1.05em; font-weight: 600; margin: 6px 0; }
.settlement-positive { color: var(--accent-green); }
.settlement-neutral { color: var(--accent-yellow); }
.small-muted { color: #9ca3af; font-size: 0.9em; }

/* Under-tabell for kontoer */
.settlement-subtable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    overflow: hidden;
}
.settlement-subtable th,
.settlement-subtable td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: left;
    font-size: 0.95em;
}
.settlement-subtable th {
    background-color: rgba(255,255,255,0.06);
    color: var(--accent-yellow);
}
.settlement-subtable tr:hover { background-color: rgba(255,255,255,0.04); }



/* =======================================================
   📋 TABELLER – FELLES & ÅPNE POSTER
========================================================== */

/* Wrapper – sentrerer tabellen */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 0 40px 0;
    padding: 0;
    box-sizing: border-box;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    padding-bottom: 10px;
    position: relative;
}

/* Tabelloppsett */
.table-container table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    color: #e6edf3;
    background: #1d1f2b;
    border-radius: 10px;
}

/* Kolonner og header */
.table-container th,
.table-container td {
    padding: 7px 6px;
    text-align: left;
    white-space: nowrap;
    font-size: 0.8em;
}

/* Checkbox kolonne */
.table-container th:first-child,
.table-container td:first-child {
    width: 36px;
    padding: 6px 0;
    text-align: center;
    line-height: 1.4;
}

/* DataTables select-checkbox - simplest approach */
table.dataTable tbody td.select-checkbox {
    padding: 6px 0 !important;
    text-align: center;
    vertical-align: middle;
}

table.dataTable tbody td.select-checkbox input {
    margin: 0;
    vertical-align: middle;
}


/* Transaksjonsdato (kolonne 2) */
.table-container th:nth-child(2),
.table-container td:nth-child(2) {
    min-width: 80px;
}

/* Forfallsdato (kolonne 3) */
.table-container th:nth-child(3),
.table-container td:nth-child(3) {
    min-width: 80px;
}

/* Konto (kolonne 4) */
.table-container th:nth-child(4),
.table-container td:nth-child(4) {
    min-width: 130px;
}

/* NOK Total (kolonne 5) */
.table-container th:nth-child(5),
.table-container td:nth-child(5) {
    min-width: 70px;
}

/* NOK/Person (kolonne 6) */
.table-container th:nth-child(6),
.table-container td:nth-child(6) {
    min-width: 70px;
}

/* Utgiftspost (kolonne 7) - kan skjules */
.table-container th:nth-child(7),
.table-container td:nth-child(7) {
    max-width: 80px;
}

/* Transaksjonssted (kolonne 8) - kan skjules */
.table-container th:nth-child(8),
.table-container td:nth-child(8) {
    max-width: 80px;
}

/* Beskrivelse (kolonne 9) - kan skjules */
.table-container th:nth-child(9),
.table-container td:nth-child(9) {
    max-width: 100px;
}

/* Mottaker Konto # (kolonne 10) - kan skjules */
.table-container th:nth-child(10),
.table-container td:nth-child(10) {
    max-width: 80px;
}

/* Mottaker (kolonne 11) - VIKTIG, alltid synlig */
.table-container th:nth-child(11),
.table-container td:nth-child(11) {
    min-width: 110px;
}

/* Status (kolonne 12) - VIKTIG, alltid synlig */
.table-container th:nth-child(12),
.table-container td:nth-child(12) {
    min-width: 80px;
}

.table-container th {
    background: #272a3b;
    color: var(--accent-yellow);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Responsiv kolonn-visibility - prioriter Mottaker */
@media screen and (max-width: 1800px) {
    .table-container tbody td:nth-child(8),
    .table-container thead th:nth-child(8) {
        display: none;
    }
}

@media screen and (max-width: 1600px) {
    .table-container tbody td:nth-child(9),
    .table-container thead th:nth-child(9) {
        display: none;
    }
    .table-container td:nth-child(11),
    .table-container th:nth-child(11) {
        min-width: 120px;
    }
}

@media screen and (max-width: 1400px) {
    .table-container tbody td:nth-child(10),
    .table-container thead th:nth-child(10) {
        display: none;
    }
    .table-container td:nth-child(11),
    .table-container th:nth-child(11) {
        min-width: 130px;
    }
}

@media screen and (max-width: 1200px) {
    .table-container tbody td:nth-child(7),
    .table-container thead th:nth-child(7) {
        display: none;
    }
}

/* Make Status and Mottaker columns sticky on right */
.table-container th:last-child,
.table-container td:last-child {
    position: sticky;
    right: 0;
    background: #272a3b;
    z-index: 3;
    box-shadow: -2px 0 6px rgba(0, 0, 0, 0.3);
}
.table-container tr:nth-child(even) td:last-child { background: #232537; }
.table-container tr:hover td:last-child { background: #2f3248; }

/* Scrollbar visuelt hint (gradient på høyre side) */
.table-container::after {
    display: none;
}

/* Statusfarger */
.status-paid { color: var(--accent-green); font-weight: bold; }
.status-unpaid { color: var(--accent-red); font-weight: bold; }



/* =======================================================
   🧾 TRANSAKSJONSADMINISTRASJON (DataTables)
========================================================== */

/* DataTables wrapper – behold mørkt tema */
.dataTables_wrapper {
    color: var(--text-primary);
    background: transparent;
}
.dataTables_filter label,
.dataTables_length label {
    color: var(--accent-yellow);
}
.dataTables_filter input,
.dataTables_length select {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--accent-purple);
    border-radius: 6px;
    padding: 4px 8px;
}

/* Markeringsboks (checkbox) */
table.dataTable td.select-checkbox {
    padding: 3px 0 !important;
    text-align: center;
}

/* Skjul DataTables sitt ::before pseudo-element */
table.dataTable td.select-checkbox::before {
    display: none !important;
    content: none !important;
}

table.dataTable td.select-checkbox input[type="checkbox"] {
    margin: 0 !important;
    width: 16px !important;
    height: 16px !important;
    vertical-align: middle;
    cursor: pointer;
    accent-color: var(--accent-green);
    display: inline-block;
}


/* Valgte rader */
table.dataTable.display tbody tr.selected {
    background-color: rgba(142, 68, 173, 0.25);
}

/* Datatables-knapper */
button.dt-button {
    background-color: var(--accent-purple);
    color: white !important;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 6px;
}
button.dt-button:hover {
    background-color: var(--accent-purple-light);
}

/* Kolonnefilter-felter i header */
thead input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.85em;
}

/* Quick-Add Form */
.quick-add-form {
    background: linear-gradient(135deg, rgba(142,68,173,0.1), rgba(52,152,219,0.05));
    border: 1px solid rgba(142,68,173,0.3);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
    box-sizing: border-box;
}

.quick-add-form h3 {
    color: var(--accent-purple-light);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.quick-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.quick-add-grid input,
.quick-add-grid select {
    background: var(--bg-hover);
    border: 1px solid rgba(142,68,173,0.3);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.quick-add-grid input:focus,
.quick-add-grid select:focus {
    background: var(--bg-dark);
    border-color: var(--accent-purple);
    box-shadow: 0 0 6px rgba(142,68,173,0.4);
    outline: none;
}

.quick-add-grid input::placeholder {
    color: #888;
}

.quick-add-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.quick-add-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.quick-add-actions button.add-btn {
    background: linear-gradient(135deg, var(--accent-green), #2ecc71);
}

.quick-add-actions button.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39,174,96,0.3);
}

.quick-add-actions button.clear-btn {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.quick-add-actions button.clear-btn:hover {
    background: rgba(255,255,255,0.1);
}



/* =======================================================
   👥 BRUKERADMINISTRASJON (Users Page)
========================================================== */

.container table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 40px;
}

.container table th,
.container table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: normal;
    word-break: break-word;
}

.container table th {
    background: rgba(142,68,173,0.2);
    color: var(--accent-purple-light);
    font-weight: 600;
}

.container table tr:hover {
    background: rgba(142,68,173,0.08);
}

.container table input[type="text"],
.container table input[type="password"],
.container table select {
    width: 100%;
    max-width: 120px;
    background: var(--bg-hover);
    border: 1px solid rgba(142,68,173,0.3);
    color: var(--text-primary);
    padding: 6px;
    border-radius: 4px;
    font-size: 0.85em;
    box-sizing: border-box;
}

.container table input[type="text"]:focus,
.container table input[type="password"]:focus,
.container table select:focus {
    background: var(--bg-dark);
    border-color: var(--accent-purple);
    outline: none;
}

.container table button {
    padding: 6px 10px;
    font-size: 0.85em;
    margin-right: 5px;
}

.container table button.info {
    background: var(--accent-blue);
}

.container table button.info:hover {
    background: #f39c12;
}

/* Add Form */
.add-form {
    background: linear-gradient(135deg, rgba(39,174,96,0.1), rgba(52,152,219,0.05));
    border: 1px solid rgba(39,174,96,0.3);
    border-radius: 10px;
    padding: 20px;
    box-sizing: border-box;
}

.add-form h3 {
    color: var(--accent-green);
    margin-top: 0;
    margin-bottom: 15px;
}

.add-form form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.add-form input,
.add-form select {
    background: var(--bg-hover);
    border: 1px solid rgba(39,174,96,0.3);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9em;
}

.add-form input:focus,
.add-form select:focus {
    background: var(--bg-dark);
    border-color: var(--accent-green);
    outline: none;
}

.add-form button {
    background: var(--accent-green);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-form button:hover {
    background: #2ecc71;
    transform: translateY(-2px);
}

/* Scrollbar-tilpasning for store tabeller */
.table-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-top: 25px;
}

/* Bedre oversikt for bred tabell */
#transactionsTable {
    width: auto !important;      /* lar tabellen strekke seg etter innhold */
    min-width: 100%;             /* men aldri smalere enn containeren */
    max-width: none !important;  /* fjerner fast grense */
    border-collapse: collapse;
}
.table-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-top: 25px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    padding-bottom: 10px;
}
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Statusfarger (brukes allerede, men repeteres for sikkerhet) */
.status-paid { color: var(--accent-green); font-weight: bold; }
.status-unpaid { color: var(--accent-red); font-weight: bold; }



/* =======================================================
   🧾 SCROLLBAR OG HOVEREFFEKTER
========================================================== */
.table-container {
    scrollbar-color: #6c3483 #1a1a28;
    scrollbar-width: thin;
}
tr:hover td {
    background-color: rgba(255,255,255,0.04);
    transition: background-color 0.2s ease;
}



/* DataTables-knapper i Haragarn-stil */
.dt-buttons {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
button.dt-button {
    background: var(--accent-purple);
    color: #fff !important;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    transition: var(--transition);
}
button.dt-button:hover {
    background: var(--accent-purple-light);
    transform: translateY(-1px);
}
/* =======================================================
   🧾 TRANSAKSJONSADMINISTRASJON – RESPONS OG AUTOBREDDE
========================================================== */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 10px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    padding-bottom: 10px;
    position: relative;
}

/* La tabellen tilpasse seg innholdet dynamisk */
#transactionsTable {
    width: auto !important;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto !important;
    white-space: nowrap;
}

/* Sikre at hver kolonne får minimum bredde for tekst */
#transactionsTable th, #transactionsTable td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

/* La scrollbar komme fram ved behov */
.table-container::-webkit-scrollbar { height: 10px; }
.table-container::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 6px;
}
.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple-light);
}
#transactionsTable td:nth-child(9),
#transactionsTable td:nth-child(7) {
    white-space: normal;
    max-width: 250px;
    word-break: break-word;
}

/* =======================================================
   🧾 DATATABLES – TOPPSEKSJON (Knapper, filter, pager)
========================================================== */

.dataTables_wrapper .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background: rgba(47,47,67,0.6);
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 15px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.2);
}

/* Knapperad */
.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Knapper */
button.dt-button {
    background-color: var(--accent-purple);
    color: white !important;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 0 8px rgba(142,68,173,0.3);
}
button.dt-button:hover {
    background-color: var(--accent-purple-light);
    transform: translateY(-1px);
}

/* “Vis X rader” + Søkefelt til høyre */
.dataTables_length,
.dataTables_filter {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-yellow);
}
.dataTables_filter input {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--accent-purple);
    border-radius: 6px;
    padding: 4px 8px;
}
.dataTables_length select {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--accent-purple);
    border-radius: 6px;
    padding: 3px 6px;
}

/* Responsiv: bryt på små skjermer */
@media (max-width: 900px) {
    .dataTables_wrapper .top {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}



/* =======================================================
   💬 MODAL POPUP
========================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10,10,20,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    width: 450px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    color: var(--text-primary);
    border: 1px solid rgba(142,68,173,0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: var(--accent-purple-light);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
    font-weight: 600;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-content label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
    margin-bottom: 4px;
    display: block;
}

.modal-content input[type="text"],
.modal-content input[type="date"],
.modal-content input[type="number"],
.modal-content select {
    background: var(--bg-hover);
    border: 1px solid rgba(142,68,173,0.3);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="date"]:focus,
.modal-content input[type="number"]:focus,
.modal-content select:focus {
    background: var(--bg-dark);
    border-color: var(--accent-purple);
    box-shadow: 0 0 8px rgba(142,68,173,0.4);
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 25px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-actions button.primary {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light));
    color: white;
}

.modal-actions button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(142,68,173,0.4);
}

.modal-actions button.danger {
    background: var(--accent-red);
    color: white;
}

.modal-actions button.danger:hover {
    background: #ff6b6b;
}



/* =======================================================
   LOGIN PAGE STYLES (from index.html)
========================================================== */
body.login-page {
    background: radial-gradient(circle at top, #2b2b3d 0%, #1e1e2f 100%);
    height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
}

.main-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255,255,255,0.02);
    border-radius: 18px;
    box-shadow: 0 0 40px rgba(0,0,0,0.4);
    padding: 30px;
    gap: 60px;
}

.main-wrapper img {
    width: 520px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(0,0,0,0.3);
}

.login-card {
    background-color: #2f2f43;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 0 30px rgba(0,0,0,0.4);
    width: 360px;
    text-align: center;
}

.login-card h1 {
    margin-bottom: 10px;
    color: #8e44ad;
}

.login-card p {
    color: #aaa;
    margin-bottom: 30px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 90%;
    padding: 10px;
    margin-bottom: 15px;
    border: none;
    border-radius: 6px;
    background-color: #3b3b50;
    color: #fff;
    outline: none;
}

.login-card input::placeholder {
    color: #aaa;
}

.login-card button {
    width: 95%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background-color: #8e44ad;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

.login-card button:hover {
    background-color: #9b59b6;
}

.footer-text {
    margin-top: 20px;
    color: #777;
    font-size: 0.9em;
}

.footer-text a {
    color: #8e44ad;
    text-decoration: none;
}

.footer-text a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .main-wrapper {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    .main-wrapper img {
        width: 100%;
        max-width: 400px;
    }
}

/* --- Dashboard frontpage --- */
.dashboard-wrapper {
    width: 100%;
    max-width: none;
    display: block;
    margin: 0;
    padding: 0;
}
.welcome-card {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 0 18px rgba(142,68,173,0.10);
    padding: 28px 38px;
    margin-bottom: 0;
}
.welcome-avatar {
    width: 70px;
    height: 70px;
    background: var(--accent-purple-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    color: #fff;
    box-shadow: 0 0 12px rgba(142,68,173,0.18);
}
.role-badge {
    background: var(--accent-purple-light);
    color: #fff;
    border-radius: 8px;
    padding: 2px 10px;
    font-size: 0.95em;
    font-weight: 600;
    margin-left: 6px;
}
.info-cards {
    display: flex;
    gap: 24px;
    margin-bottom: 0;
}
.info-card {
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: 0 0 12px rgba(142,68,173,0.08);
    padding: 18px 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 160px;
}
.info-card span {
    font-size: 2em;
    color: var(--accent-purple-light);
}
.info-title {
    color: var(--text-secondary);
    font-size: 1em;
    margin-bottom: 2px;
}
.info-value {
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: bold;
}
.quick-links {
    display: flex;
    gap: 18px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.quick-link {
    background: var(--bg-hover);
    color: var(--accent-purple-light);
    border-radius: 10px;
    padding: 14px 22px;
    font-size: 1.1em;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 0 8px rgba(142,68,173,0.10);
    transition: background 0.2s, color 0.2s;
}
.quick-link:hover {
    background: var(--accent-purple-light);
    color: #fff;
}

/* --- Dashboard toppbilde: kun én konsistent blokk --- */
.dashboard-image.center {
    width: 100%;
    margin: 0 0 32px 0;
    padding: 0;
    display: block;
}
.dashboard-image.center img {
    width: 100%;
    max-width: none;
    height: auto;
    border-radius: 22px;
    box-shadow: 0 0 32px rgba(0,0,0,0.18);
    object-fit: cover;
    display: block;
    margin: 0;
}
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 0 0 0;
    gap: 32px;
}
@media (max-width: 1200px) {
    .dashboard-image.center img {
        max-width: 98vw;
    }
    .dashboard-wrapper {
        padding: 12px 0 0 0;
    }
}

/* --- Enkel velkomst --- */
.welcome-simple {
    text-align: center;
    margin-bottom: 24px;
}
.dashboard-image.center {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 32px auto;
    max-width: 900px;
}
.dashboard-image.center img {
    width: 100%;
    max-width: 900px;
    height: auto;
    border-radius: 22px;
    box-shadow: 0 0 32px rgba(0,0,0,0.18);
}

@media (max-width: 900px) {
    .dashboard-wrapper {
        padding: 12px 0 0 0;
    }
    .info-cards {
        flex-direction: column;
        gap: 16px;
    }
}

/* --- Dashboard-bilde går helt ut til kantene --- */
.main-content {
    /* margin-left: 250px !important; */
    width: calc(100vw - 250px);
    box-sizing: border-box;
    padding: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, #2b2b3d 0%, #1e1e2f 100%);
    color: var(--text-primary);
    display: block;
}
.dashboard-image.center {
    width: 100%;
    margin: 0 0 32px 0;
    padding: 0;
    display: block;
}
.dashboard-image.center img {
    width: 100%;
    max-width: none;
    height: auto;
    border-radius: 22px;
    box-shadow: 0 0 32px rgba(0,0,0,0.18);
    object-fit: cover;
    display: block;
    margin: 0;
}
@media (max-width: 900px) {
    .main-content {
        margin-left: 0 !important;
        width: 100vw;
        padding: 12px 0 0 0;
    }
    .dashboard-image.center img {
        max-width: 98vw;
    }
}



/* =======================================================
   📊 DASHBOARD CARDS & CHARTS
========================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(142,68,173,0.15), rgba(52,152,219,0.15));
    border: 1px solid rgba(142,68,173,0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 30px rgba(142,68,173,0.4);
    border-color: rgba(142,68,173,0.5);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #f1c40f;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 5px;
}

.stat-detail {
    font-size: 0.85em;
    color: #888;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.chart-wrapper {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.chart-wrapper.full-width {
    grid-column: 1 / -1;
}

.chart-wrapper h2 {
    color: var(--accent-purple-light);
    margin: 0 0 15px 0;
    font-size: 1.1em;
    border-bottom: 2px solid rgba(142,68,173,0.3);
    padding-bottom: 10px;
}

.chart-wrapper canvas {
    max-height: 300px;
}

/* Settlement Table */
.settlement-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    overflow: hidden;
}

.settlement-table th {
    background: rgba(142,68,173,0.2);
    color: var(--accent-purple-light);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid rgba(142,68,173,0.3);
}

.settlement-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.settlement-table tr:hover {
    background: rgba(142,68,173,0.08);
}

.settlement-table tr:last-child td {
    border-bottom: none;
}

/* Container for content padding */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.container h1 {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.container > p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .stat-value {
        font-size: 1.5em;
    }
}

@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .chart-wrapper {
        padding: 12px;
    }
    
    .container {
        padding: 15px;
    }
}