/**
 * Cookie consent banner & preferences modal.
 *
 * Semua selector diawali .cc- dan variabelnya punya fallback, karena file ini
 * ikut dimuat di halaman yang memakai style1.css / style.css / Tailwind.
 */

.cc-banner,
.cc-modal {
    --cc-navy: var(--deep-navy, #04203d);
    --cc-blue: var(--ocean-blue, #1d488e);
    --cc-lime: var(--lime-accent, #d9e150);
    --cc-surface: #ffffff;
    --cc-text: #1f2937;
    --cc-muted: #5b6673;
    --cc-border: #e2e6ec;
    --cc-radius: 14px;

    box-sizing: border-box;
    font-family: 'Inter', 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--cc-text);
}

.cc-banner *,
.cc-modal * {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
 * Banner
 * ------------------------------------------------------------------------ */

.cc-banner {
    position: fixed;
    z-index: 2147483000;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    background: var(--cc-surface);
    border-top: 1px solid var(--cc-border);
    box-shadow: 0 -8px 30px rgba(4, 32, 61, 0.14);
    animation: cc-slide-up 0.32s ease-out both;
}

.cc-banner[hidden] {
    display: none;
}

.cc-banner__inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.cc-banner__text {
    flex: 1 1 420px;
    min-width: 0;
}

.cc-banner__title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cc-navy);
}

.cc-banner__text p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--cc-muted);
}

.cc-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

@keyframes cc-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .cc-banner { animation: none; }
}

/* ---------------------------------------------------------------------------
 * Tombol
 * ------------------------------------------------------------------------ */

.cc-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 10px 20px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.cc-btn:focus-visible {
    outline: 3px solid var(--cc-blue);
    outline-offset: 2px;
}

.cc-btn:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* Primary dan secondary sengaja sama-sama menonjol: menolak cookie harus
   semudah menerimanya, bukan disamarkan jadi link kecil. */
.cc-btn--primary {
    background: var(--cc-lime);
    color: var(--cc-navy);
}

.cc-btn--primary:hover {
    background: #c9d243;
}

.cc-btn--secondary {
    background: var(--cc-surface);
    color: var(--cc-navy);
    border-color: var(--cc-navy);
}

.cc-btn--secondary:hover {
    background: #f1f4f8;
}

.cc-btn--ghost {
    background: transparent;
    color: var(--cc-muted);
    border-color: var(--cc-border);
}

.cc-btn--ghost:hover {
    color: var(--cc-navy);
    border-color: var(--cc-navy);
}

.cc-link {
    color: var(--cc-blue);
    text-decoration: underline;
}

/* ---------------------------------------------------------------------------
 * Modal preferensi
 * ------------------------------------------------------------------------ */

.cc-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.cc-modal[hidden] {
    display: none;
}

.cc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 32, 61, 0.55);
}

.cc-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--cc-surface);
    border-radius: var(--cc-radius);
    box-shadow: 0 24px 60px rgba(4, 32, 61, 0.3);
    overflow: hidden;
}

.cc-modal__dialog form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--cc-border);
}

.cc-modal__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cc-navy);
}

.cc-modal__close {
    appearance: none;
    background: none;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    padding: 0 4px;
    color: var(--cc-muted);
    cursor: pointer;
}

.cc-modal__close:hover {
    color: var(--cc-navy);
}

.cc-modal__body {
    padding: 18px 22px;
    overflow-y: auto;
}

.cc-modal__intro {
    margin: 0 0 18px;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--cc-muted);
}

.cc-category + .cc-category {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--cc-border);
}

.cc-category__head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-category__label {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--cc-navy);
    cursor: pointer;
}

.cc-category__always {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cc-muted);
}

.cc-category__desc {
    margin: 6px 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--cc-muted);
}

.cc-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 22px;
    border-top: 1px solid var(--cc-border);
    background: #fafbfc;
}

body.cc-modal-open {
    overflow: hidden;
}

/* ---------------------------------------------------------------------------
 * Switch
 * ------------------------------------------------------------------------ */

.cc-switch {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    position: relative;
    width: 44px;
    height: 24px;
    margin: 0;
    border-radius: 999px;
    background: #cbd2db;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

.cc-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
    transition: transform 0.18s ease;
}

.cc-switch:checked {
    background: var(--cc-blue);
}

.cc-switch:checked::after {
    transform: translateX(20px);
}

.cc-switch:disabled {
    cursor: not-allowed;
    background: var(--cc-lime);
}

.cc-switch:focus-visible {
    outline: 3px solid var(--cc-blue);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * Layar kecil
 * ------------------------------------------------------------------------ */

@media (max-width: 720px) {
    .cc-banner__inner {
        gap: 14px;
    }

    .cc-banner__actions {
        width: 100%;
    }

    .cc-banner__actions .cc-btn {
        flex: 1 1 140px;
    }

    .cc-modal__footer {
        justify-content: stretch;
    }

    .cc-modal__footer .cc-btn {
        flex: 1 1 140px;
    }
}
