/*
 * Fil: css/cookie-samtycke.css
 * Syfte: Styling för cookie-samtyckesbannern och inställningsmodalen.
 * Version: 1.4
 */

/* Container för bannern */
#cookie-samtykke-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: none; /* Visas via JS */
    border-top: 1px solid #e0e0e0;
    font-size: 15px;
}

#cookie-samtykke-banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 15px;
}

#cookie-samtykke-banner-text {
    flex-grow: 1;
    min-width: 300px;
}

#cookie-samtykke-banner-text p {
    margin: 0;
    line-height: 1.5;
}

#cookie-samtykke-banner-text a {
    color: #007AFF;
    text-decoration: underline;
}

#cookie-samtykke-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Modal för inställningar */
#cookie-samtykke-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000;
    display: none; /* Visas via JS */
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

#cookie-samtykke-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

#cookie-samtykke-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

#cookie-samtykke-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

#cookie-luk-modal {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.cookie-category {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}
.cookie-category:last-of-type {
    border-bottom: none;
}

.cookie-category-description h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
}
.cookie-category-description p {
    margin: 0;
    font-size: 0.9rem;
    color: #555;
}

#cookie-samtykke-modal-footer {
    margin-top: 25px;
    text-align: right;
}

/* Knappar */
.cookie-btn {
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.cookie-btn:active {
    transform: scale(0.98);
}
.cookie-btn.primary {
    background-color: #007AFF;
    color: white;
}
.cookie-btn.secondary {
    background-color: #e9ecef;
    color: #495057;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #34C759;
}
input:checked + .slider:before {
    transform: translateX(22px);
}
input:disabled + .slider {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Dark Mode-anpassningar */
body.dark-mode #cookie-samtykke-banner {
    background-color: #1c1c1e;
    border-top-color: #3a3a3c;
    color: #f5f5f7;
}
body.dark-mode #cookie-samtykke-banner a {
    color: #58a6ff;
}
body.dark-mode #cookie-samtykke-modal-content {
    background-color: #2c2c2e;
    color: #f5f5f7;
}
body.dark-mode #cookie-samtykke-modal-header {
    border-bottom-color: #3a3a3c;
}
body.dark-mode #cookie-luk-modal,
body.dark-mode .cookie-category-description p {
    color: #a1a1a6;
}
body.dark-mode .cookie-category {
    border-bottom-color: #3a3a3c;
}
body.dark-mode .cookie-btn.secondary {
    background-color: #495057;
    color: #f8f9fa;
}
body.dark-mode .cookie-btn.primary {
    background-color: #007AFF;
}

/* --- KORRIGERING FÖR TOGGLE I DARK MODE --- */
/* Färg på toggle i "av"-läge i Dark Mode */
body.dark-mode .slider {
    background-color: #495057;
}
/* Färg på toggle i "på"-läge i Dark Mode */
body.dark-mode input:checked + .slider {
    background-color: #007AFF; /* Använder den primära handlingsfärgen */
}
/* Färg på inaktiverad toggle i Dark Mode */
body.dark-mode input:disabled + .slider {
    background-color: #3a3a3c;
    cursor: not-allowed;
}
/* --- SLUT PÅ KORRIGERING --- */


/* Responsiv design */
@media (max-width: 768px) {
    /* --- ANPASSNINGAR FÖR MOBILA ENHETER (Version 1.4) --- */

    /* 1. Gör cookie-bannern mindre för att vara mindre påträngande */
    #cookie-samtykke-banner {
        padding: 12px;
    }
    #cookie-samtykke-banner-text p {
        font-size: 13px; /* Texten gjord mindre */
        line-height: 1.4;  /* Radavstånd justerat för kompakthet */
    }
    #cookie-samtykke-banner-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #cookie-samtykke-banner-actions {
        justify-content: center;
        margin-top: 8px;
        gap: 8px; /* Avstånd mellan knappar reducerat */
    }
    /* Gör knapparna i bannern specifikt mindre */
    #cookie-samtykke-banner .cookie-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* 2. Säkerställer att inställningsmodalen kan scrollas */
    #cookie-samtykke-modal-content {
        padding: 25px 20px;
        max-height: 85vh; /* Förhindrar att modalen blir större än skärmen */
        overflow-y: auto;  /* Lägger till en scrollbar om innehållet är för högt */
    }

    .cookie-category {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .cookie-category-description h4 {
        font-size: 0.95rem;
    }
    .cookie-category-description p {
        font-size: 0.85rem;
    }
}