/* Global Box Sizing for Plugin Elements */
[class^="cookie-guard-"],
[class^="cookie-guard-"] *,
[class*=" cookie-guard-"],
[class*=" cookie-guard-"] * {
    box-sizing: border-box;
}

/* Cookie Banner - Bar Style (Default) */
.cookie-guard-banner {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    background: #2c3e50;
    color: #ffffff;
    padding: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999999;
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
}


.cookie-guard-banner.show {
    display: block;
}

/*
 * Le bandeau est visible par défaut (repli sans JavaScript : un plugin de cache
 * peut retarder tous les scripts). Il est masqué dès qu'un choix est déjà
 * enregistré, via la classe posée sur <html> par le script inline du <head>.
 */
html.cookie-guard-has-consent .cookie-guard-banner,
.cookie-guard-banner.cookie-guard-banner-hidden {
    display: none !important;
}

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

.cookie-guard-banner.position-bottom {
    bottom: 0;
    top: auto;
}

/* Popup Style */
.cookie-guard-banner.style-popup {
    left: auto;
    right: auto;
    max-width: var(--banner-max-width, 1200px);
    border-radius: 16px;
    padding: 30px;
    margin: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.cookie-guard-banner.style-popup.position-bottom {
    bottom: 20px;
}

.cookie-guard-banner.style-popup.position-top {
    top: 20px;
}

.cookie-guard-banner.style-popup.align-left {
    left: 20px;
}

.cookie-guard-banner.style-popup.align-center {
    left: 50%;
    transform: translateX(-50%);
}

.cookie-guard-banner.style-popup.align-right {
    right: 20px;
}

.cookie-guard-banner.style-popup.show {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cookie-guard-banner.style-popup.align-center.show {
    display: block;
}

@keyframes popupInCenter {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

.cookie-guard-banner-content {
    max-width: var(--banner-max-width, 1200px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-guard-banner.style-popup .cookie-guard-banner-content {
    max-width: none;
}

.cookie-guard-banner-text {
    flex: 1;
    min-width: 250px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.cookie-guard-banner-text p {
    margin: 0;
}


.cookie-guard-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cookie-guard-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.cookie-guard-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cookie-guard-btn-accept {
    background: #4CAF50;
    color: #ffffff;
}

.cookie-guard-btn-reject {
    background: #f44336;
    color: #ffffff;
}

.cookie-guard-btn-customize {
    background: #ffffff;
    color: #333333;
}

/* Settings Panel */
.cookie-guard-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
}

.cookie-guard-settings-overlay.show {
    display: flex;
}

.cookie-guard-settings-panel {
    background: #ffffff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.cookie-guard-settings-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333333;
}

.cookie-guard-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.cookie-guard-close:hover {
    color: #333333;
}

.cookie-guard-settings-body {
    padding: 20px;
}

.cookie-guard-category {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.cookie-guard-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

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

.cookie-guard-category-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

.cookie-guard-category-description {
    font-size: 14px;
    color: #666666;
    line-height: 1.6;
    margin: 0;
}

/* Toggle Switch */
.cookie-guard-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.cookie-guard-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.cookie-guard-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.cookie-guard-toggle input:checked+.cookie-guard-toggle-slider {
    background-color: #4CAF50;
}

.cookie-guard-toggle input:checked+.cookie-guard-toggle-slider:before {
    transform: translateX(26px);
}

.cookie-guard-toggle input:disabled+.cookie-guard-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.cookie-guard-always-on {
    display: inline-block;
    padding: 4px 12px;
    background: #e0e0e0;
    color: #666666;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

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

/* Cookie Icon - Sticky Bottom Left */
.cookie-guard-icon {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 999998;
    animation: fadeInUp 0.5s ease;
}

.cookie-guard-icon.show {
    display: flex;
}

.cookie-guard-icon:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for cookie icon */
.cookie-guard-icon.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
    }

    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .cookie-guard-banner-content {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-guard-banner-actions {
        flex-direction: column;
    }

    .cookie-guard-btn {
        width: 100%;
        text-align: center;
    }

    .cookie-guard-banner.style-popup {
        margin: 10px;
        padding: 20px;
        max-width: calc(100% - 20px);
    }

    .cookie-guard-banner.style-popup.align-left,
    .cookie-guard-banner.style-popup.align-right {
        left: 10px;
        right: auto;
    }

    .cookie-guard-banner.style-popup.align-center {
        left: 10px;
        transform: none;
    }

    .cookie-guard-settings-panel {
        width: 95%;
        max-height: 90vh;
    }

    .cookie-guard-settings-footer {
        flex-direction: column;
    }

    .cookie-guard-icon {
        width: 48px;
        height: 48px;
        bottom: 15px;
        left: 15px;
    }

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

/* Shortcode Button */
.cookie-guard-open-settings {
    display: inline-block;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.cookie-guard-open-settings:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Accessibility */
.cookie-guard-btn:focus,
.cookie-guard-close:focus,
.cookie-guard-toggle input:focus+.cookie-guard-toggle-slider,
.cookie-guard-icon:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* RTL Support */
html[dir="rtl"] .cookie-guard-icon {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .cookie-guard-toggle-slider:before {
    left: auto;
    right: 3px;
}

html[dir="rtl"] .cookie-guard-toggle input:checked+.cookie-guard-toggle-slider:before {
    transform: translateX(-26px);
}

/* 2-Click Iframe Placeholder (Google Maps, Videos, etc.) */
.cookie-guard-iframe-wrapper {
    position: relative;
    display: block;
    width: 100%;
    min-height: 280px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin: 15px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/*
 * The blocked iframe keeps its place in the flow so that page builders
 * (Elementor sets a fixed iframe height) still size the container. It is only
 * made invisible, which keeps the placeholder card visible instead of
 * collapsing to a zero-height box.
 */
.cookie-guard-iframe-wrapper > iframe {
    display: block;
    width: 100%;
    border: 0;
}

iframe.cookie-guard-blocked,
.cookie-guard-iframe-wrapper iframe.cookie-guard-blocked {
    visibility: hidden !important;
}

.cookie-guard-iframe-wrapper.cookie-guard-iframe-unblocked {
    min-height: 0;
    background: transparent;
    border: 0;
    border-radius: inherit;
}

/* Perfect integration with Elementor Google Maps & video embeds */
.elementor-custom-embed > .cookie-guard-iframe-wrapper,
.elementor-widget-google_maps .cookie-guard-iframe-wrapper {
    margin: 0;
    min-height: 0;
    border-radius: inherit;
}

.cookie-guard-iframe-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    padding: 24px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #1e293b;
    overflow-y: auto;
}

.cookie-guard-placeholder-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.cookie-guard-placeholder-title {
    font-size: 17px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.cookie-guard-placeholder-desc {
    font-size: 13.5px;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

.cookie-guard-unblock-button {
    margin-top: 6px;
    padding: 10px 22px;
    background: #4CAF50;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.25);
    transition: all 0.2s ease;
}

.cookie-guard-unblock-button:hover {
    background: #43a047;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.35);
}

.cookie-guard-unblock-button:active {
    transform: translateY(0);
}
