/* ==================================================== */
/* LØNNSKALKULATOR.NO - HOVEDSTILARK                    */
/* ==================================================== */

:root {
    --bg-color: #f3f4f6; /* Rolig, lys grå/blå bakgrunn for hele siden */
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --border-color: #e5e7eb;
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --accent-bg: #ccfbf1;
    --danger: #dc2626;
    --radius: 10px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* --- HEADER & NAVIGASJON --- */
.top-header {
    background-color: var(--primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 15px 20px;
}

.top-logo {
    width: 32px;
    height: auto;
    border-radius: 6px;
}

.site-logo-link { 
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.main-nav {
    background-color: var(--primary-hover);
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
    opacity: 0.9;
}

.main-nav a:hover, .main-nav a.active {
    background-color: rgba(255,255,255,0.2);
    opacity: 1;
}

/* --- HOVEDOPPSETT --- */
.container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.2;
}

.page-title span {
    display: block;
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 8px;
}

/* --- KORT-LAYOUT (Card) --- */
.kalkulator-card, .card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 35px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
}

.calculator-layout {
    display: flex;
    gap: 40px;
}

.input-column { flex: 0 0 420px; }
.results-column { flex: 1; min-width: 0; }

.calc-row {
    display: flex;
    gap: 30px; 
    width: 100%;
    margin-bottom: 0px;
}
.calc-col { flex: 1; min-width: 0; }

/* --- ANNONSE --- */
.info-panel-wrapper {
    text-align: center;
    margin-bottom: 30px;
}
.info-panel-badge {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #666;
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.info-panel-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    display: block;
    margin: 0 auto;
}
.info-panel-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

/* --- SKJEMA OG INPUTS --- */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.full-width {
    flex: 1;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 15px; 
}

input[type="number"], input[type="text"], select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 15px;
    height: 48px;
    background-color: #faf9f7;
    transition: all 0.2s ease;
    font-family: inherit;
    color: var(--text-main);
}

input[type="number"]:focus, input[type="text"]:focus, select:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    outline: 0;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

#prosentTop {
    background-color: var(--accent-bg);
    border: 2px solid var(--primary);
    font-weight: bold;
    color: var(--primary-hover);
}

.input-with-icon { padding-left: 40px !important; }
.input-icon, .suffix-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 15px;
    pointer-events: none; 
}
.input-icon { left: 16px; }
.suffix-icon { left: 16px; display: none; }
.input-wrapper input:not(:placeholder-shown) + .suffix-icon { display: block; }

.result-input {
    background-color: var(--accent-bg) !important; 
    border: 2px solid var(--primary) !important; 
    color: var(--primary-hover) !important; 
    font-weight: bold;
}
.result-label { margin-top: 5px; color: var(--primary-hover); }
.calc-text { font-size: 13px; color: #888; margin-bottom: 10px; min-height: 1.2em; }
.calc-text.active-calculation { color: var(--primary); font-style: italic; }

/* Checkbox */
.checkbox-container { display: flex; align-items: center; gap: 10px; }
input[type="checkbox"] { width: 20px !important; height: 20px !important; cursor: pointer; accent-color: var(--primary); }
.checkbox-label { margin: 0 !important; cursor: pointer; }

/* Knapper */
button#resetBtn {
    background: var(--text-muted);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s ease;
}
button#resetBtn:hover { background: #374151; }

.card #resetBtn {
    width: 100%;
    background: #f3f4f6;
    color: var(--text-main);
    border: 1px solid #d1d5db;
    margin-bottom: 0;
}
.card #resetBtn:hover { background-color: #e5e7eb; }

/* --- RESULTATER (Lønnskalkulator) --- */
.results-container {
    background-color: #f9fafb;
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.calculation-info {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 600;
}

table { width: 100%; border-collapse: collapse; margin-bottom: 25px; }
table:last-of-type { margin-bottom: 0; }
th, td { padding: 10px 0; font-size: 15px; border-bottom: 1px solid var(--border-color); }
tr:last-child th, tr:last-child td { border-bottom: none; }
th { text-align: left; font-weight: normal; color: var(--text-muted); }
td { text-align: right; font-weight: 600; color: var(--text-main); }

#ferietrekkOversikt {
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}
#ferietrekkTitle { font-size: 14px; margin: 0 0 5px 0; }
#ferietrekkSubtext { font-size: 13px; color: #888; margin: 0 0 15px 0; }
.sum-row th, .sum-row td { font-weight: bold; border-top: 2px solid #ccc; border-bottom: none; }
.ferietrekk-amount { color: var(--danger); }
.gap-row td { border-bottom: none; }
.feriepenger-row th, .feriepenger-row td { font-weight: bold; color: #059669; border-top: 2px solid #ccc; }
.juni-row th, .juni-row td { font-weight: bold; background: #f9fafb; padding: 15px 10px; border-top: 2px solid var(--text-main); }
.juni-row th { border-radius: 6px 0 0 6px; }
.juni-row td { border-radius: 0 6px 6px 0; }
.feriepenger-disclaimer { font-size: 12px; color: #888; margin-top: 15px; font-style: italic; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- TOOLTIP --- */
.info-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; margin-left: 6px; font-size: 11px;
    font-weight: bold; color: white; background: var(--text-muted);
    border-radius: 50%; cursor: help; position: relative; vertical-align: middle;
}
.info-icon::after {
    content: attr(data-tooltip); position: absolute; bottom: 130%; left: 50%;
    transform: translateX(-50%); background: #1f2937; color: white;
    padding: 10px 14px; border-radius: 6px; font-size: 13px; font-weight: normal;
    white-space: normal; width: 240px; text-align: center; opacity: 0; visibility: hidden;
    transition: opacity 0.2s; pointer-events: none; z-index: 100; line-height: 1.4;
}
.info-icon::before {
    content: ''; position: absolute; bottom: 110%; left: 50%;
    transform: translateX(-50%); border: 6px solid transparent;
    border-top-color: #1f2937; opacity: 0; visibility: hidden; transition: opacity 0.2s;
}
.info-icon:hover::after, .info-icon:hover::before { opacity: 1; visibility: visible; }
.calc-disclaimer { font-size: 13px; color: var(--text-muted); background: #f9fafb; padding: 15px; border-radius: var(--radius); margin-top: 25px; }

/* --- FAQ SEKSJON --- */
.faq-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    border: 1px solid var(--border-color);
}
.faq-section h2 { font-size: 24px; color: var(--primary); margin-top: 0; margin-bottom: 30px; }
.faq-section h3 { font-size: 18px; color: var(--text-main); margin-top: 30px; margin-bottom: 10px; }
.faq-section h4 { font-size: 16px; color: var(--text-muted); margin-top: 20px; margin-bottom: 5px; }
.faq-section p, .faq-section ul { color: var(--text-muted); margin-bottom: 15px; }
.faq-example { font-style: italic; color: var(--text-muted); }
.faq-section ul { padding-left: 20px; }

.table-responsive { width: 100%; overflow-x: auto; margin-top: 20px; }
.faq-section table { width: 100%; max-width: 600px; border: 1px solid var(--border-color); border-radius: var(--radius); }
.faq-section th, .faq-section td { padding: 12px 15px; text-align: center; border-bottom: 1px solid var(--border-color); }
.faq-section th { background-color: #f9fafb; font-weight: 600; color: var(--text-main); }
.faq-section th:first-child, .faq-section td:first-child { text-align: left; }

/* --- FOOTER --- */
.site-footer {
    text-align: center; margin-top: 60px; padding: 30px 20px;
    font-size: 14px; color: var(--text-muted); border-top: 1px solid #d1d5db;
}
.site-footer a { color: var(--text-muted); text-decoration: none; margin: 0 10px; font-weight: 500; }
.site-footer a:hover { color: var(--primary); }

/* --- STICKY SIDEBARS --- */
.sidebar-panel {
    position: fixed;
    top: 170px;
    z-index: 50;
    text-align: center;
    display: none;
}

.sidebar-panel.sidebar-right {
    right: calc((100vw - 900px) / 2 - 190px);
}

.sidebar-panel.sidebar-left {
    left: max(0px, calc((100vw - 900px) / 2 - 330px));
}

.sidebar-panel-badge {
    font-size: 12px;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sidebar-panel img {
    border-radius: 8px;
    display: block;
}

.sidebar-panel-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
    max-width: 300px;
    font-style: italic;
}

@media (min-width: 1300px) {
    .sidebar-panel.sidebar-right { display: block; }
}

@media (min-width: 1470px) {
    .sidebar-panel.sidebar-left { display: block; }
    .info-panel-wrapper { display: none; }
}

/* --- SNARVEISMENY (Prosentkalkulator) --- */
.kalk-meny-container { position: relative; max-width: 600px; margin: 0 auto 40px auto; }
.kalk-meny { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kalk-meny-lenke {
    text-decoration: none; font-size: 14px; color: var(--primary); font-weight: 600;
    text-align: center; background-color: var(--accent-bg); border-radius: 8px;
    padding: 10px; transition: all 0.2s ease;
}
.kalk-meny-lenke:hover { background-color: var(--primary); color: #ffffff; }

/* --- RESPONSIVT DESIGN --- */
.mobile-scroll-hint { display: none; }

@media (min-width: 800px) {
    .card, .card #resetBtn { max-width: 580px; margin-left: auto; margin-right: auto; }
    .card .calc-row, .card h2, .card .result-label { max-width: none; margin-left: 0; margin-right: 0; }
    .card .calc-row { justify-content: center; }
}

@media (max-width: 900px) {
    .calculator-layout { flex-direction: column; gap: 30px; }
    .input-column, .results-column { flex: 1; width: 100%; }
}

@media (max-width: 600px) {
    .container { margin: 20px auto; padding: 0 15px; }
    .kalkulator-card, .card, .faq-section { padding: 20px; }
    .page-title { font-size: 24px; }
    
    .top-logo { width: 28px; }

    .main-nav a { font-size: 13px; padding: 8px 12px; }
    
    .mobile-scroll-hint {
        display: block !important; 
        text-align: center;
        color: #6b7280; /* Subtil gråfarge */
        font-weight: 500;
        font-size: 0.9rem;
        margin-top: 15px;
        margin-bottom: 20px;
        background: transparent; /* Fjerner bakgrunnsfargen */
        padding: 0; /* Fjerner knappestørrelsen */
    }
    .info-icon::after, .info-icon::before { display: none; }
    .calc-row { flex-direction: column; gap: 15px; }
    
    .kalk-meny-container::after {
        content: "❯"; position: absolute; right: 0; top: 0; height: 100%; width: 45px;
        display: flex; align-items: center; justify-content: flex-end; padding-right: 8px;
        color: rgba(13, 148, 136, 0.6); background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,1) 80%);
        pointer-events: auto; 
    }
    .kalk-meny { display: flex; overflow-x: auto; gap: 8px; padding: 2px 45px 2px 2px; scrollbar-width: none; }
    .kalk-meny::-webkit-scrollbar { display: none; }
    .kalk-meny-lenke { flex: 0 0 auto; white-space: nowrap; font-size: 13px; }
}
