/**
 * Marina López Psicología - Cookies & GDPR
 * Frontend Styles
 * Version: 1.0.0
 *
 * Paleta corporativa:
 *   Principal  → #683844  (marrón rosáceo: títulos, botones primarios, acentos)
 *   Secundario → #345552  (verde azulado: botón flotante, hover, detalles)
 *   Fondo      → #FFFFFF  (blanco: fondo de banner y modal)
 *   Texto      → #2D2D2D  (gris oscuro neutro)
 *   Claro      → #e9e8e6  (beige claro: fondos suaves, powered bar)
 *   Borde      → #d6d4d1  (beige medio: bordes de tarjetas)
 */

/* ========================================
   Variables CSS
   ======================================== */
:root {
    --mlcg-primary:    #683844;
    --mlcg-secondary:  #345552;
    --mlcg-background: #FFFFFF;
    --mlcg-text:       #2D2D2D;
    --mlcg-light:      #e9e8e6;
    --mlcg-border:     #d6d4d1;
    --mlcg-shadow:     rgba(104, 56, 68, 0.15);
    --mlcg-overlay:    rgba(0, 0, 0, 0.5);
}

/* ========================================
   Banner de Cookies
   ======================================== */
.mlcg-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    background: var(--mlcg-background);
    border-top: 4px solid var(--mlcg-primary);
    box-shadow: 0 -4px 20px var(--mlcg-shadow);
    animation: mlcgSlideUp 0.5s ease-out;
}

.mlcg-banner-bottom {
    bottom: 0;
}

.mlcg-banner-top {
    top: 0;
    border-top: none;
    border-bottom: 4px solid var(--mlcg-primary);
    box-shadow: 0 4px 20px var(--mlcg-shadow);
    animation: mlcgSlideDown 0.5s ease-out;
}

.mlcg-banner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.mlcg-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex: 1;
}

.mlcg-banner-icon {
    flex-shrink: 0;
    color: var(--mlcg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mlcg-banner-text h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--mlcg-primary);
}

.mlcg-banner-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #4B5563;
}

.mlcg-banner-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

/* ========================================
   Botones
   ======================================== */
.mlcg-btn,
.mlcg-banner .mlcg-btn,
.mlcg-modal .mlcg-btn,
button.mlcg-btn,
button[id^="mlcg-btn"],
button[id^="mlcg-modal"] {
    padding: 18px 32px !important;
    border: 1px solid transparent !important;
    border-radius: 30px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    outline: none !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

.mlcg-btn:focus,
.mlcg-banner .mlcg-btn:focus,
.mlcg-modal .mlcg-btn:focus,
button.mlcg-btn:focus,
button[id^="mlcg-btn"]:focus,
button[id^="mlcg-modal"]:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(104, 56, 68, 0.25) !important;
}

/* Botón primario: marrón rosáceo corporativo */
.mlcg-btn-primary {
    background: var(--mlcg-primary) !important;
    color: #FFFFFF !important;
    border-color: var(--mlcg-primary) !important;
}

.mlcg-btn-primary:hover {
    background: #7d4454 !important;
    border-color: #7d4454 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(104, 56, 68, 0.35) !important;
}

/* Botón secundario: verde azulado corporativo */
.mlcg-btn-secondary {
    background: var(--mlcg-secondary) !important;
    color: #FFFFFF !important;
    border-color: var(--mlcg-secondary) !important;
}

.mlcg-btn-secondary:hover {
    background: #274340 !important;
    border-color: #274340 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 85, 82, 0.35) !important;
}

/* Botón outline: borde verde azulado */
.mlcg-btn-outline {
    background: transparent !important;
    color: var(--mlcg-secondary) !important;
    border: 2px solid var(--mlcg-secondary) !important;
}

.mlcg-btn-outline:hover {
    background: var(--mlcg-secondary) !important;
    color: #FFFFFF !important;
    border-color: var(--mlcg-secondary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 85, 82, 0.35) !important;
}

/* ========================================
   Modal de Preferencias
   ======================================== */
.mlcg-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mlcg-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mlcg-overlay);
    animation: mlcgFadeIn 0.3s ease-out;
}

.mlcg-modal-container {
    position: relative;
    background: var(--mlcg-background);
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: mlcgScaleIn 0.3s ease-out;
}

.mlcg-modal-header {
    padding: 30px 30px 20px;
    border-bottom: 2px solid var(--mlcg-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mlcg-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--mlcg-primary);
    flex: 1;
    padding-right: 20px;
}

.mlcg-modal-close {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.mlcg-modal-close:hover {
    background: var(--mlcg-light);
    color: var(--mlcg-primary);
}

.mlcg-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.mlcg-modal-intro {
    margin: 0 0 15px 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--mlcg-text);
}

.mlcg-modal-description {
    margin: 0 0 25px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #6B7280;
}

.mlcg-modal-description a {
    color: var(--mlcg-secondary);
    text-decoration: none;
    font-weight: 600;
}

.mlcg-modal-description a:hover {
    text-decoration: underline;
}

/* ========================================
   Categorías de Cookies
   ======================================== */
.mlcg-categories {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mlcg-category {
    border: 1px solid var(--mlcg-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    background: white;
}

.mlcg-category:hover {
    border-color: var(--mlcg-primary);
    box-shadow: 0 2px 4px rgba(104, 56, 68, 0.08);
}

.mlcg-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mlcg-category-header:hover {
    background: #faf9f8;
}

.mlcg-category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    user-select: none;
}

.mlcg-category-name {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--mlcg-text) !important;
    line-height: 1.4 !important;
    font-family: inherit !important;
}

.mlcg-chevron {
    transition: transform 0.3s ease;
    color: #9CA3AF;
    flex-shrink: 0;
}

.mlcg-category.active .mlcg-chevron {
    transform: rotate(180deg);
    color: var(--mlcg-primary);
}

.mlcg-category-switch {
    flex-shrink: 0;
}

/* Etiqueta "Siempre activas" con color primario de Marina */
.mlcg-always-active {
    font-size: 13px;
    font-weight: 600;
    color: var(--mlcg-primary);
    padding: 6px 12px;
    background: rgba(104, 56, 68, 0.08);
    border-radius: 6px;
}

/* Switch Toggle */
.mlcg-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

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

.mlcg-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

/* Switch activo: color secundario (verde azulado) */
.mlcg-switch input:checked + .mlcg-switch-slider {
    background-color: var(--mlcg-secondary);
}

.mlcg-switch input:checked + .mlcg-switch-slider:before {
    transform: translateX(24px);
}

.mlcg-category-content {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--mlcg-border);
}

.mlcg-category-description {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #4B5563;
}

.mlcg-cookies-list h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--mlcg-text);
}

.mlcg-cookies-list ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mlcg-cookies-list li {
    padding: 8px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #6B7280;
    border-bottom: 1px solid #F3F4F6;
}

.mlcg-cookies-list li:last-child {
    border-bottom: none;
}

.mlcg-cookies-list strong {
    color: var(--mlcg-text);
    font-weight: 600;
}

/* ========================================
   Footer del Modal
   ======================================== */
.mlcg-modal-footer {
    padding: 20px 30px;
    border-top: 2px solid var(--mlcg-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.mlcg-modal-powered {
    padding: 15px 30px;
    background: var(--mlcg-light);
    text-align: center;
}

.mlcg-modal-powered p {
    margin: 0;
    font-size: 12px;
    color: #6B7280;
}

.mlcg-modal-powered strong {
    color: var(--mlcg-primary);
}

/* ========================================
   Botón Flotante
   ======================================== */
.mlcg-floating-btn {
    position: fixed;
    z-index: 999998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--mlcg-secondary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    box-shadow: 0 4px 16px var(--mlcg-shadow);
    transition: all 0.3s ease;
}

.mlcg-floating-btn:hover {
    transform: scale(1.1);
    background: var(--mlcg-primary);
    box-shadow: 0 6px 24px rgba(104, 56, 68, 0.4);
}

.mlcg-floating-btn-bottom-left {
    bottom: 20px;
    left: 20px;
}

.mlcg-floating-btn-bottom-right {
    bottom: 20px;
    right: 20px;
}

.mlcg-floating-btn-top-left {
    top: 20px;
    left: 20px;
}

.mlcg-floating-btn-top-right {
    top: 20px;
    right: 20px;
}

/* ========================================
   Animaciones
   ======================================== */
@keyframes mlcgSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

@keyframes mlcgScaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .mlcg-banner-container {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
    }

    .mlcg-banner-actions {
        flex-direction: column;
        width: 100%;
    }

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

    .mlcg-modal-container {
        max-height: 95vh;
        margin: 10px;
    }

    .mlcg-modal-header,
    .mlcg-modal-body,
    .mlcg-modal-footer,
    .mlcg-modal-powered {
        padding-left: 20px;
        padding-right: 20px;
    }

    .mlcg-modal-footer {
        flex-direction: column;
    }

    .mlcg-floating-btn {
        width: 48px;
        height: 48px;
    }

    .mlcg-floating-btn-bottom-left,
    .mlcg-floating-btn-bottom-right {
        bottom: 15px;
    }

    .mlcg-floating-btn-bottom-left {
        left: 15px;
    }

    .mlcg-floating-btn-bottom-right {
        right: 15px;
    }
}

/* ========================================
   Utilidades
   ======================================== */
.mlcg-hidden {
    display: none !important;
}

.mlcg-fade-out {
    animation: mlcgFadeOut 0.3s ease-out forwards;
}

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

/* ========================================
   Accesibilidad: Texto oculto visualmente
   Solo visible para lectores de pantalla
   ======================================== */
.mlcg-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
