/**
 * ==========================================================================
 * LE COMPTOIR DES ESSENCES — SISTEMA CEREMONIAL DE COOKIES Y CENTRO LEGAL
 * Conforme a AEPD (España), RGPD (UE 2016/679) y LSSI-CE (Ley 34/2002)
 * Estética Canónica de la Maison: Oro #D4AF37, Cristal Ahumado y Cinzel
 * ==========================================================================
 */

/* 1. BANNER FLOTANTE DE CONSENTIMIENTO DE COOKIES */
.lce-cookie-banner {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    width: calc(100% - 40px);
    max-width: 960px;
    z-index: 10005;
    background: rgba(12, 12, 14, 0.94);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(212, 175, 55, 0.38);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85), 0 0 24px rgba(212, 175, 55, 0.12);
    border-radius: 6px;
    padding: 20px 26px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #E2DFD7;
}

.lce-cookie-banner.is-active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.lce-cookie-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.lce-cookie-banner-text {
    flex: 1;
    min-width: 0;
}

.lce-cookie-banner-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #D4AF37;
    margin: 0 0 6px 0;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lce-cookie-banner-title svg {
    width: 15px;
    height: 15px;
    stroke: #D4AF37;
    flex-shrink: 0;
}

.lce-cookie-banner-desc {
    font-size: 12px;
    line-height: 1.55;
    color: #C8C4BA;
    margin: 0;
}

.lce-cookie-banner-desc a {
    color: #D4AF37;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.lce-cookie-banner-desc a:hover {
    color: #F4E8C1;
}

/* Grupo de Botones de Acción (Igualdad de Jerarquía AEPD) */
.lce-cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.lce-cookie-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 10px 18px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-sizing: border-box;
    white-space: nowrap;
    text-align: center;
}

/* Botón Aceptar Todas */
.lce-cookie-btn-accept {
    background: #D4AF37;
    color: #0A0A0C;
    border: 1px solid #D4AF37;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.25);
}

.lce-cookie-btn-accept:hover {
    background: #E8C859;
    border-color: #E8C859;
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.4);
}

/* Botón Rechazar (Misma Prominencia Legal) */
.lce-cookie-btn-reject {
    background: rgba(25, 25, 28, 0.7);
    color: #E2DFD7;
    border: 1px solid rgba(212, 175, 55, 0.45);
}

.lce-cookie-btn-reject:hover {
    background: rgba(212, 175, 55, 0.12);
    border-color: #D4AF37;
    color: #D4AF37;
}

/* Botón Configurar */
.lce-cookie-btn-config {
    background: transparent;
    color: #B5AEA1;
    border: 1px solid transparent;
    text-decoration: underline;
    text-underline-offset: 4px;
    padding: 10px 12px;
}

.lce-cookie-btn-config:hover {
    color: #D4AF37;
    background: rgba(212, 175, 55, 0.08);
    border-radius: 3px;
}

/* ==========================================================================
 * 2. MODAL DE CONFIGURACIÓN GRANULAR DE COOKIES (#lce-cookie-modal)
 * ==========================================================================
 */
.lce-cookie-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: rgba(4, 4, 6, 0.82);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lce-cookie-modal-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.lce-cookie-modal-container {
    background: rgba(14, 14, 17, 0.96);
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(212, 175, 55, 0.15);
    border-radius: 6px;
    width: 100%;
    max-width: 620px;
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transform: translateY(15px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lce-cookie-modal-overlay.is-active .lce-cookie-modal-container {
    transform: translateY(0) scale(1);
}

.lce-cookie-modal-header {
    padding: 22px 26px 16px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.lce-cookie-modal-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #D4AF37;
    margin: 0;
    text-transform: uppercase;
}

.lce-cookie-modal-close {
    background: transparent;
    border: none;
    color: #A39D90;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.lce-cookie-modal-close:hover {
    color: #D4AF37;
}

.lce-cookie-modal-body {
    padding: 20px 26px;
    overflow-y: auto;
    flex: 1;
    color: #DDD9D0;
    font-family: 'Montserrat', sans-serif;
    font-size: 12.5px;
    line-height: 1.6;
}

.lce-cookie-modal-intro {
    margin-bottom: 18px;
    color: #C0BBB0;
    font-size: 12px;
}

/* Categorías de Cookies */
.lce-cookie-category {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-radius: 4px;
    padding: 16px 18px;
    margin-bottom: 12px;
}

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

.lce-cookie-category-name {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 13px;
    font-weight: 600;
    color: #D4AF37;
    letter-spacing: 0.06em;
    margin: 0;
}

.lce-cookie-category-badge {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 2px;
    font-weight: 600;
}

.lce-cookie-category-badge.badge-required {
    background: rgba(212, 175, 55, 0.2);
    color: #E2C76A;
    border: 1px solid rgba(212, 175, 55, 0.4);
}

.lce-cookie-category-desc {
    font-size: 11.5px;
    color: #AEA89C;
    margin: 0;
    line-height: 1.5;
}

/* Toggle Switch Dorado Canónico */
.lce-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.lce-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.lce-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: 0.3s;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lce-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: #DDD9D0;
    transition: 0.3s;
    border-radius: 50%;
}

.lce-switch input:checked + .lce-slider {
    background-color: rgba(212, 175, 55, 0.35);
    border-color: #D4AF37;
}

.lce-switch input:checked + .lce-slider:before {
    transform: translateX(20px);
    background-color: #D4AF37;
}

.lce-switch input:disabled + .lce-slider {
    opacity: 0.7;
    cursor: not-allowed;
}

.lce-cookie-modal-footer {
    padding: 16px 26px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background: rgba(10, 10, 12, 0.98);
}

/* ==========================================================================
 * 3. MODAL CEREMONIAL DE TEXTOS LEGALES (#lce-legal-modal)
 * ==========================================================================
 */
.lce-legal-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    background: rgba(4, 4, 6, 0.85);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lce-legal-modal-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.lce-legal-modal-container {
    background: rgba(14, 14, 17, 0.97);
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.95), 0 0 35px rgba(212, 175, 55, 0.18);
    border-radius: 6px;
    width: 100%;
    max-width: 820px;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transform: translateY(15px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lce-legal-modal-overlay.is-active .lce-legal-modal-container {
    transform: translateY(0) scale(1);
}

.lce-legal-modal-header {
    padding: 18px 24px 0;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    flex-shrink: 0;
    background: rgba(10, 10, 12, 0.98);
}

.lce-legal-modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.lce-legal-modal-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #D4AF37;
    margin: 0;
    text-transform: uppercase;
}

.lce-legal-modal-close {
    background: transparent;
    border: none;
    color: #A39D90;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.lce-legal-modal-close:hover {
    color: #D4AF37;
}

/* Pestañas de Navegación Legal */
.lce-legal-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.lce-legal-tabs::-webkit-scrollbar {
    display: none;
}

.lce-legal-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #A8A295;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.lce-legal-tab-btn:hover {
    color: #E2DFD7;
}

.lce-legal-tab-btn.is-active {
    color: #D4AF37;
    border-bottom-color: #D4AF37;
}

/* Cuerpo de Lectura Legal */
.lce-legal-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 30px;
    font-family: 'Montserrat', sans-serif;
    font-size: 12.5px;
    line-height: 1.7;
    color: #D6D2C8;
}

.lce-legal-tab-content {
    display: none;
}

.lce-legal-tab-content.is-active {
    display: block;
}

.lce-legal-tab-content h3 {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 16px;
    color: #D4AF37;
    letter-spacing: 0.08em;
    margin: 0 0 14px 0;
    text-transform: uppercase;
}

.lce-legal-tab-content h4 {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 13.5px;
    color: #E8C859;
    letter-spacing: 0.06em;
    margin: 18px 0 8px 0;
}

.lce-legal-tab-content p {
    margin: 0 0 12px 0;
}

.lce-legal-tab-content ul {
    margin: 0 0 14px 0;
    padding-left: 20px;
}

.lce-legal-tab-content li {
    margin-bottom: 6px;
}

.lce-legal-table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 4px;
}

.lce-legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    text-align: left;
}

.lce-legal-table th,
.lce-legal-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.lce-legal-table th {
    background: rgba(212, 175, 55, 0.12);
    color: #D4AF37;
    font-family: 'Cinzel', Georgia, serif;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.lce-legal-table tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
 * 4. CALIBRACIÓN RESPONSIVE MULTI-DISPOSITIVO
 * ==========================================================================
 */

/* Móvil Vertical (<= 768px) */
@media screen and (max-width: 768px) {
    .lce-cookie-banner {
        bottom: max(12px, env(safe-area-inset-bottom, 12px));
        width: calc(100% - 24px);
        padding: 16px 18px;
    }

    .lce-cookie-banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .lce-cookie-banner-title {
        font-size: 12.5px;
    }

    .lce-cookie-banner-desc {
        font-size: 11.5px;
        line-height: 1.5;
    }

    .lce-cookie-banner-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .lce-cookie-btn-config {
        grid-column: 1 / -1;
        padding: 6px 10px;
    }

    .lce-cookie-btn {
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10.5px;
    }

    .lce-cookie-modal-container,
    .lce-legal-modal-container {
        max-height: calc(100dvh - 20px);
        height: auto;
    }

    .lce-legal-modal-body {
        padding: 18px 20px;
    }
}

/* Móvil Horizontal (Landscape <= 500px de altura) */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .lce-cookie-banner {
        bottom: max(6px, env(safe-area-inset-bottom, 6px));
        width: calc(100% - 32px);
        max-width: 780px;
        padding: 8px 16px;
        border-radius: 4px;
    }

    .lce-cookie-banner-inner {
        flex-direction: row;
        align-items: center;
        gap: 14px;
    }

    .lce-cookie-banner-title {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .lce-cookie-banner-title svg {
        width: 12px;
        height: 12px;
    }

    .lce-cookie-banner-desc {
        font-size: 10px;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .lce-cookie-banner-actions {
        gap: 6px;
    }

    .lce-cookie-btn {
        padding: 6px 12px;
        font-size: 9.5px;
        letter-spacing: 0.06em;
    }

    .lce-cookie-modal-container,
    .lce-legal-modal-container {
        max-height: calc(100dvh - 12px);
    }

    .lce-cookie-modal-header,
    .lce-legal-modal-header {
        padding: 10px 16px 8px;
    }

    .lce-cookie-modal-body,
    .lce-legal-modal-body {
        padding: 12px 16px;
        font-size: 11px;
    }

    .lce-cookie-category {
        padding: 10px 12px;
        margin-bottom: 8px;
    }

    .lce-cookie-modal-footer {
        padding: 8px 16px;
        gap: 8px;
    }

    .lce-cookie-modal-footer .lce-cookie-btn {
        padding: 6px 14px;
        font-size: 10px;
    }
}
