/* Regular - Pes 400 */
@font-face {
    font-family: 'General Sans';
    src: url('../fonts/GeneralSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Medium - Pes 500 */
@font-face {
    font-family: 'General Sans';
    src: url('../fonts/GeneralSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* Semibold - Pes 600 */
@font-face {
    font-family: 'General Sans';
    src: url('../fonts/GeneralSans-Semibold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --cc-primary-color: black;
    --cc-bg-card: #ffffff;
    --cc-text-color: #212529;
    --cc-border-radius: 6px;
    --cc-overlay-bg: rgba(100, 100, 100, 0.25);
    --cc-font: 'General Sans', -apple-system, sans-serif;
    --cc-modal-width: 976px;
    --cc-switch-active-color: #33cc33;
    --cc-switch-color: #cccccc;
    --cc-grey-soft: #666666;
}

#cookie-consent-wrapper {
    font-family: var(--cc-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 1. EL WRAPPER: Centrat de pantalla completa */
.cc-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none; /* Permet que el clic passi al fons */
    z-index: 9999;
    padding: 20px;

    overscroll-behavior: contain;
}

html.cc-open, 
body.cc-open {
    overflow: hidden !important;
    /* height: 100% !important; */ /* O 100vh, depenent del layout */
}

body.cc-open {
    padding-right: 6px; /* Compensa la desaparició de la barra de scroll */
}

.cc-wrapper.dark {
    --cc-bg-card: #1a1a1a;
    --cc-text-color: #ffffff; /* El text general ara és blanc */
    --cc-primary-color: #ffffff; /* Els títols ara són blancs */
    --cc-grey-soft: #bbbbbb; /* El gris suau ara és un gris clar */
    --cc-overlay-bg: rgba(0, 0, 0, 0.7);

    /* Important: Reajustar el switch perquè no es perdi */
    --cc-switch-color: #444444; 
}

.cc-wrapper.dark .cc-btn {
    background-color: #444444;
}

.cc-wrapper.dark .cc-btn:hover {
    background-color: #ffffff;
    color: #000000;
}

.cc-wrapper.dark .cc-scroll-container::after {
    background: linear-gradient(to bottom, rgba(26, 26, 26, 0) 0%, var(--cc-bg-card) 80%);
}

/* 2. OVERLAY: Fons desenfocat */
.cc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--cc-overlay-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9998;
    animation: ccFadeIn 0.4s ease-out;
}

/* 3. EL CONTENIDOR DEL BANNER */
.cc-container {
    pointer-events: auto; /* Reactiva els clics aquí */
    max-width: var(--cc-modal-width);
    width: 100%;
    margin: auto; /* Centrat absolut */
    z-index: 9999;
    transition: all 0.3s ease;
    font-family: var(--cc-font);
}

.cc-card {
    transition: all 0.5s ease;
}

/* POSICIONS ESPECÍFIQUES (si es canvia el config) */
.cc-bottom-right { align-self: flex-end; margin-right: 0; }
.cc-bottom-left { align-self: flex-end; margin-left: 0; }
.cc-center-modal { margin: auto; }

/* 4. ANIMACIONS */
@keyframes ccFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ccModalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Estil de la Card */
.cc-container .card {
    animation: ccModalIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border: none !important;
    border-radius: var(--cc-border-radius) !important;
    background-color: var(--cc-bg-card);
    color: var(--cc-text-color);

    padding-top: 22px;
    padding-bottom: 18px;
    padding-left: 53px;
    padding-right: 53px;

    display: flex;
    flex-direction: column;

    height: auto;
    max-height: 70vh;
}

.cc-card-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* L'embolcall del contingut també flex */
.cc-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cc-scroll-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cc-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 15px;
    margin-bottom: 10px;
    padding-bottom: 40px;
}

.cc-scroll-container::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--cc-bg-card) 80%);
    pointer-events: none;
    z-index: 2;
}

.cc-scroll::-webkit-scrollbar {
    width: 6px;
}
.cc-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}
.cc-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
.cc-scroll::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.cc-pr-10 {
    padding-right: 10px !important;
}

/* Assegurem que el fade-in no trenqui el flex */
.cc-fade-in {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    animation: ccContentFade 0.4s ease-out forwards;
}

.cc-card-title {
    font-size: 26px;
    font-family: var(--cc-font);
    font-weight: 500;
    color: var(--cc-primary-color);

    margin-bottom: 30px;
}

.cc-card-text {
    font-size: 15px;
    font-family: var(--cc-font);
    color: var(--cc-primary-color);
}

/* Ajustos de botons i formularis */
.cc-box--btns {
    display: flex;
    flex-wrap: wrap;
    column-gap: 34px;
    row-gap: 10px;

    margin-top: 22px;
}
.cc-box--btns.center {
    justify-content: center;
    padding-right: 53px;
}

.cc-scroll {
    overflow-y: scroll;
}

.cc-settings-list {
    margin-top: 30px;
}

.cc-setting-item {
    display: flex;
    margin-bottom: 21px;
}

.cc-setting-item:last-child {
    margin-bottom: 0;
}

.cc-setting-item .cc-box-switch {
    margin-right: 13px;
}

.cc-setting-item--label {
    font-family: var(--cc-font);
    font-size: 16px;
    font-weight: 600;
    color: var(--cc-grey-soft);
}

.cc-setting-item--description {
    font-family: var(--cc-font);
    font-size: 14px;
    font-weight: 100;
    color: var(--cc-grey-soft);
}

.cc-btn {
    min-width: 176px;
    min-height: 34px;

    font-size: 15px;
    color: white;

    font-weight: 500;

    background-color: #808080;
    border: 0;
    border-radius: 8px;

    cursor: pointer;

    transition: all .5s;
}
.cc-btn:hover {
    background-color: #000000;
}

.cc-container .form-switch .form-check-input  {
    width: 37px;
    height: 21px;
}

.cc-container .form-switch .form-check-input,
.cc-container .form-switch .form-check-input:not(:checked):focus {
    background-color: var(--cc-switch-color);
    border-color: var(--cc-switch-color); 
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}
.cc-container .form-check-input:checked { 
    background-color: var(--cc-switch-active-color); 
    border-color: var(--cc-switch-active-color); 
}

/* RESPONSIVE */
@media (max-width: 576px) {
    .cc-container { max-width: 100%; }
}

@keyframes ccContentFade {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cc-card {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden; 
}

.cc-reopen-btn {
    position: fixed;
    bottom: 0;
    width: 63px;
    height: 46px;

    background-color: rgba(204, 204, 255, 1) !important;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    opacity: 1;

    border: none;

    transition:  all 0.4s;
    z-index: 9990;
    pointer-events: auto;
}

.cc-reopen-btn:hover {
    background-color: #33CC33 !important;
    /* color: var(--cc-bg-card); */
}

.cc-reopen-btn svg {
    width: 31px;
    height: 33px;
}

/* Variants de posició */
.cc-reopen-bottom-left {
    left: 11px;
}

.cc-reopen-bottom-right {
    right: 11px;
}

/* ==========================================================================
   RESPONSIVE: Ajustos per a mòbils
   ========================================================================== */
@media (max-width: 576px) {
    .cc-wrapper { padding: 10px; }

    .cc-container .card {
        padding: 25px 20px 20px 20px;
        max-height: 85vh;
    }

    .cc-card-title { font-size: 22px; margin-bottom: 20px; }

    .cc-box--btns {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
    }

    .cc-btn { width: 100%; min-width: unset; height: 44px; }
    .cc-box--btns.center { padding-right: 0; }

    /* Ajust del botó flotant en mòbil */
    .cc-reopen-btn { display: none !important; bottom: 15px; width: 40px; height: 40px; }
    .cc-reopen-bottom-left { left: 15px; }
    .cc-reopen-bottom-right { right: 15px; }
}

/* ==========================================================================
   ESPECÍFIC: Mòbil en horitzontal (Landscape)
   ========================================================================== */
@media (max-width: 932px) and (orientation: landscape) {
    .cc-container .card {
        max-height: 90vh; /* Aprofitem gairebé tota l'alçada */
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .cc-card-title {
        font-size: 20px;     /* Títol més petit per estalviar espai */
        margin-bottom: 15px;
    }

    .cc-box--btns {
        margin-top: 15px;
        flex-direction: row; /* En horitzontal és millor que els botons tornin a estar de costat */
        gap: 30px;
    }

    .cc-btn {
        min-width: 160px;    /* Botons una mica més estrets perquè cabal-hi bé */
        height: 36px;
    }

    /* Reduïm espais de la llista de configuració */
    .cc-settings-list { margin-top: 15px; }
    .cc-setting-item { margin-bottom: 12px; }
}