/**
 * P4U Cookie Consent - Styles
 * Adaptive light/dark theme via inline colors from admin config
 * Supports: bottom, top, popup, corner-left, corner-right positions
 */

/* Banner - base (bottom position default) */
.p4u-cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.10);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* =========================================================================
   Position variants
   ========================================================================= */

/* Top bar */
.p4u-cookie-banner--top {
    bottom: auto;
    top: 0;
    border-top: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
}

/* Center popup */
.p4u-cookie-banner--popup {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    max-width: 600px;
    width: calc(100% - 40px);
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.20);
}

/* Bottom-left corner */
.p4u-cookie-banner--corner-left {
    bottom: 20px;
    left: 20px;
    right: auto;
    max-width: 420px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Bottom-right corner */
.p4u-cookie-banner--corner-right {
    bottom: 20px;
    right: 20px;
    left: auto;
    max-width: 420px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Popup overlay */
.p4u-cookie-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    backdrop-filter: blur(2px);
}

/* =========================================================================
   Animations
   ========================================================================= */

/* Slide up (for bottom position) */
@keyframes p4u-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Slide down out (for bottom position hide) */
@keyframes p4u-slide-down-out {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

/* Slide down in (for top position) */
@keyframes p4u-slide-down-in {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Slide up out (for top position hide) */
@keyframes p4u-slide-up-out {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

/* Fade in */
@keyframes p4u-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Fade out */
@keyframes p4u-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Scale in (for popup) */
@keyframes p4u-scale-in {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Scale out (for popup) */
@keyframes p4u-scale-out {
    from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    to { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

/* Animation classes */
.p4u-cookie-banner--slide-up { animation: p4u-slide-up 0.4s ease-out forwards; }
.p4u-cookie-banner--slide-down-out { animation: p4u-slide-down-out 0.3s ease-in forwards; }
.p4u-cookie-banner--slide-down-in { animation: p4u-slide-down-in 0.4s ease-out forwards; }
.p4u-cookie-banner--slide-up-out { animation: p4u-slide-up-out 0.3s ease-in forwards; }
.p4u-cookie-banner--fade-in { animation: p4u-fade-in 0.4s ease-out forwards; }
.p4u-cookie-banner--fade-out { animation: p4u-fade-out 0.3s ease-in forwards; }
.p4u-cookie-banner--scale-in { animation: p4u-scale-in 0.35s ease-out forwards; }
.p4u-cookie-banner--scale-out { animation: p4u-scale-out 0.25s ease-in forwards; }

/* =========================================================================
   Banner inner layout
   ========================================================================= */

.p4u-cookie-banner__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

/* Corner and popup: stack vertically */
.p4u-cookie-banner--corner-left .p4u-cookie-banner__inner,
.p4u-cookie-banner--corner-right .p4u-cookie-banner__inner,
.p4u-cookie-banner--popup .p4u-cookie-banner__inner {
    flex-direction: column;
    align-items: stretch;
    padding: 24px;
    gap: 16px;
}

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

.p4u-cookie-banner__text {
    margin: 0;
    opacity: 0.85;
    letter-spacing: -0.01em;
}

.p4u-cookie-banner__link {
    text-decoration: none;
    font-weight: 600;
    opacity: 0.8;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
    transition: opacity 0.2s;
}

.p4u-cookie-banner__link:hover {
    opacity: 1;
}

.p4u-cookie-banner__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Corner: stack buttons vertically */
.p4u-cookie-banner--corner-left .p4u-cookie-banner__actions,
.p4u-cookie-banner--corner-right .p4u-cookie-banner__actions {
    flex-direction: column;
}

/* =========================================================================
   Buttons
   ========================================================================= */

.p4u-cookie-btn {
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.p4u-cookie-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.p4u-cookie-btn:active {
    transform: translateY(0);
    filter: brightness(1);
}

/* Primary button (Accept all) */
.p4u-cookie-btn--accept {
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.p4u-cookie-btn--accept:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

/* Secondary button (Reject) */
.p4u-cookie-btn--reject {
    border: 1.5px solid transparent;
}

.p4u-cookie-btn--reject:hover {
    filter: brightness(0.92);
}

/* Settings toggle button (text style) */
.p4u-cookie-btn--settings {
    background: transparent;
    color: inherit;
    opacity: 0.65;
    padding: 12px 16px;
    font-weight: 600;
}

.p4u-cookie-btn--settings:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none;
    transform: none;
    filter: none;
}

/* Save settings button */
.p4u-cookie-btn--save {
    border: 1.5px solid transparent;
}

.p4u-cookie-btn--save:hover {
    filter: brightness(0.92);
}

/* =========================================================================
   Settings panel
   ========================================================================= */

.p4u-cookie-settings {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.p4u-cookie-settings__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* Corner: tighter padding */
.p4u-cookie-banner--corner-left .p4u-cookie-settings__inner,
.p4u-cookie-banner--corner-right .p4u-cookie-settings__inner {
    padding: 18px 24px;
}

.p4u-cookie-settings__title {
    margin: 0 0 18px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.p4u-cookie-settings__excerpt {
    margin: 0 0 16px;
    opacity: 0.6;
    font-size: 13px;
    line-height: 1.5;
    font-style: italic;
}

.p4u-cookie-settings__actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Corner: stack actions */
.p4u-cookie-banner--corner-left .p4u-cookie-settings__actions,
.p4u-cookie-banner--corner-right .p4u-cookie-settings__actions {
    flex-direction: column;
}

/* =========================================================================
   Cookie categories
   ========================================================================= */

.p4u-cookie-category {
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.p4u-cookie-category:last-of-type {
    border-bottom: none;
}

.p4u-cookie-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.p4u-cookie-category__label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
    font-size: 15px;
}

.p4u-cookie-category__label input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.p4u-cookie-category__label input[type="checkbox"]:checked {
    background: #7c3aed;
    border-color: #7c3aed;
}

.p4u-cookie-category__label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.p4u-cookie-category__label input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: default;
}

.p4u-cookie-category__badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.p4u-cookie-category__badge--always {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.p4u-cookie-category__desc {
    margin: 6px 0 0 30px;
    opacity: 0.55;
    font-size: 13px;
    line-height: 1.5;
}

/* =========================================================================
   Floating cookie icon
   ========================================================================= */

.p4u-cookie-icon {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99998;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s, box-shadow 0.2s;
}

.p4u-cookie-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

/* =========================================================================
   Mobile responsive
   ========================================================================= */

@media (max-width: 768px) {
    .p4u-cookie-banner__inner {
        flex-direction: column;
        align-items: stretch;
        padding: 18px 20px;
        gap: 14px;
    }

    .p4u-cookie-banner__text {
        font-size: 13.5px;
    }

    .p4u-cookie-banner__actions {
        justify-content: stretch;
    }

    .p4u-cookie-btn {
        flex: 1;
        text-align: center;
        padding: 12px 16px;
        font-size: 13px;
    }

    .p4u-cookie-btn--settings {
        flex: 0;
    }

    .p4u-cookie-settings__inner {
        padding: 18px 20px;
    }

    .p4u-cookie-category__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .p4u-cookie-icon {
        bottom: 16px;
        left: 16px;
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    /* Corner variants: full width on mobile */
    .p4u-cookie-banner--corner-left,
    .p4u-cookie-banner--corner-right {
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
        border-radius: 0;
    }

    /* Popup: wider on mobile */
    .p4u-cookie-banner--popup {
        width: calc(100% - 24px);
        max-width: none;
    }
}
