﻿/* ==================== BASSTILAR ==================== */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: Times New Roman;
    overflow: hidden;
}

    body > form {
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

/* ==================== Rubrik text format Asap Bold ==================== */
#originalContent .searchable-content h2,
#originalContent .searchable-content h3,
#originalContent .searchable-content h4,
#originalContent .searchable-content h5,
#originalContent .searchable-content .bold-title_1 {
    font-family: 'Asap', sans-serif !important;
    font-weight: 700 !important;
}

/* ==================== NAVBAR OCH HEADER ==================== */
.navbar {
    margin-bottom: 0;
    border-bottom: none;
}

/* Lyssna-knapp styling */
.listen-area {
    background-color: #000000;
    padding: 10px 0;
    border-bottom: 1px solid #ccc;
    font-size: 14px;
    line-height: 1.2;
}

.listen-text {
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
}

.listen-area button {
    border: none;
    color: white;
    padding: 6px 12px;
    margin-right: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

    .listen-area button:hover {
        background-color: #0056b3;
    }

button {
    border: none;
    background: transparent;
    outline: none;
}

/* ==================== HUVUDINNEHÅLL MED KARTA OCH TEXT ==================== */
.main-wrapper {
    display: flex;
    flex-direction: row-reverse;
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0;
    border-top: 1px solid #ddd;
}

/* Karta till vänster */
.left {
    flex: 1;
    min-width: 300px;
    background-color: #f0f0f0;
    overflow: hidden;
    box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.1);
}

/* Text till höger */
.right {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.3);
    z-index: 1;
    background-color: #ffffff;
    min-height: 0;
}

.right-inner {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 2rem;
    background-color: #ffffff;
    min-height: 0;
}

/* Karta ska fylla hela vänstersidan */
#minimapbody {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

/* När jag använder bild i stället för kartan */
.map-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f0f0f0;
}

/* Själva bilden */
.map-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ==================== MENYER ==================== */
nav {
    background: white;
}

.menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    list-style: none;
    margin: 0;
    padding: 0;
    width: auto;
}

    .menu li {
        position: relative;
    }

    .menu > li {
        flex: none;
        text-align: left;
        margin-right: 10px;
    }

    .menu a {
        display: block;
        padding: 15px;
        color: black;
        text-decoration: none;
    }

        .menu a:hover {
            background: #004f71;
            color: white;
        }

    .menu li:hover,
    .menu li:hover > a {
        background: #004f71;
        color: white;
    }

    /* För snyggare övergång */
    .menu li ul {
        transition: all 0.3s ease;
    }

    /* Dropdown */
    .menu li ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background: white;
        min-width: 200px;
        list-style: none;
        padding: 0;
        z-index: 1000;
    }

    .menu li:hover > ul {
        display: block;
    }

    .menu li ul li a {
        padding: 10px;
        text-align: left;
    }

    .menu li ul li ul {
        left: 100%;
        top: 0;
    }

/* Mobilknapp */
.menu-toggle {
    display: none;
    background: white;
    color: black;
    padding: 15px;
    cursor: pointer;
    text-align: center;
}

    .menu-toggle.active {
        background: #004f71;
        color: white;
    }

/* Arrow styling */
.arrow {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: solid black;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform 0.3s ease, border-color 0.3s ease;
    margin-left: 5px;
}

.menu li:hover > a .arrow,
.menu li.open > a .arrow {
    transform: rotate(-135deg);
    border-color: white;
}

/* ==================== SÖKFUNKTION ==================== */
.search-wrapper {
    display: flex;
    flex-direction: row-reverse;
    width: 100%;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.search-spacer {
    flex: 1;
    min-width: 300px;
}

.search-right {
    flex: 1;
}

.search-container {
    padding: 1rem 2rem;
}

    /* Uppdaterad sökruta med integrerad knapp */
    .search-container .input-group {
        position: relative;
        display: flex;
        align-items: center;
    }

    .search-container .form-control {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
        border-right: none;
        height: 38px;
    }

/* Integrerad sökknapp i samma ruta */
#searchButton {
    background-color: #004f71;
    border-color: #004f71;
    color: white;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    height: 38px;
    padding: 0 15px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

    #searchButton:hover,
    #searchButton:focus {
        background-color: #003a55;
        border-color: #003a55;
    }

/* Ta bort clearSearchButton */
#clearSearchButton {
    display: none !important;
}

/* Ändra färg på checkbox */
.form-check-input:checked {
    background-color: #004f71;
    border-color: #004f71;
}

/* Resultaträknare */
#resultCount {
    display: none !important;
    background-color: #004f71;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

/* Ändra textfärg för sökordet */
.search-term {
    color: #004F71;
}

/* Sökresultat – "Visa i kontext"-knapp */
.search-result-item .btn-outline-primary {
    color: #004F71;
    border-color: #004F71;
}

    .search-result-item .btn-outline-primary:hover,
    .search-result-item .btn-outline-primary:focus,
    .search-result-item .btn-outline-primary:active {
        background-color: #004F71;
        border-color: #004F71;
        color: #ffffff;
    }

.highlight {
    background-color: yellow;
    font-weight: bold;
    padding: 0 2px;
}

/* Sökresultat – Dölja antal träff */
#highlightAll,
#resultCount {
    display: none;
}

#highlightAllWrapper {
    display: none;
}

/* ==================== DATABASINNEHÅLL ==================== */
#originalContent .searchable-content > * {
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
}

#originalContent .searchable-content h2 {
    margin-bottom: 0.5rem !important;
}

#originalContent .searchable-content h3 {
    margin-bottom: 0.5rem !important;
}

#originalContent .searchable-content h4 {
    margin-bottom: 0.5rem !important;
}

#originalContent .searchable-content h5 {
    margin-bottom: 0.5rem !important;
}

#originalContent .searchable-content h6 {
    font-size: 0.9rem;
    font-weight: 400;
    color: #666;
    margin-bottom: 1rem !important;
}

#originalContent .searchable-content .content-text {
    margin-bottom: 1.5rem !important;
}

/* Första elementet ska inte ha marginal över */
#originalContent .searchable-content > *:first-child {
    margin-top: 0 !important;
}

/* Databas-specifika stilar */
.bold-title_1 {
    font-weight: bold;
}

/* Stiler för slå ihop kolumner */
.inline-text {
    margin: 8px 0 1rem 0;
    line-height: 1.4;
}

    .inline-text .abbr {
        font-weight: bold;
        margin-right: 6px;
        white-space: nowrap;
    }

/* Gul ruta i bak texten */
.info-box {
    background-color: #e9ddc7;
    white-space: pre-line;
    max-width: 90%;
    margin: 0 auto;
}

    .info-box a {
        display: inline;
        margin-left: 0.25rem !important;
    }

.between-image {
    width: 100vw;
    height: auto;
    display: block;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.menu-path-wrapper {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 0.5rem 1rem;
}

.menu-path {
    text-align: left;
    margin: 0;
}

.content-text {
    white-space: pre-line;
}

/* ==================== INSTÄLLNINGAR OCH HJÄLP ==================== */
.settings-panel {
    position: absolute;
    top: 5vh;
    left: 10vw;
    right: 10vw;
    width: auto;
    max-height: 90vh;
    max-width: 250px;
    overflow-y: auto;
    background: black !important;
    border: 1px solid #ccc;
    padding: 20px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 8px;
    color: white !important;
}

.settings-panel-close {
    color: white;
    font-size: 18px;
}

.help-panel {
    position: absolute;
    top: 5vh;
    left: 10vw;
    right: 10vw;
    width: auto;
    max-height: 90vh;
    max-width: 600px;
    overflow-y: auto;
    background: black !important;
    border: 1px solid #ccc;
    padding: 20px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 8px;
    color: white !important;
}

.help-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    color: white;
    font-size: 14px;
}

    .help-item img {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }

/* ==================== TYPOGRAPHY ==================== */
p {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* ==================== EXTRA: FÖR ATT ÅSIDOSÄTTA BOOTSTRAP ==================== */
#originalContent .searchable-content > * {
    line-height: 1.4 !important;
}

/* För att anpassa bild storlek */
.content-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
}

/* Header-delar som ska döljas/visas */
.navbar,
.search-wrapper,
.menu-toggle,
nav > nav {
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 1000;
}

#topHeader {
    position: relative;
    z-index: 1000;
    transition: transform 0.3s ease;
}

    #topHeader.header-hidden {
        transform: translateY(-100%);
    }

/* När header göms ska main-wrapper flyttas upp */
.main-wrapper {
    transition: margin-top 0.3s ease;
}

    .main-wrapper.header-hidden-adjust {
        margin-top: -150px;
    }

#topHeader.hidden {
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* ==================== RESPONSIV DESIGN FÖR ALLA SKÄRMSTORLEKAR ==================== */

/* Extra stora skärmar (≥1400px) */
@media (min-width: 1400px) {
    .right-inner {
        padding: 2rem 4rem;
    }

    .search-container {
        padding: 1.5rem 3rem;
    }
}

/* Stora skärmar (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .right-inner {
        padding: 1.5rem 3rem;
    }
}

/* Mellanstora skärmar / laptops (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .right-inner {
        padding: 1.25rem 2rem;
    }

    .menu a {
        padding: 12px 10px;
        font-size: 0.9rem;
    }
}

/* Mindre laptops / större tablets (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .menu > li {
        margin-right: 5px;
    }

    .menu a {
        padding: 12px 8px;
        font-size: 0.85rem;
    }

    .right-inner {
        padding: 1rem 1.5rem;
    }

    .search-container {
        padding: 0.75rem 1.5rem;
    }

    .search-spacer {
        min-width: 200px;
    }
}

/* Tablets och mindre (max 767px) */
@media (max-width: 767px) {
    /* Huvudinnehåll */
    .main-wrapper {
        flex-direction: column;
    }

    .left {
        flex: 0 0 40%;
        min-height: 300px;
    }

    .right {
        flex: 0 0 60%;
    }

    .right-inner {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
    }

    /* Meny */
    .menu {
        display: none;
        flex-direction: column;
        width: 100%;
    }

        .menu.active {
            display: flex;
        }

        .menu > li {
            flex: none;
            width: 100%;
            margin-right: 0;
        }

        .menu a {
            padding: 15px;
            border-bottom: 1px solid #eee;
        }

        .menu li ul {
            position: static;
            width: 100%;
            box-shadow: none;
            border-left: 2px solid #004f71;
        }

        .menu li:hover > ul {
            display: none;
        }

        .menu li.open > ul {
            display: block;
        }

    .menu-toggle {
        display: block;
        background-color: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
        font-weight: bold;
    }

    /* Olika nivåer olika vänstermarginal */
    .menu li li a {
        padding-left: 30px;
    }

    .menu li li li a {
        padding-left: 45px;
    }

    /* Bilder */
    .between-image {
        max-height: 30vh;
        object-fit: cover;
    }

    .content-image,
    .between-image {
        max-height: 40vh;
        object-fit: contain;
    }

    /* Sök */
    .search-wrapper {
        flex-direction: column;
    }

    .search-spacer {
        display: none;
    }

    .search-right {
        width: 100%;
    }

    .search-container {
        padding: 1rem;
    }

    .input-group {
        flex-direction: row;
        gap: 0;
    }

        .input-group .form-control {
            width: auto;
            flex: 1;
            border-radius: 4px 0 0 4px !important;
        }

        .input-group #searchButton {
            width: auto;
            border-radius: 0 4px 4px 0 !important;
        }

    /* Inställningar och hjälp */
    .settings-panel,
    .help-panel {
        left: 5vw;
        right: 5vw;
        top: 5vh;
        max-height: 80vh;
        padding: 15px;
        width: 90vw;
    }

    .help-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Extra små mobiler (max 480px) */
@media (max-width: 480px) {
    .right-inner {
        padding: 0.75rem;
    }

    .left {
        flex: 0 0 35%;
        min-height: 200px;
    }

    .search-container .row {
        flex-direction: column;
    }

    .col-md-8, .col-md-4 {
        width: 100%;
        margin-bottom: 10px;
    }

    #resultCount {
        display: none;
        margin-top: 10px;
        text-align: center;
    }

    .form-check {
        text-align: center;
    }
}

/* För mycket stora skärmar */
@media (min-width: 2000px) {
    .right-inner {
        max-width: 1200px;
        margin: 0 auto;
        padding: 2rem 4rem;
    }

    .left {
        max-width: 1200px;
    }
}


