/* =========================================
   GLOBALE VARIABLER & RESET
========================================= */
:root { 
    --primary: #2c3e50;
    --secondary: #34495e;
    --accent: #e74c3c; 
    --bg: #f5f6fa;
    --text: #333; 
    --success: #2ecc71;
    --warning: #f1c40f;
    --info: #3498db;
    --border: #e1e8ed;
}

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

body {
    font-family: 'Open Sans', sans-serif;

    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* =========================================
   TYPOGRAFI & UTILITIES
========================================= */
h1, h2, h3, h4 { color: var(--primary); margin-bottom: 15px; }
a { color: var(--info); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--primary); }

.text-center { text-align: center; }
.text-muted { color: #7f8c8d; }
.text-muted-small { color: #7f8c8d; font-size: 0.85em; margin-bottom: 15px; display: block; }
.text-success-bold { color: var(--success); font-weight: bold; }
.text-danger-bold { color: var(--accent); font-weight: bold; }

.mt-15 { margin-top: 15px; }
.mb-15 { margin-bottom: 15px; }
.mb-30 { margin-bottom: 30px; }

/* =========================================
   KOMPONENTER
========================================= */
.card { 
    background: white; 
    padding: 25px; 
    border-radius: 6px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); 
    margin-bottom: 20px; 
}

.btn { 
    display: inline-block;
    background: var(--accent); 
    color: white; 
    border: none; 
    padding: 10px 18px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold; 
    text-align: center;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; color: white; }
.btn-blue { background: var(--info); }
.btn-dark { background: var(--primary); }
.btn-success { background: var(--success); }
.btn-block { display: block; width: 100%; }
.btn-large { padding: 12px 25px; font-size: 1.1em; }

.badge {
    color: white; 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 0.8em; 
    font-weight: bold;
    display: inline-block;
}
.badge-id { background: var(--info); float: right; }
.badge-event { background: var(--accent); text-transform: uppercase; }
.badge-news { background: var(--info); text-transform: uppercase; }
.bg-orange { background: #e67e22; }
.bg-red { background: var(--accent); }
.bg-grey { background: #95a5a6; }

/* =========================================
   SKJEMAER & TABELLER
========================================= */
input, select, textarea { 
    width: 100%; 
    padding: 10px; 
    margin: 8px 0 15px 0; 
    border: 1px solid #ccc; 
    border-radius: 4px; 

}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 15px; 
    background: white;
}
th, td { 
    padding: 12px; 
    border-bottom: 1px solid #ddd; 
    text-align: left; 
}
th { background: #f8f9fa; color: var(--primary); }

/* =========================================
   VARSLINGER (FLASH MESSAGES)
========================================= */
.flash-container { margin-bottom: 20px; }
.flash { 
    padding: 15px; 
    margin-bottom: 10px; 
    border-radius: 4px; 
    color: white; 
    font-weight: bold; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.flash.success { background: var(--success); }
.flash.warning { background: var(--warning); color: var(--primary); }
.flash.danger { background: var(--accent); }
.flash-close { cursor: pointer; font-size: 1.2em; opacity: 0.7; }
.flash-close:hover { opacity: 1; }

/* =========================================
   ADMINISTRASJON (STYRET) LAYOUT
========================================= */
.admin-body { display: flex; min-height: 100vh; }
.sidebar { 
    width: 260px; 
    background: var(--primary); 
    color: white; 
    padding: 20px 10px; 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0;
}
.sidebar h2 { color: var(--info); text-align: center; }
.domain-badge { 
    text-align: center; font-size: 0.75em; color: var(--success); 
    margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); 
}
.sidebar-category { font-size: 0.75em; color: #95a5a6; text-transform: uppercase; margin: 15px 0 5px 15px; font-weight: bold; }
.sidebar a { 
    color: #ecf0f1; padding: 10px 15px; margin-bottom: 2px; 
    border-radius: 4px; display: block; font-size: 0.95em; 
}
.sidebar a:hover { background: var(--secondary); padding-left: 20px; color: white; }
.admin-main { flex: 1; padding: 30px; overflow-y: auto; width: calc(100% - 260px); }

/* =========================================
   MEDLEMSPORTAL (KLUBBEN) LAYOUT
========================================= */
.member-body { background: #fff;  }
.top-nav { border-bottom: 3px solid var(--accent); background: #fff; padding: 20px 0; margin-bottom: 30px; }
.nav-container { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 0 20px; }
.logo-placeholder { font-size: 2.5em; font-weight: 900; color: var(--primary); text-transform: uppercase; letter-spacing: -1px; }
.logo-img { max-height: 80px; width: auto; object-fit: contain; }
.menu-links a {  font-weight: bold; margin: 0 15px; text-transform: uppercase; color: #333; }
.menu-links a:hover { color: var(--accent); }
.member-main { max-width: 1200px; margin: 0 auto; padding: 0 20px 50px 20px; }

/* =========================================
   DASHBOARD (INDEX)
========================================= */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.dashboard-card-wide { grid-column: 1 / -1; }
.border-top-blue { border-top: 4px solid var(--info); }
.border-top-red { border-top: 4px solid var(--accent); }
.border-top-purple { border-top: 4px solid #9b59b6; }
.border-top-green { border-top: 4px solid var(--success); }

.horizontal-scroll-container { display: flex; overflow-x: auto; gap: 15px; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.horizontal-scroll-item { flex: 0 0 320px; scroll-snap-align: start; background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; }
.mote-tittel { font-size: 1.2em; padding-right: 45px; margin-bottom: 10px; }
.rsvp-box { background: white; padding: 10px; border-radius: 6px; border: 1px solid #eee; }
.rsvp-row { display: flex; justify-content: space-between; margin-bottom: 5px; }
.rsvp-footer { font-size: 0.8em; color: #95a5a6; text-align: center; border-top: 1px dashed #ddd; padding-top: 5px; margin-top: 5px; }
.rsvp-none { background: white; padding: 10px; border-radius: 6px; border: 1px solid #eee; text-align: center; color: #95a5a6; }

.dashboard-list { list-style: none; }
.dashboard-list li { padding: 10px; border-bottom: 1px solid #eee; }
.fravaer-item { display: flex; justify-content: space-between; align-items: center; background: #fdfdfd; border-radius: 4px; }

/* =========================================
   ARTIKKEL / INNLEGG
========================================= */
.article-container { max-width: 800px; margin: 0 auto; background: white; padding: 40px; border-top: 5px solid var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,0.05); border-radius: 6px; }
.article-header { margin-bottom: 30px; border-bottom: 1px solid #eee; padding-bottom: 20px; }
.article-title { font-size: 2.8em; line-height: 1.2; margin: 15px 0; color: #111; }
.article-image-wrapper { margin-bottom: 30px; text-align: center; }
.article-image { max-width: 100%; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.article-body { font-size: 1.15em; line-height: 1.8; color: #333; margin-bottom: 40px; white-space: pre-wrap;  }
.attachment-box { background: #f8f9fa; padding: 20px; border-radius: 4px; border-left: 4px solid var(--info); margin-bottom: 40px;  }
.attachment-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.article-footer { border-top: 2px solid #111; padding-top: 30px; text-align: center;  }

/* =========================================
   RESPONSIVT DESIGN (MOBIL)
========================================= */
@media (max-width: 768px) {
    /* Gjør admin-panelet stablet */
    .admin-body { flex-direction: column; }
    
    /* Flytt og style menyen for mobil */
    .sidebar { 
        width: 100%; 
        height: auto;
        padding: 15px 10px;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }
    
    .sidebar h2 { width: 100%; margin-bottom: 5px; }
    .domain-badge { width: 100%; border-bottom: none; margin-bottom: 5px; padding-bottom: 0; }
    .sidebar-category { width: 100%; text-align: center; margin: 10px 0 5px 0; padding: 0; }
    
    .sidebar a {
        flex: 1 1 calc(50% - 10px); /* Gjør lenkene til knapper i et rutenett */
        margin: 2px 5px;
        text-align: center;
        padding: 10px;
        background: rgba(255,255,255,0.1);
    }
    
    /* Sørg for at hovedinnholdet ikke flyter ut av skjermen */
    .admin-main { 
        width: 100%; 
        padding: 15px; 
        overflow-x: hidden; 
    }
    
    /* Fiks dashbordet og artikler for små skjermer */
    .dashboard-grid { grid-template-columns: 1fr; }
    .article-container { padding: 20px; border-radius: 0; }
    .article-title { font-size: 2em; }
    .horizontal-scroll-item { flex: 0 0 280px; }
}

/* --- INNBOKS & KOMMUNIKASJON STILER --- */

.comm-container { max-width: 1000px; margin: 2rem auto; padding: 0 1rem; }
.comm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.comm-header h1 { margin: 0; color: #2d3748; }

/* Kort og bokser */
.comm-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow: hidden; margin-bottom: 2rem; padding: 1.5rem; }
.comm-card-nopad { padding: 0; } /* For innboks-listen */

/* Knapper */
.btn-primary-blue { background: #3182ce; color: #fff; padding: 0.6rem 1.2rem; text-decoration: none; border-radius: 4px; display: inline-flex; align-items: center; gap: 0.5rem; font-weight: bold; transition: background 0.2s; }
.btn-primary-blue:hover { background: #2b6cb0; }
.btn-primary-blue svg { width: 20px; height: 20px; }

.btn-secondary { background: #f0f4f8; color: #3182ce; padding: 0.6rem 1.2rem; border-radius: 4px; text-decoration: none; border: 1px solid #e2e8f0; transition: background 0.2s; font-weight: bold;}
.btn-secondary:hover { background: #e2e8f0; }

.btn-send { background: #38a169; color: #fff; padding: 0.8rem 2rem; border: none; border-radius: 4px; font-weight: bold; cursor: pointer; transition: background 0.2s; font-size: 1.1rem; }
.btn-send:hover { background: #2f855a; }

.btn-delete { background: transparent; border: none; color: #e53e3e; cursor: pointer; padding: 0.5rem; border-radius: 4px; transition: 0.2s; }
.btn-delete:hover { background: #fff5f5; color: #c53030; }
.btn-delete svg { width: 22px; height: 22px; }

/* Skjema for SMS */
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; color: #4a5568; }
.form-control { width: 100%; padding: 0.75rem; border: 1px solid #cbd5e0; border-radius: 4px;  font-size: 1rem; box-sizing: border-box; }
.form-control:focus { outline: none; border-color: #3182ce; box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1); }
.form-help { font-size: 0.85rem; color: #718096; margin-top: 0.4rem; }

/* Innboks-listen */
.message-list { list-style: none; padding: 0; margin: 0; }
.message-item { padding: 1.5rem; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; gap: 1rem; transition: background 0.2s; }
.message-item:last-child { border-bottom: none; }
.message-item:hover { background: #f8fafc; }
.message-content { flex-grow: 1; }
.message-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.message-meta h3 { margin: 0; font-size: 1.1rem; color: #2d3748; }
.message-phone { color: #718096; font-size: 0.9rem; font-weight: normal; }
.message-date { font-size: 0.8rem; background: #edf2f7; padding: 0.2rem 0.5rem; border-radius: 4px; color: #4a5568; margin-left: auto; border: 1px solid #e2e8f0; }
.message-text { margin: 0; color: #4a5568; white-space: pre-line; line-height: 1.5; }

/* Historikk Tabell */
.history-table { width: 100%; border-collapse: collapse; text-align: left; }
.history-table th { padding: 0.75rem 1rem; background: #f7fafc; border-bottom: 1px solid #e2e8f0; color: #4a5568; text-transform: uppercase; font-size: 0.8rem; }
.history-table td { padding: 1rem; border-bottom: 1px solid #e2e8f0; color: #4a5568; font-size: 0.95rem; }
.history-table tr:hover { background: #f8fafc; }

/* Statuser */
.status-badge { padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; font-weight: bold; display: inline-block; }
.status-success { background: #c6f6d5; color: #22543d; }
.status-error { background: #fed7d7; color: #822727; cursor: help; }

/* Tom tilstand (når innboks/historikk er tom) */
.empty-state { padding: 4rem 2rem; text-align: center; color: #718096; }
.empty-state svg { width: 60px; height: 60px; margin: 0 auto 1rem auto; color: #cbd5e0; }
.empty-state h3 { font-size: 1.2rem; color: #4a5568; margin-bottom: 0.5rem; }
/* --- BASE.HTML STYLES --- */
:root { --primary: #2c3e50; --secondary: #34495e; --accent: #e74c3c; --bg: #f5f6fa; --text: #333; }
* { box-sizing: border-box; margin: 0; padding: 0; }

.card { background: white; padding: 25px; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 20px;  }
.btn { background: var(--accent); color: white; border: none; padding: 10px 18px; border-radius: 4px; cursor: pointer; font-weight: bold;  }
.btn:hover { opacity: 0.9; }
table { width: 100%; border-collapse: collapse; margin-top: 15px;  }
th, td { padding: 12px; border-bottom: 1px solid #ddd; text-align: left; }
th { background: #f8f9fa; }
input, select, textarea { width: 100%; padding: 10px; margin: 8px 0; border: 1px solid #ccc; border-radius: 4px;  }
.flash { padding: 12px; margin-bottom: 20px; border-radius: 4px; color: white; font-weight: bold;  }
.flash.success { background: #2ecc71; }
.flash.warning { background: #f1c40f; color: #2c3e50; }
.flash.danger { background: #e74c3c; }

.admin-body { display: flex; background: var(--bg); color: var(--text); min-height: 100vh;  }
.sidebar { width: 260px; background: var(--primary); color: white; padding: 20px 10px; display: flex; flex-direction: column; overflow-y: auto; }
.sidebar h2 { margin-bottom: 5px; font-size: 1.4em; text-align: center; color: #3498db; }
.domain-badge { text-align: center; font-size: 0.7em; color: #2ecc71; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-category { font-size: 0.75em; color: #95a5a6; text-transform: uppercase; letter-spacing: 1px; margin: 15px 0 5px 15px; font-weight: bold; }
.sidebar a { color: #ecf0f1; text-decoration: none; padding: 10px 15px; margin-bottom: 2px; border-radius: 4px; display: block; transition: 0.2s; font-size: 0.95em; }
.sidebar a:hover { background: var(--secondary); padding-left: 20px; color: white; }
.admin-main { flex: 1; padding: 30px; overflow-y: auto; }

.member-body { display: block; background: #fff; color: #111;  }
.top-nav { border-bottom: 3px solid var(--accent); background: #fff; padding: 20px 0; margin-bottom: 30px; }
.nav-container { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 0 20px; }
.logo-placeholder { font-size: 2.5em; font-weight: 900;  color: var(--primary); text-transform: uppercase; letter-spacing: -1px; text-align: center; }
.menu-links a { color: #333; text-decoration: none;  font-weight: bold; font-size: 1em; margin: 0 15px; text-transform: uppercase; transition: color 0.2s; }
.menu-links a:hover { color: var(--accent); }
.member-main { max-width: 1200px; margin: 0 auto; padding: 0 20px 50px 20px; }

/* --- MEDLEM_PORTAL.HTML STYLES --- */
.portal-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; align-items: start; }
.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.featured-article { grid-column: 1 / -1; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #eee; }

@media (max-width: 850px) {
    .portal-grid { grid-template-columns: 1fr; gap: 20px; }
    .news-grid { grid-template-columns: 1fr; }
}

/* --- INNLEGG.HTML STYLES --- */
.article-container { max-width: 800px; margin: 0 auto; background: white; padding: 40px; border-top: 5px solid #e74c3c; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border-radius: 6px; }
.article-title { font-size: 2.8em; line-height: 1.2; margin: 15px 0; color: #111; }

@media (max-width: 600px) {
    .article-container { padding: 20px; border-radius: 0; }
    .article-title { font-size: 2em; }
}

/* --- KOSTNAD.HTML STYLES --- */
.settings-section { background: white; padding: 20px; border-radius: 8px; margin-bottom: 30px; border-top: 5px solid #e67e22; }
.grid-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.calculator-card { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.result-box { margin-top: 20px; padding: 15px; background: #f8f9fa; border-radius: 6px; }
.result-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
.result-row.total { font-weight: bold; border-top: 1px solid #ddd; padding-top: 10px; margin-top: 10px; color: #c0392b; font-size: 1.1rem; }
.result-row.sub-total { font-weight: bold; margin-top: 10px; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 0.9rem; }

/* =========================================
   DASHBOARD & CARDS (REFACTORED)
========================================= */
.dashboard-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.card-primary {
    border-top: 4px solid var(--info);
}

.card-danger {
    border-top: 4px solid var(--accent);
}

.card-warning {
    border-top: 4px solid #9b59b6;
}

.card-success {
    border-top: 4px solid var(--success);
}

.portal-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
    color: #111;
}

.news-article-card {
    margin-bottom: 20px;
    padding: 15px;
    background: #fafafa;
    border-radius: 6px;
}

/* SIKKERHETS-BADGES */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    display: inline-block;
    color: white;
}
.badge-offentlig { background-color: #2ecc71; } /* Grønn */
.badge-medlem { background-color: #3498db; } /* Blå */
.badge-styret { background-color: #9b59b6; } /* Lilla */
.badge-au { background-color: #e74c3c; } /* Rød/Oransje */

.workspace-switcher a {
    text-decoration: none;
    font-size: 0.85em;
    border-radius: 3px;
    transition: background 0.2s;
}
