/**
 * SWARM Protocol Cookie Consent Banner - GDPR Compliant
 * SWARM brand: dark bg, cyan accents, minimal, no emoji
 */

/* ===== Cookie Banner (SWARM brand redesign) ===== */
/* 2026-05-17 UX fix: pinned to bottom-right (not centered overlay) so it no longer covers hero on first paint */
.cookie-consent,
#cookie-consent-banner.cookie-consent {
    position: fixed;
    bottom: 16px;
    right: 16px;
    left: auto;
    transform: translateY(20px);
    width: min(92vw, 360px);
    max-width: 360px;
    background: rgba(10, 14, 20, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 229, 255, 0.1);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

#cookie-consent-banner.cookie-consent.show {
    opacity: 1;
    transform: translateY(0);
    animation: cookieSlideUp 0.4s ease-out;
}

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

.cookie-consent__inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    flex-wrap: wrap;
}

.cookie-consent__content {
    flex: 1;
    min-width: 280px;
}

.cookie-consent__title {
    color: #00E5FF;
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    letter-spacing: 0.02em;
}

.cookie-consent__text {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.cookie-consent__link {
    color: #00E5FF;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
    transition: border-color 0.2s;
}

.cookie-consent__link:hover {
    border-color: #00E5FF;
}

.cookie-consent__actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-consent__btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-family: inherit;
    white-space: nowrap;
}

.cookie-consent__btn--ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

.cookie-consent__btn--ghost:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.03);
}

.cookie-consent__btn--primary {
    background: linear-gradient(135deg, #00E5FF, #0077FF);
    color: #0A0E14;
    font-weight: 600;
}

.cookie-consent__btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.4);
}

.cookie-consent__btn:focus-visible {
    outline: 2px solid #00E5FF;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    #cookie-consent-banner.cookie-consent {
        padding: 12px 14px;
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }

    /* 2026-05-17 UX fix: compact mobile banner so hero stays readable behind it */
    .cookie-consent__title { font-size: 13px; margin-bottom: 4px; }
    .cookie-consent__text { font-size: 12px; line-height: 1.45; }
    .cookie-consent__inner { gap: 10px; }
    .cookie-consent__btn { padding: 9px 14px; font-size: 12px; }

    .cookie-consent__actions {
        width: 100%;
    }

    .cookie-consent__btn {
        flex: 1;
    }
}

/* ===== Cookie Settings Modal (SWARM brand: cyan, not gold) ===== */
#cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#cookie-settings-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

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

.cookie-modal-content {
    background: rgba(10, 14, 20, 0.98);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 229, 255, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.cookie-modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #00E5FF;
    letter-spacing: 0.02em;
    margin: 0;
}

.cookie-modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.cookie-modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #00E5FF;
}

.cookie-modal-body {
    padding: 24px;
}

.cookie-category {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.cookie-category:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 229, 255, 0.2);
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cookie-category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cookie-category-title h4 {
    font-size: 14px;
    font-weight: 600;
    color: #00E5FF;
    margin: 0;
    letter-spacing: 0.01em;
}

.cookie-category-badge {
    padding: 3px 10px;
    background: rgba(0, 229, 255, 0.1);
    color: rgba(0, 229, 255, 0.85);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cookie-category-badge.always-on {
    background: rgba(0, 229, 255, 0.15);
    color: #00E5FF;
    border-color: rgba(0, 229, 255, 0.35);
}

.cookie-category p {
    font-size: 12px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
}

/* ===== Toggle Switch (cyan brand) ===== */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    transition: all 0.2s ease;
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: linear-gradient(135deg, #00E5FF, #0077FF);
    border-color: rgba(0, 229, 255, 0.5);
}

.cookie-toggle input:checked + .cookie-toggle-slider:before {
    transform: translateX(20px);
    background: #0A0E14;
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
    cursor: not-allowed;
    background: rgba(0, 229, 255, 0.2);
    border-color: rgba(0, 229, 255, 0.35);
}

.cookie-toggle input:disabled + .cookie-toggle-slider:before {
    background: #00E5FF;
}

/* ===== Modal Footer ===== */
.cookie-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(0, 229, 255, 0.15);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Modal footer buttons reuse banner button styling */
.cookie-modal-footer .cookie-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: inherit;
}

.cookie-modal-footer .cookie-btn-reject {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

.cookie-modal-footer .cookie-btn-reject:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.03);
}

.cookie-modal-footer .cookie-btn-accept {
    background: linear-gradient(135deg, #00E5FF, #0077FF);
    color: #0A0E14;
    font-weight: 600;
}

.cookie-modal-footer .cookie-btn-accept:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.4);
}

/* ===== Responsive Design ===== */
@media (max-width: 640px) {
    .cookie-modal-content {
        max-height: 95vh;
    }

    .cookie-modal-header h2 {
        font-size: 18px;
    }

    .cookie-modal-footer {
        flex-direction: column;
    }

    .cookie-modal-footer .cookie-btn {
        width: 100%;
    }

    .cookie-category-header {
        gap: 12px;
    }
}

/* ===== Accessibility ===== */
.cookie-modal-close:focus-visible,
.cookie-toggle input:focus-visible + .cookie-toggle-slider,
.cookie-modal-footer .cookie-btn:focus-visible {
    outline: 2px solid #00E5FF;
    outline-offset: 2px;
}

/* ===== Scrollbar Styling (cyan brand) ===== */
.cookie-modal-content::-webkit-scrollbar {
    width: 6px;
}

.cookie-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.cookie-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00E5FF, #0077FF);
    border-radius: 8px;
}

.cookie-modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00AAFF, #00E5FF);
}
