/**
 * CB Cookie Banner - Frontend Styles
 *
 * @package CB_Cookie_Banner
 * @since   1.0.0
 */

/* Banner Container */
.cb-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 2;
    background: #1a1a1a;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
}

.cb-cookie-banner.cb-position-bottom {
    bottom: 0;
}

.cb-cookie-banner.cb-position-top {
    top: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cb-cookie-banner.cb-position-bottom-left,
.cb-cookie-banner.cb-position-bottom-right {
    bottom: 20px;
    left: auto;
    right: auto;
    max-width: 400px;
    border-radius: 0.5rem;
}

.cb-cookie-banner.cb-position-bottom-left {
    left: 20px;
}

.cb-cookie-banner.cb-position-bottom-right {
    right: 20px;
}

/* Dark Theme */
.cb-cookie-banner.cb-theme-dark .cb-banner-container {
    
    color: #fff;
}

.cb-cookie-banner.cb-theme-dark .cb-banner-title {
    color: #fff;
}

.cb-cookie-banner.cb-theme-dark .cb-banner-text {
    color: #ddd;
}

.cb-cookie-banner.cb-theme-dark a {
   
}

/* Banner Content */
.cb-banner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.cb-banner-content {
    flex: 1;
    min-width: 300px;
}

.cb-banner-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.cb-banner-text {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

.cb-banner-links {
    margin: 10px 0 0;
    font-size: 13px;
}

.cb-banner-links a {
    
    text-decoration: none;
}

.cb-banner-links a:hover {
    text-decoration: underline;
}

/* Banner Actions */
.cb-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cb-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 0.5rem;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

/*
 * GDPR parity: Accept All and Reject All share the .cb-btn-primary style so
 * they are visually equivalent (EDPB Guidelines 03/2022, Garante 231/2021).
 * The .cb-btn-accept / .cb-btn-reject modifiers exist only as hooks for
 * per-site custom colour tweaks — do NOT use them to make one more prominent
 * than the other.
 */
button.cb-btn.cb-btn-primary {
    background: var(--e-global-color-accent, #00FF99);
    color: var(--e-global-color-primary, #000000);
    border-radius: 0.5rem;
}

button.cb-btn.cb-btn-primary:hover {
    background: var(--e-global-color-b7e33d4, #00cc7a);
    border-color: var(--e-global-color-b7e33d4, #00cc7a);
}

/* Tertiary (Settings) — intentionally less prominent than Accept/Reject */
button.cb-btn.cb-btn-tertiary {
    background: transparent;
    color: inherit;
    text-decoration: underline;
    padding: 8px 4px;
}

button.cb-btn.cb-btn-tertiary:hover {
    text-decoration: none;
    opacity: 0.85;
}

.cb-theme-dark .cb-btn-secondary {
    border-radius: 0.5rem;
}

.cb-theme-dark .cb-btn-secondary:hover {
    background: var(--e-global-color-b7e33d4, #00cc7a);
    border: 2px solid var(--e-global-color-b7e33d4, #00cc7a);
}

/*
 * Persistent manage-cookies trigger.
 * Hidden by default; the inline <head> CSS toggles it on once consent exists.
 * GDPR: Art. 7(3) requires withdrawing consent to be as easy as giving it.
 */
.cb-manage-trigger {
    position: fixed;
    bottom: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #1a1a1a;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-manage-bottom-left {
    left: 16px;
}

.cb-manage-bottom-right {
    right: 16px;
}

.cb-manage-trigger:hover,
.cb-manage-trigger:focus {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    outline: 2px solid var(--e-global-color-accent, #0073aa);
    outline-offset: 2px;
}

.cb-manage-trigger .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.cb-cookie-banner button.cb-modal-close {
    display: flex;
    padding: 8px 12px;
    border-radius: 0.5rem;
    align-items: center;
}

/* Modal */
.cb-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.cb-modal-content {
    position: relative;
    border-radius: 0.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease;
    background: var(--e-global-color-primary, #000000);
}

.cb-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cb-modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.cb-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    color: #666;
}

.cb-modal-close:hover {
    color: #000;
}

.cb-modal-body {
    padding: 20px;
}

.cb-modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Categories */
.cb-categories {
    margin: 20px 0;
}

.cb-category {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    margin-bottom: 10px;
}

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

.cb-category-header label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.cb-category-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.cb-category-desc {
    margin: 0;
    font-size: 13px;
    color: #666;
    padding-left: 28px;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

/* Manage button for Cookie Policy page */
.cb-manage-button-wrapper {
    margin: 20px 0;
}

.cb-manage-button-wrapper .cb-manage-cookies {
    background: var(--e-global-color-secondary, #666);
    color: var(--e-global-color-primary, #fff);
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.cb-manage-button-wrapper .cb-manage-cookies:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* WPML Floating Switcher — move up only while banner is visible.
   Driven by body.cb-banner-visible (toggled by frontend.js init + hideBanner)
   instead of :has(), which could linger while the banner fades out or when
   the browser is slow to re-evaluate after the element is removed.
   --cb-banner-height is set by JS from the rendered banner's offsetHeight,
   so the fallback only matters for a few ms before updateBannerHeight runs. */
body.cb-banner-visible #rb-wpml-floating-switcher,
body.cb-banner-visible #wpml-floating-switcher {
    bottom: calc(var(--cb-banner-height, 170px) + 20px) !important;
    transition: bottom 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .cb-banner-container {
        flex-direction: column;
    }

    .cb-banner-actions {
        width: 100%;
    }

    .cb-btn {
        flex: 1;
        text-align: center;
    }

    .cb-cookie-banner.cb-position-bottom-left,
    .cb-cookie-banner.cb-position-bottom-right {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}
