/* CookieGuard Pro - Frontend Styles */

/* Avada / theme isolation: keep global theme button, heading and form styles from leaking into CookieGuard UI. */
.cgp-cookie-banner,
.cgp-cookie-banner *,
.cgp-banner-overlay,
.cgp-preferences-modal,
.cgp-preferences-modal *,
.cgp-floating-preferences,
.cgp-floating-preferences *,
.cgp-blocked-content,
.cgp-blocked-content *,
.cgp-ccpa-notice,
.cgp-ccpa-notice * {
    box-sizing: border-box;
}

.cgp-cookie-banner,
.cgp-preferences-modal,
.cgp-banner-overlay,
.cgp-floating-preferences,
.cgp-ccpa-notice {
    pointer-events: auto;
}


/* Banner Base */
.cgp-cookie-banner {
    position: fixed !important;
    left: 0;
    right: 0;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    display: none;
}

.cgp-cookie-banner.cgp-banner--visible {
    display: block;
    animation: cgpSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Positions */
.cgp-cookie-banner.cgp-banner--bottom {
    bottom: 0;
}

.cgp-cookie-banner.cgp-banner--top {
    top: 0;
    animation: cgpSlideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cgp-cookie-banner.cgp-banner--center {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: min(92vw, 600px) !important;
    max-width: calc(100vw - 32px) !important;
    transform: translate(-50%, -50%) !important;
}

/* Styles */
.cgp-cookie-banner.cgp-banner--bar {
    left: 0;
    right: 0;
}

.cgp-cookie-banner.cgp-banner--popup {
    left: auto;
    right: 20px;
    bottom: 20px;
    max-width: 420px;
    width: calc(100% - 40px);
}

/* Centered banner must win over bar/popup style rules. */
.cgp-cookie-banner.cgp-banner--center.cgp-banner--bar,
.cgp-cookie-banner.cgp-banner--center.cgp-banner--popup,
.cgp-cookie-banner.cgp-banner--center.cgp-banner--overlay {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: min(92vw, 600px) !important;
    max-width: calc(100vw - 32px) !important;
    transform: translate(-50%, -50%) !important;
}

.cgp-cookie-banner.cgp-banner--center.cgp-banner--visible {
    animation: cgpFadeInCenter 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Themes */
.cgp-cookie-banner.cgp-banner--light {
    background: #ffffff !important;
    color: #1f2937 !important;
    border: 1px solid #e5e7eb;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

.cgp-cookie-banner.cgp-banner--dark {
    background: #1f2937;
    color: #f9fafb;
    border: 1px solid #374151;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
}

/* Banner Content */
.cgp-banner__content {
    padding: 24px 32px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.cgp-banner__icon {
    font-size: 32px;
    flex-shrink: 0;
}

.cgp-banner__text {
    flex: 1;
    min-width: 0;
}

.cgp-banner__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: inherit;
}

.cgp-banner__message {
    margin: 0 0 16px 0;
    opacity: 0.9;
}

.cgp-banner__buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.cgp-btn {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    background: none;
    font-family: inherit;
    line-height: 1.2;
    margin: 0;
}

.cgp-btn--primary {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
}

.cgp-btn--primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.cgp-btn--outline {
    background: transparent !important;
    color: #2563eb !important;
    border: 2px solid #2563eb !important;
}

.cgp-btn--outline:hover {
    background: rgba(37, 99, 235, 0.08);
}

.cgp-btn--link {
    background: transparent !important;
    color: #2563eb !important;
    border: none !important;
    padding: 10px 16px;
}

.cgp-btn--link:hover {
    text-decoration: underline;
}

/* Dark theme buttons */
.cgp-banner--dark .cgp-btn--outline {
    color: #60a5fa;
    border-color: #60a5fa;
}

.cgp-banner--dark .cgp-btn--link {
    color: #60a5fa;
}

/* Overlay */
.cgp-banner-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cgp-banner-overlay.cgp-overlay--visible {
    opacity: 1;
}

/* Preferences Modal */
.cgp-preferences-modal {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cgp-preferences-modal__content {
    background: #ffffff;
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    isolation: isolate;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cgp-preferences-modal__header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #ffffff;
    border-radius: 16px 16px 0 0;
    z-index: 10;
}

.cgp-preferences-modal__header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.cgp-preferences-modal__close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.cgp-preferences-modal__close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.cgp-preferences-modal__body {
    padding: 24px 32px;
}

.cgp-preferences-modal__footer {
    padding: 20px 32px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: #ffffff;
    border-radius: 0 0 16px 16px;
}

/* Category Items */
.cgp-category-item {
    padding: 20px 0;
    border-bottom: 1px solid #f3f4f6;
}

.cgp-category-item:last-child {
    border-bottom: none;
}

.cgp-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.cgp-category-name {
    font-weight: 600;
    font-size: 16px;
    color: #1f2937;
}

.cgp-category-required {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
}

.cgp-category-desc {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

/* Toggle Switch */
.cgp-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.cgp-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 26px;
}

.cgp-slider:before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cgp-toggle input:checked + .cgp-slider {
    background-color: #2563eb;
}

.cgp-toggle input:checked + .cgp-slider:before {
    transform: translateX(22px);
}

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

/* Blocked Content */
.cgp-blocked-content {
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    margin: 24px 0;
}

.cgp-blocked-content__inner {
    max-width: 400px;
    margin: 0 auto;
}

.cgp-blocked-content__icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.cgp-blocked-content p {
    color: #6b7280;
    margin: 0 0 20px 0;
}

/* CCPA Notice */
.cgp-ccpa-notice {
    position: fixed !important;
    bottom: 20px;
    left: 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    max-width: 360px;
    z-index: 999997;
    font-size: 13px;
}

.cgp-ccpa-notice p {
    margin: 0 0 12px 0;
    color: #4b5563;
}


/* Floating preferences button */
.cgp-floating-preferences {
    position: fixed !important;
    z-index: 999997;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #ffffff !important;
    color: #1f2937 !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.cgp-floating-preferences:hover,
.cgp-floating-preferences:focus {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
    outline: none;
}

.cgp-floating-preferences--bottom-left {
    left: 20px;
    bottom: 20px;
}

.cgp-floating-preferences--bottom-right {
    right: 20px;
    bottom: 20px;
}

.cgp-floating-preferences.cgp-floating-preferences--hidden {
    opacity: 0;
    pointer-events: none;
}

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

@keyframes cgpSlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* Responsive */
@media (max-width: 768px) {
    .cgp-banner__content {
        flex-direction: column;
        padding: 20px;
    }

    .cgp-banner__buttons {
        width: 100%;
    }

    .cgp-btn {
        flex: 1;
        min-width: 0;
    }

    .cgp-cookie-banner.cgp-banner--popup {
        right: 10px;
        bottom: 10px;
        max-width: calc(100% - 20px);
    }

    .cgp-floating-preferences {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .cgp-floating-preferences--bottom-left {
        left: 12px;
        bottom: 12px;
    }

    .cgp-floating-preferences--bottom-right {
        right: 12px;
        bottom: 12px;
    }


    .cgp-cookie-banner.cgp-banner--center,
    .cgp-cookie-banner.cgp-banner--center.cgp-banner--bar,
    .cgp-cookie-banner.cgp-banner--center.cgp-banner--popup,
    .cgp-cookie-banner.cgp-banner--center.cgp-banner--overlay {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }

    .cgp-preferences-modal__content {
        max-height: 95vh;
    }

    .cgp-preferences-modal__header,
    .cgp-preferences-modal__body,
    .cgp-preferences-modal__footer {
        padding: 16px 20px;
    }
}

/* Body class when banner active */
body.cgp-banner-active {
    padding-bottom: 0 !important;
}

/* Print styles */
@media print {
    .cgp-cookie-banner,
    .cgp-banner-overlay,
    .cgp-preferences-modal,
    .cgp-floating-preferences {
        display: none !important;
    }
}
