/* ================================================
   RGPD Consent - Axeptio-Inspired Design
   All colors/fonts via CSS custom properties
   ================================================ */

/* Reset scope - only reset box-sizing, margin, font */
#rgpd-consent-banner,
#rgpd-consent-banner *,
#rgpd-preferences-panel,
#rgpd-preferences-panel *,
.rgpd-reopen-btn,
.rgpd-iframe-placeholder,
.rgpd-iframe-placeholder * {
    box-sizing: border-box;
    margin: 0;
    font-family: var(--rgpd-font);
    line-height: 1.5;
}

/* ================================================
   BANNER - Base
   ================================================ */
.rgpd-banner {
    position: fixed;
    z-index: 999999;
    font-size: var(--rgpd-font-size);
    color: var(--rgpd-text);
}

.rgpd-banner__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1;
    cursor: pointer;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.rgpd-banner__container {
    background: var(--rgpd-bg);
    border-radius: var(--rgpd-radius);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 8px 40px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

/* ================================================
   BANNER - Body
   ================================================ */
.rgpd-banner__body {
    padding: 36px 36px 28px;
}

.rgpd-banner__title-group {
    margin-bottom: 16px;
}

.rgpd-banner__subtitle {
    display: block;
    font-size: 0.82em;
    font-weight: 500;
    color: var(--rgpd-text);
    opacity: 0.5;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.rgpd-banner__title {
    font-size: 1.55em;
    font-weight: 800;
    color: var(--rgpd-text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.rgpd-banner__description {
    color: var(--rgpd-text);
    opacity: 0.65;
    font-size: 0.9em;
    line-height: 1.7;
    margin-top: 4px;
}

.rgpd-banner__privacy-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--rgpd-primary);
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.rgpd-banner__privacy-link:hover {
    border-bottom-color: var(--rgpd-primary);
}

/* ================================================
   BANNER - Actions (Axeptio-style row)
   ================================================ */
.rgpd-banner__actions {
    display: flex;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.rgpd-banner__actions .rgpd-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 14px;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 0.88em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: var(--rgpd-font);
    position: relative;
    white-space: nowrap;
}

/* Vertical separators between buttons */
.rgpd-banner__actions .rgpd-btn + .rgpd-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 1px;
    background: rgba(0, 0, 0, 0.08);
}

/* Refuse */
.rgpd-banner__actions .rgpd-btn--refuse-all {
    color: var(--rgpd-text);
    opacity: 0.55;
}

.rgpd-banner__actions .rgpd-btn--refuse-all:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.03);
}

/* Customize */
.rgpd-banner__actions .rgpd-btn--customize {
    color: var(--rgpd-text);
    opacity: 0.75;
}

.rgpd-banner__actions .rgpd-btn--customize:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.03);
}

/* Accept All */
.rgpd-banner__actions .rgpd-btn--accept-all {
    color: var(--rgpd-primary);
    font-weight: 700;
}

.rgpd-banner__actions .rgpd-btn--accept-all:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Focus styles */
.rgpd-banner__actions .rgpd-btn:focus-visible {
    outline: 2px solid var(--rgpd-primary);
    outline-offset: -2px;
    z-index: 1;
}

/* ================================================
   DISPLAY MODES
   ================================================ */

/* Bottom bar - Axeptio-style floating card */
.rgpd-bottom_bar {
    bottom: 28px;
    left: 28px;
}

.rgpd-bottom_bar .rgpd-banner__container {
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
}

/* No overlay for floating card modes */
.rgpd-bottom_bar .rgpd-banner__overlay,
.rgpd-top_bar .rgpd-banner__overlay {
    display: none !important;
}

/* Top bar */
.rgpd-top_bar {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.rgpd-top_bar .rgpd-banner__container {
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Popup center */
.rgpd-popup_center {
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rgpd-popup_center .rgpd-banner__container {
    max-width: 440px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Side panel left */
.rgpd-side_panel_left {
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 20px;
}

.rgpd-side_panel_left .rgpd-banner__container {
    width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* Side panel right */
.rgpd-side_panel_right {
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 20px;
}

.rgpd-side_panel_right .rgpd-banner__container {
    width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* Side panels: stack buttons vertically */
.rgpd-side_panel_left .rgpd-banner__actions,
.rgpd-side_panel_right .rgpd-banner__actions {
    flex-direction: column;
}

.rgpd-side_panel_left .rgpd-banner__actions .rgpd-btn + .rgpd-btn::before,
.rgpd-side_panel_right .rgpd-banner__actions .rgpd-btn + .rgpd-btn::before {
    left: 15%;
    right: 15%;
    top: 0;
    bottom: auto;
    width: auto;
    height: 1px;
}

/* ================================================
   ANIMATIONS
   ================================================ */

/* Slide */
.rgpd-anim-slide.rgpd-bottom_bar .rgpd-banner__container {
    animation: rgpd-slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.rgpd-anim-slide.rgpd-top_bar .rgpd-banner__container {
    animation: rgpd-slide-down 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.rgpd-anim-slide.rgpd-popup_center .rgpd-banner__container {
    animation: rgpd-scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.rgpd-anim-slide.rgpd-side_panel_left .rgpd-banner__container {
    animation: rgpd-slide-right 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.rgpd-anim-slide.rgpd-side_panel_right .rgpd-banner__container {
    animation: rgpd-slide-left 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fade */
.rgpd-anim-fade .rgpd-banner__container {
    animation: rgpd-fade-in 0.4s ease-out;
}

/* Hide animations */
.rgpd-banner.rgpd-hiding .rgpd-banner__container {
    animation: rgpd-fade-out 0.25s ease-in forwards;
}

.rgpd-banner.rgpd-hiding .rgpd-banner__overlay {
    animation: rgpd-fade-out 0.25s ease-in forwards;
}

.rgpd-banner__overlay {
    animation: rgpd-fade-in 0.3s ease-out;
}

@keyframes rgpd-slide-up {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes rgpd-slide-down {
    from { transform: translateY(-40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes rgpd-slide-left {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes rgpd-slide-right {
    from { transform: translateX(-40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes rgpd-scale-in {
    from { transform: scale(0.96) translateY(8px); }
    to { transform: scale(1) translateY(0); }
}

@keyframes rgpd-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rgpd-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ================================================
   PREFERENCES PANEL
   ================================================ */
.rgpd-preferences {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
}

.rgpd-preferences__overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    cursor: pointer;
}

.rgpd-preferences__container {
    background: var(--rgpd-bg);
    border-radius: var(--rgpd-radius);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 4px 16px rgba(0, 0, 0, 0.1);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: rgpd-scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.rgpd-preferences__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 0;
}

.rgpd-preferences__title {
    font-size: 1.3em;
    font-weight: 800;
    color: var(--rgpd-text);
    letter-spacing: -0.02em;
}

.rgpd-preferences__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--rgpd-text);
    opacity: 0.4;
    transition: opacity 0.2s;
    padding: 4px;
    line-height: 1;
    border-radius: 6px;
}

.rgpd-preferences__close:hover {
    opacity: 0.8;
}

.rgpd-preferences__body {
    padding: 16px 28px 20px;
    overflow-y: auto;
    flex: 1;
}

.rgpd-preferences__intro {
    font-size: 0.88em;
    color: var(--rgpd-text);
    opacity: 0.6;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Category items */
.rgpd-pref-category {
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: calc(var(--rgpd-radius) * 0.7);
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.rgpd-pref-category:hover {
    border-color: rgba(0, 0, 0, 0.14);
    background: #f3f4f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.rgpd-pref-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.rgpd-pref-category__info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.rgpd-pref-category__name {
    font-weight: 600;
    font-size: 0.92em;
    color: var(--rgpd-text);
}

.rgpd-pref-category__badge {
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.rgpd-pref-category__chevron {
    width: 16px;
    height: 16px;
    opacity: 0.3;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.rgpd-pref-category__details.open ~ .rgpd-pref-category__header .rgpd-pref-category__chevron,
.rgpd-pref-category__header.is-open .rgpd-pref-category__chevron {
    transform: rotate(180deg);
}

.rgpd-pref-category__details {
    padding: 0 16px 14px;
    display: none;
}

.rgpd-pref-category__details.open {
    display: block;
}

.rgpd-pref-category__description {
    font-size: 0.82em;
    color: var(--rgpd-text);
    opacity: 0.55;
    line-height: 1.65;
}

/* Toggle switch */
.rgpd-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.rgpd-toggle__input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.rgpd-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: background 0.25s;
}

.rgpd-toggle__slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.rgpd-toggle__input:checked + .rgpd-toggle__slider {
    background: var(--rgpd-primary);
}

.rgpd-toggle__input:checked + .rgpd-toggle__slider::before {
    transform: translateX(20px);
}

.rgpd-toggle__input:disabled + .rgpd-toggle__slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Preferences footer - Axeptio style */
.rgpd-preferences__footer {
    display: flex;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.rgpd-preferences__footer .rgpd-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 12px;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--rgpd-font);
    white-space: nowrap;
    position: relative;
}

.rgpd-preferences__footer .rgpd-btn + .rgpd-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 1px;
    background: rgba(0, 0, 0, 0.08);
}

.rgpd-preferences__footer .rgpd-btn--refuse-all {
    color: var(--rgpd-text);
    opacity: 0.55;
}

.rgpd-preferences__footer .rgpd-btn--refuse-all:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.03);
}

.rgpd-preferences__footer .rgpd-btn--save {
    color: var(--rgpd-text);
    opacity: 0.75;
}

.rgpd-preferences__footer .rgpd-btn--save:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.03);
}

.rgpd-preferences__footer .rgpd-btn--accept-all {
    color: var(--rgpd-primary);
    font-weight: 700;
}

.rgpd-preferences__footer .rgpd-btn--accept-all:hover {
    background: rgba(0, 0, 0, 0.03);
}

.rgpd-preferences__footer .rgpd-btn:focus-visible {
    outline: 2px solid var(--rgpd-primary);
    outline-offset: -2px;
    z-index: 1;
}

/* ================================================
   REOPEN BUTTON
   ================================================ */
.rgpd-reopen-btn {
    position: fixed;
    z-index: 999998;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--rgpd-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 3px rgba(255, 255, 255, 0.9);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
    animation: rgpd-reopen-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.rgpd-reopen-btn:hover {
    transform: scale(1.12);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.2),
        0 0 0 3px rgba(255, 255, 255, 0.9);
}

.rgpd-reopen-btn:active {
    transform: scale(0.95);
}

@keyframes rgpd-reopen-pop {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.rgpd-reopen-btn--bottom-left {
    bottom: 20px;
    left: 20px;
}

.rgpd-reopen-btn--bottom-right {
    bottom: 20px;
    right: 20px;
}

/* ================================================
   IFRAME PLACEHOLDER
   ================================================ */
.rgpd-iframe-placeholder {
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: var(--rgpd-radius);
    padding: 40px 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    font-family: var(--rgpd-font);
}

.rgpd-iframe-placeholder__content p {
    color: #6b7280;
    margin-bottom: 12px;
    font-size: 14px;
}

.rgpd-iframe-placeholder .rgpd-btn--accept-category {
    background: var(--rgpd-primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--rgpd-radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--rgpd-font);
    transition: filter 0.2s;
}

.rgpd-iframe-placeholder .rgpd-btn--accept-category:hover {
    filter: brightness(1.08);
}

/* ================================================
   RESPONSIVE
   ================================================ */

/* Tablet */
@media (max-width: 768px) {
    .rgpd-bottom_bar {
        bottom: 12px;
        left: 12px;
        right: 12px;
    }

    .rgpd-bottom_bar .rgpd-banner__container {
        max-width: 100%;
    }

    .rgpd-top_bar {
        top: 12px;
        left: 12px;
        right: 12px;
        transform: none;
    }

    .rgpd-top_bar .rgpd-banner__container {
        max-width: 100%;
    }

    .rgpd-side_panel_left .rgpd-banner__container,
    .rgpd-side_panel_right .rgpd-banner__container {
        width: 85vw;
    }

    .rgpd-preferences__container {
        max-width: 95vw;
        max-height: 90vh;
    }

    .rgpd-banner__body {
        padding: 24px 24px 16px;
    }

    .rgpd-banner__actions .rgpd-btn {
        padding: 14px 8px;
        font-size: 0.85em;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .rgpd-bottom_bar {
        bottom: 0;
        left: 0;
        right: 0;
    }

    .rgpd-bottom_bar .rgpd-banner__container {
        border-radius: var(--rgpd-radius) var(--rgpd-radius) 0 0;
        max-height: 85vh;
    }

    .rgpd-top_bar {
        top: 0;
        left: 0;
        right: 0;
        transform: none;
    }

    .rgpd-top_bar .rgpd-banner__container {
        border-radius: 0 0 var(--rgpd-radius) var(--rgpd-radius);
        max-width: 100%;
    }

    .rgpd-popup_center {
        padding: 0;
        align-items: flex-end;
    }

    .rgpd-popup_center .rgpd-banner__container {
        max-width: 100%;
        border-radius: var(--rgpd-radius) var(--rgpd-radius) 0 0;
        max-height: 85vh;
    }

    .rgpd-side_panel_left .rgpd-banner__container,
    .rgpd-side_panel_right .rgpd-banner__container {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }

    .rgpd-banner__body {
        padding: 22px 20px 16px;
    }

    .rgpd-banner__title {
        font-size: 1.3em;
    }

    .rgpd-banner__description {
        font-size: 0.85em;
    }

    .rgpd-banner__actions .rgpd-btn {
        padding: 13px 6px;
        font-size: 0.82em;
    }

    /* Preferences mobile */
    .rgpd-preferences {
        align-items: flex-end;
        padding: 0;
    }

    .rgpd-preferences__container {
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--rgpd-radius) var(--rgpd-radius) 0 0;
    }

    .rgpd-preferences__header {
        padding: 20px 20px 0;
    }

    .rgpd-preferences__body {
        padding: 12px 20px 16px;
    }

    .rgpd-preferences__footer .rgpd-btn {
        padding: 13px 6px;
        font-size: 0.82em;
    }

    .rgpd-pref-category__header {
        padding: 12px;
    }

    .rgpd-reopen-btn {
        width: 40px;
        height: 40px;
        bottom: 14px;
    }

    .rgpd-reopen-btn--bottom-left {
        left: 14px;
    }

    .rgpd-reopen-btn--bottom-right {
        right: 14px;
    }

    .rgpd-reopen-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ================================================
   ACCESSIBILITY
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    .rgpd-banner__container,
    .rgpd-preferences__container,
    .rgpd-banner__overlay,
    .rgpd-preferences__overlay,
    .rgpd-reopen-btn {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast */
@media (prefers-contrast: high) {
    .rgpd-banner__container,
    .rgpd-preferences__container {
        border: 2px solid var(--rgpd-text);
    }

    .rgpd-banner__actions .rgpd-btn,
    .rgpd-preferences__footer .rgpd-btn {
        border-right: 1px solid var(--rgpd-text);
    }

    .rgpd-pref-category {
        border-width: 2px;
    }
}
