/* ===========================
   Cookie Consent System
   Uses existing :root variables
   =========================== */

/* ----- Backdrop ----- */
.cc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.cc-backdrop.cc-visible {
    opacity: 1;
    visibility: visible;
}

/* ----- Modal ----- */
.cc-modal {
    position: fixed;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);

    /* Desktop: centred */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.97);
    width: 520px;
    max-width: 94vw;
    max-height: 88vh;
    overflow-y: auto;

    background: var(--color-white, #fff);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--color-border, #e2e8f0);
    font-family: var(--font-main, 'Inter', sans-serif);
    color: var(--color-text, #1a1a1a);
}

.cc-modal.cc-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ----- Inner wrapper ----- */
.cc-inner {
    padding: 2rem 2rem 1.75rem;
}

/* ----- Header ----- */
.cc-header {
    margin-bottom: 1.25rem;
}

.cc-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text, #1a1a1a);
    margin: 0 0 0.25rem;
    line-height: 1.3;
}

/* ----- Body text ----- */
.cc-body {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--color-text-light, #555);
    margin-bottom: 1.5rem;
}

.cc-body a {
    color: var(--color-primary, #154cbd);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cc-body a:hover {
    color: var(--color-primary-dark, #0d3aa0);
}

/* ----- Buttons row ----- */
.cc-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    letter-spacing: 0.01em;
    line-height: 1;
}

.cc-btn:focus-visible {
    outline: 2px solid var(--color-primary, #154cbd);
    outline-offset: 2px;
}

/* Accept All */
.cc-btn--accept {
    background: var(--color-primary, #154cbd);
    color: #fff;
    box-shadow: 0 4px 16px rgba(21, 76, 189, 0.3);
}

.cc-btn--accept:hover {
    background: var(--color-primary-dark, #0d3aa0);
    box-shadow: 0 6px 20px rgba(21, 76, 189, 0.4);
    transform: translateY(-1px);
}

/* Reject */
.cc-btn--reject {
    background: transparent;
    color: var(--color-text, #1a1a1a);
    border: 1px solid var(--color-border, #e2e8f0);
}

.cc-btn--reject:hover {
    border-color: var(--color-primary, #154cbd);
    color: var(--color-primary, #154cbd);
    background: var(--color-secondary, #f8faff);
    transform: translateY(-1px);
}

/* Customize */
.cc-btn--customize {
    background: transparent;
    color: var(--color-text-light, #555);
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.85rem;
}

.cc-btn--customize:hover {
    color: var(--color-primary, #154cbd);
}

/* Save */
.cc-btn--save {
    background: var(--color-primary, #154cbd);
    color: #fff;
    box-shadow: 0 4px 16px rgba(21, 76, 189, 0.3);
    margin-top: 0.25rem;
}

.cc-btn--save:hover {
    background: var(--color-primary-dark, #0d3aa0);
    transform: translateY(-1px);
}

/* ----- Preferences Panel ----- */
.cc-prefs {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.cc-prefs.cc-prefs-open {
    max-height: 600px;
    opacity: 1;
    margin-top: 1.25rem;
}

.cc-prefs__divider {
    height: 1px;
    background: var(--color-border, #e2e8f0);
    margin-bottom: 1.25rem;
}

/* ----- Single category ----- */
.cc-category {
    margin-bottom: 1.25rem;
}

.cc-category:last-of-type {
    margin-bottom: 0.75rem;
}

.cc-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.cc-category__name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text, #1a1a1a);
    margin: 0;
}

.cc-category__desc {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--color-text-light, #555);
    margin: 0;
}

/* ----- Toggle Switch ----- */
.cc-toggle {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
}

.cc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cc-toggle__track {
    position: absolute;
    inset: 0;
    background: var(--color-border, #d1d5db);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.25s ease;
}

.cc-toggle__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cc-toggle input:checked+.cc-toggle__track {
    background: var(--color-primary, #154cbd);
}

.cc-toggle input:checked+.cc-toggle__track::after {
    transform: translateX(20px);
}

.cc-toggle input:disabled+.cc-toggle__track {
    opacity: 0.55;
    cursor: not-allowed;
}

.cc-toggle input:focus-visible+.cc-toggle__track {
    outline: 2px solid var(--color-primary, #154cbd);
    outline-offset: 2px;
}

/* "Always active" label */
.cc-always-active {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-primary, #154cbd);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ----- Mobile: Bottom Sheet ----- */
@media (max-width: 600px) {
    .cc-modal {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .cc-modal.cc-visible {
        transform: translateY(0);
    }

    .cc-inner {
        padding: 1.5rem 1.25rem 2rem;
    }

    .cc-title {
        font-size: 1.2rem;
    }

    .cc-body {
        font-size: 0.85rem;
    }
}

/* ----- Scrollbar (webkit) ----- */
.cc-modal::-webkit-scrollbar {
    width: 5px;
}

.cc-modal::-webkit-scrollbar-track {
    background: transparent;
}

.cc-modal::-webkit-scrollbar-thumb {
    background: var(--color-border, #d1d5db);
    border-radius: 999px;
}