/* Explain: Styles for cookie consent and accessibility popups, and floating action buttons. */
/* ==========================================================================
   Ujednačen dizajn popup panela — postavke kolačića + pristupačnost
   Oba panela dijele identičan okvir, zaglavlje, redove i podnožje.
   Na mobitelu se otvaraju kao ploča koja klizne odozdo, a bočni gumbi su
   ikone: lijevo = kolačići, desno = pristupačnost.
   ========================================================================== */

/* ---------------- Okvir (zatamnjenje) ---------------- */
#cc-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0 0 5.5rem 0.85rem;
    background: rgba(2, 3, 4, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
#cc-modal.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s;
}

/* ---------------- Ploča ---------------- */
#cc-modal .cc-modal-panel {
    position: relative;
    width: min(408px, 100%);
    max-height: min(82vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75);
    overflow: hidden;
    transform: translateY(16px) scale(0.97);
    transform-origin: left bottom;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#cc-modal.is-open .cc-modal-panel {
    transform: translateY(0) scale(1);
}

/* ---------------- Zaglavlje ---------------- */
#cc-modal .cc-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.3rem 1.35rem 1.25rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--sector-sys) 20%, var(--surface-color)), var(--surface-color) 72%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#cc-modal .cc-head-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
#cc-modal .cc-head-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.9rem;
    background: linear-gradient(160deg, var(--sector-sys), #EA580C);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--sector-sys) 42%, transparent);
}
#cc-modal .cc-head h2.cc-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: #fff;
}
#cc-modal .cc-head p.cc-sub {
    margin: 0.22rem 0 0;
    font-size: 0.74rem;
    font-weight: 300;
    line-height: 1.4;
    color: var(--text-muted);
}
#cc-modal #cc-close {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
#cc-modal #cc-close:hover,
#cc-modal #cc-close:focus-visible {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

/* ---------------- Tijelo ---------------- */
#cc-modal .cc-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 1.15rem 1.35rem;
    scrollbar-gutter: stable;
}

/* ---------------- Redci kategorija ---------------- */
#cc-modal .cc-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0;
    cursor: pointer;
}
#cc-modal .cc-row.cc-locked { cursor: default; }
#cc-modal .cc-row-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}
#cc-modal .cc-row:not(.cc-locked):hover .cc-row-icon { color: var(--accent); }
#cc-modal .cc-row:has(.cc-toggle-input:checked) .cc-row-icon,
#cc-modal .cc-row.cc-locked .cc-row-icon {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border-color));
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}
#cc-modal .cc-row-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
#cc-modal .cc-row-title {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-color);
}
#cc-modal .cc-row-desc {
    font-size: 0.7rem;
    font-weight: 300;
    line-height: 1.4;
    color: var(--text-muted);
}
#cc-modal .cc-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
#cc-modal .cc-row .cc-switch { margin-left: auto; }

/* ---------------- Prekidač ---------------- */
#cc-modal .cc-switch {
    flex-shrink: 0;
    width: 50px;
    height: 28px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border-color);
    position: relative;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}
#cc-modal .cc-knob {
    position: absolute;
    top: 50%;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
    transition: left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#cc-modal .cc-row input:checked ~ .cc-switch {
    background: var(--accent);
    border-color: var(--accent);
}
#cc-modal .cc-row input:checked ~ .cc-switch .cc-knob { left: calc(100% - 23px); }
#cc-modal .cc-row input:focus-visible ~ .cc-switch {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ---------------- Podnožje ---------------- */
#cc-modal .cc-foot {
    flex-shrink: 0;
    padding: 1.1rem 1.35rem;
    background: rgba(0, 0, 0, 0.28);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
#cc-modal #cc-save {
    width: 100%;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: transparent;
    color: var(--text-color);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
#cc-modal #cc-save:hover,
#cc-modal #cc-save:focus-visible {
    background: #fff;
    color: #0a0a0a;
    border-color: #fff;
}

/* ---------------- Mobitel: ploča klizne odozdo ---------------- */
@media (max-width: 1023.98px) {
    #cc-modal {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }
    #cc-modal .cc-modal-panel {
        width: 100%;
        max-width: 100%;
        max-height: 92dvh;
        border-radius: 1.25rem 1.25rem 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        transform: translateY(100%) scale(1);
        transform-origin: bottom center;
    }
    #cc-modal.is-open .cc-modal-panel { transform: translateY(0) scale(1); }
    #cc-modal .cc-modal-panel::before {
        content: "";
        position: absolute;
        top: 0.6rem;
        left: 50%;
        transform: translateX(-50%);
        width: 42px;
        height: 4px;
        border-radius: 9999px;
        background: rgba(255, 255, 255, 0.2);
        z-index: 5;
    }
    #cc-modal .cc-head { padding: 1.5rem 1.15rem 1.1rem; }
    #cc-modal .cc-head-icon { width: 42px; height: 42px; font-size: 1.05rem; border-radius: 0.8rem; }
    #cc-modal .cc-head h2.cc-title { font-size: 1.05rem; }
    #cc-modal #cc-close { width: 44px; height: 44px; }
    #cc-modal .cc-body { padding: 1.1rem 1.15rem; }
    #cc-modal .cc-row { padding: 0.9rem 0; }
    #cc-modal .cc-row-icon { width: 42px; height: 42px; font-size: 1rem; }
    #cc-modal .cc-row-desc { font-size: 0.72rem; line-height: 1.45; }
    #cc-modal .cc-foot {
        padding: 0.95rem 1.15rem calc(0.95rem + env(safe-area-inset-bottom));
    }
    #cc-modal #cc-save { min-height: 52px; }
}

/* ---------------- Plutajući gumbi (svi ekrani: lijevo kolačići / desno pristupačnost) ---------------- */
#cc-fab {
    left: calc(0.85rem + env(safe-area-inset-left));
    right: auto;
    top: auto;
    bottom: calc(0.85rem + env(safe-area-inset-bottom));
    transform: none;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 9999px !important;
    background: linear-gradient(160deg, var(--sector-sys), #EA580C);
    color: #fff;
    border: none;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
#cc-fab:hover,
#cc-fab:focus-visible {
    background: linear-gradient(160deg, var(--sector-sys), #EA580C);
    color: #fff;
    transform: translateY(-2px);
}
#cc-fab i { font-size: 1.35rem; }
#cc-fab .cc-fab-text { display: none; }

#a11y-fab {
    right: calc(0.85rem + env(safe-area-inset-right));
    left: auto;
    top: auto;
    bottom: calc(0.85rem + env(safe-area-inset-bottom));
    transform: none;
    width: 56px;
    height: 56px;
    padding: 0;
    gap: 0;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 9999px !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
#a11y-fab:hover,
#a11y-fab:focus-visible { transform: translateY(-2px); }
#a11y-fab i { display: block; font-size: 1.5rem; line-height: 1; width: auto; height: auto; margin: 0; }
#a11y-fab i::before { display: block; line-height: 1; }
#a11y-fab .a11y-fab-text { display: none; }

@media (prefers-reduced-motion: reduce) {
    #cc-modal,
    #cc-modal .cc-modal-panel { transition: none !important; }
}

/* ---------------- Ikona alata za pristupačnost (vektor) ---------------- */
#a11y-fab {
    background: linear-gradient(160deg, var(--sector-sec), #0284C7) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5) !important;
    padding: 0 !important;
    width: 56px;
    height: 56px;
    border-radius: 9999px !important;
    gap: 0 !important;
}
#a11y-fab i {
    display: block;
    font-size: 1.5rem;
    line-height: 1;
    color: #fff !important;
    transition: transform 0.25s ease;
}
#a11y-fab:hover,
#a11y-fab:focus-visible {
    background: linear-gradient(160deg, var(--sector-sec), #0284C7) !important;
    color: #fff !important;
    filter: brightness(1.1);
}
#a11y-fab:hover i,
#a11y-fab:focus-visible i { transform: scale(1.07); }

/* Ikona u zaglavlju panela */
#a11y-panel .a11y-head-icon {
    background: linear-gradient(160deg, var(--sector-sec), #0284C7) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--sector-sec) 42%, transparent) !important;
}
#a11y-panel .a11y-head-icon i {
    font-size: 1.15rem;
    color: #fff !important;
}

@media (max-width: 1023.98px) {
    #a11y-fab {
        width: 56px;
        height: 56px;
        transform: none !important;
    }
}

/* Desktop: pristupačnost se otvara iznad vlastitog gumba - jednako kao panel kolačića, samo zrcaljeno desno */
@media (min-width: 1024px) {
    #a11y-fab {
        display: inline-flex !important;
    }
    #a11y-backdrop {
        background: rgba(2, 3, 4, 0.55);
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
    }
    #a11y-panel {
        top: auto;
        left: auto;
        right: calc(0.85rem + env(safe-area-inset-right));
        bottom: calc(5.25rem + env(safe-area-inset-bottom));
        width: min(408px, calc(100vw - 1.7rem));
        max-height: min(82vh, 720px);
        border-radius: 1.25rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75);
        transform: translateY(16px) scale(0.97);
        transform-origin: right bottom;
        transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.25s;
    }
    #a11y-panel.is-open {
        transform: translateY(0) scale(1);
        transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
    }
}