/**
 * Cookie Consent Banner & Modal Styling — OpinionPick brand
 * Vanilla CSS port of Trackr cookie-consent.scss
 * Uses OpinionPick custom properties from styles.css :root
 */

/* ─── Hidden utility ─────────────────────────────────────────────────────── */
.cookie-consent-hidden {
    display: none !important;
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

@keyframes floatingCookieSlideIn {
    from { transform: translateX(100px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

@keyframes cookieIconPulse {
    0%, 100% { transform: scale(1);   }
    50%       { transform: scale(1.1); }
}

@keyframes cookieIconGlow {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1);   }
    50%       { opacity: 0.9; transform: translate(-50%, -50%) scale(1.1); }
}

/* ─── Cookie consent banner (fixed bottom bar) ───────────────────────────── */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surf);
    border-top: 2px solid var(--lime);
    box-shadow: 0 -4px 20px rgba(22, 23, 15, 0.12);
    padding: 1.25rem;
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

.cookie-consent-banner .container {
    max-width: 1200px;
    margin: 0 auto;
}

.cookie-consent-banner-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .cookie-consent-banner-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.cookie-consent-banner-text {
    flex: 1;
}

.cookie-consent-banner-text h3 {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--fd);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink);
    margin: 0 0 0.5rem 0;
}

.cookie-consent-banner-text p {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

.cookie-consent-banner-text p a {
    color: var(--ink);
    text-decoration: underline;
    font-weight: 600;
}

.cookie-consent-banner-text p a:hover {
    color: var(--muted);
}

.cookie-consent-banner-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 280px;
}

@media (min-width: 768px) {
    .cookie-consent-banner-actions {
        flex-direction: row;
        gap: 0.75rem;
    }
}

.cookie-consent-banner-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--fd);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: 9px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    line-height: 1;
}

.cookie-consent-banner-btn--primary {
    background-color: var(--lime);
    color: var(--ink);
    border-color: var(--lime);
}

.cookie-consent-banner-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(215, 255, 46, 0.45);
}

.cookie-consent-banner-btn--secondary {
    background-color: transparent;
    color: var(--ink);
    border-color: var(--line);
}

.cookie-consent-banner-btn--secondary:hover {
    background-color: var(--cream);
    border-color: var(--ink);
}

.cookie-consent-banner-btn--link {
    background-color: transparent;
    color: var(--muted);
    border-color: transparent;
    text-decoration: underline;
    padding: 0.625rem 0.5rem;
}

.cookie-consent-banner-btn--link:hover {
    color: var(--ink);
    background-color: var(--cream);
}

/* ─── Responsive banner adjustments ─────────────────────────────────────── */
@media (max-width: 768px) {
    .cookie-consent-banner {
        padding: 1rem;
    }

    .cookie-consent-banner-text h3 {
        font-size: 0.9375rem;
    }

    .cookie-consent-banner-text p {
        font-size: 0.8125rem;
    }

    .cookie-consent-banner-actions {
        min-width: 100%;
    }
}

/* ─── Cookie consent preference modal ───────────────────────────────────── */
.cookie-consent-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cookie-consent-modal.active {
    display: flex;
}

.cookie-consent-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(22, 23, 15, 0.6);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease-out;
}

.cookie-consent-modal-content {
    position: relative;
    background-color: var(--surf);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(22, 23, 15, 0.22);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease-out;
}

.cookie-consent-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-consent-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 900;
    font-family: var(--fd);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink);
    margin: 0;
}

.cookie-consent-modal-close {
    background-color: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.cookie-consent-modal-close:hover {
    background-color: var(--cream);
    color: var(--ink);
}

.cookie-consent-modal-body {
    padding: 1.5rem;
}

.cookie-consent-modal-description {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.cookie-consent-modal-description a {
    color: var(--ink);
    text-decoration: underline;
}

.cookie-consent-modal-description a:hover {
    color: var(--muted);
}

.cookie-consent-modal-categories {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cookie-consent-modal-category {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.cookie-consent-modal-category:hover {
    border-color: var(--lime);
    background-color: var(--news);
}

.cookie-consent-modal-category.disabled {
    background-color: var(--cream);
    opacity: 0.8;
}

.cookie-consent-modal-category.disabled:hover {
    border-color: var(--line);
    background-color: var(--cream);
}

.cookie-consent-modal-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.cookie-consent-modal-category-title {
    font-size: 0.9375rem;
    font-weight: 700;
    font-family: var(--fb);
    color: var(--ink);
    margin: 0;
}

.cookie-consent-modal-category-description {
    font-size: 0.8125rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

.cookie-consent-modal-category-description a {
    color: var(--ink);
    text-decoration: underline;
}

.cookie-consent-modal-category-description a:hover {
    color: var(--muted);
}

/* ─── Toggle switch ──────────────────────────────────────────────────────── */
.cookie-consent-modal-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.cookie-consent-modal-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-consent-modal-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--line);
    transition: 0.3s;
    border-radius: 26px;
}

.cookie-consent-modal-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--surf);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(22, 23, 15, 0.2);
}

.cookie-consent-modal-toggle input:checked + .cookie-consent-modal-toggle-slider {
    background-color: var(--lime);
}

.cookie-consent-modal-toggle input:checked + .cookie-consent-modal-toggle-slider:before {
    transform: translateX(22px);
    background-color: var(--ink);
}

.cookie-consent-modal-toggle input:disabled + .cookie-consent-modal-toggle-slider {
    background-color: var(--line);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ─── Modal footer ───────────────────────────────────────────────────────── */
.cookie-consent-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 576px) {
    .cookie-consent-modal-footer {
        flex-direction: row;
        justify-content: flex-end;
    }
}

.cookie-consent-modal-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--fd);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: 9px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1;
}

.cookie-consent-modal-btn--primary {
    background-color: var(--lime);
    color: var(--ink);
    border-color: var(--lime);
}

.cookie-consent-modal-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(215, 255, 46, 0.45);
}

.cookie-consent-modal-btn--secondary {
    background-color: transparent;
    color: var(--ink);
    border-color: var(--line);
}

.cookie-consent-modal-btn--secondary:hover {
    background-color: var(--cream);
    border-color: var(--ink);
}

.cookie-consent-modal-btn--success {
    background-color: var(--lime);
    color: var(--ink);
    border-color: var(--lime);
}

.cookie-consent-modal-btn--success:hover {
    background-color: #c8f020;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(215, 255, 46, 0.45);
}

/* ─── Responsive modal adjustments ──────────────────────────────────────── */
@media (max-width: 768px) {
    .cookie-consent-modal-content {
        margin: 0.5rem;
    }

    .cookie-consent-modal-header,
    .cookie-consent-modal-body,
    .cookie-consent-modal-footer {
        padding: 1rem;
    }

    .cookie-consent-modal-header h2 {
        font-size: 1.125rem;
    }
}

/* ─── Floating bottom icons container ───────────────────────────────────── */
.floating-bottom-icons {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    z-index: 9998;
    animation: floatingCookieSlideIn 0.4s ease-out;
}

@media (max-width: 768px) {
    .floating-bottom-icons {
        bottom: 20px;
        left: 20px;
    }
}

/* Shared floating icon style (round button) */
.floating-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 14px rgba(22, 23, 15, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    background-color: var(--surf);
    transition: all 0.3s ease;
}

.floating-icon:hover {
    background-color: var(--lime);
    color: var(--ink);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(215, 255, 46, 0.5);
}

.floating-icon:active {
    transform: translateY(-1px);
}

.floating-icon svg {
    width: 28px;
    height: 28px;
}

.floating-icon img {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .floating-icon {
        width: 44px;
        height: 44px;
    }

    .floating-icon img {
        width: 22px;
        height: 22px;
    }

    .floating-icon svg {
        width: 24px;
        height: 24px;
    }
}

/* Floating cookie icon (alias, same style) */
.floating-cookie-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 14px rgba(22, 23, 15, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    background-color: var(--surf);
    transition: all 0.3s ease;
}

.floating-cookie-icon:hover {
    background-color: var(--lime);
    color: var(--ink);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(215, 255, 46, 0.5);
}

.floating-cookie-icon:active {
    transform: translateY(-1px);
}

.floating-cookie-icon svg {
    width: 28px;
    height: 28px;
}

@media (max-width: 768px) {
    .floating-cookie-icon {
        width: 44px;
        height: 44px;
    }

    .floating-cookie-icon svg {
        width: 24px;
        height: 24px;
    }
}

/* ─── Cookie icon animation helpers ─────────────────────────────────────── */
.cookie-icon-pulse {
    animation: cookieIconPulse 1.5s ease-in-out infinite;
}

.cookie-icon-glow {
    position: relative;
}

.cookie-icon-glow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(215, 255, 46, 0.4) 0%, rgba(215, 255, 46, 0) 70%);
    animation: cookieIconGlow 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}
