/* ==========================================================================
   GDPR Cookie Consent – Plugin Joomla 5
   Colores controlados por variables CSS inyectadas desde el admin
   Todos los selectores bajo .cookie-consent o .cookie-settings-btn
   para evitar conflictos con el template o extensiones de terceros
   ========================================================================== */

/* Banner – contenedor fixed */
.cookie-consent {
    position: fixed;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
    transform: translateY(12px);
}
.cookie-consent.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0s;
}

/* Posiciones */
.cc-pos-bottom-left {
    bottom: 20px;
    left: 20px;
}
.cc-pos-bottom-right {
    bottom: 20px;
    right: 20px;
}
.cc-pos-center {
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    transform: none;
}
.cc-pos-center.is-visible {
    transform: none;
}
.cc-pos-center .cookie-consent-panel {
    margin: auto;
}

/* Panel – tarjeta flotante */
.cookie-consent .cookie-consent-panel {
    width: 380px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

.cookie-consent .cookie-consent-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.cookie-consent .cookie-consent-content > * + * {
    margin-top: 14px;
}

/* Título */
.cookie-consent .cookie-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
}
.cookie-consent .cookie-title::before {
    content: '\1F36A ';
}

/* Descripción */
.cookie-consent .cookie-description {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #6b7280;
}

/* Opciones */
.cookie-consent .cookie-options {
    display: flex;
    flex-direction: column;
}
.cookie-consent .cookie-option {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}
.cookie-consent .cookie-option:last-child {
    border-bottom: none;
}
.cookie-consent .cookie-option-header {
    flex: 1;
}

/* Label */
.cookie-consent .cookie-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    min-height: 44px;
}
.cookie-consent .cookie-label > * + * {
    margin-left: 10px;
}
.cookie-consent .cookie-label input[type="checkbox"].cookie-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.cookie-consent .cookie-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    flex: 1;
}
.cookie-consent .cookie-required {
    font-size: 10px;
    font-weight: 500;
    color: #9ca3af;
}

/* Toggle switch (renombrado de .checkmark a .cc-toggle) */
.cookie-consent .cc-toggle {
    position: relative;
    display: block;
    width: 40px;
    height: 24px;
    min-width: 40px;
    background: #d1d5db;
    border-radius: 24px;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}
.cookie-consent .cc-toggle::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.cookie-consent .cookie-label input[type="checkbox"]:checked + .cc-toggle {
    background: var(--cc-color-primary, #00aeef);
}
.cookie-consent .cookie-label input[type="checkbox"]:checked + .cc-toggle::after {
    transform: translateX(16px);
}
.cookie-consent .cookie-label input[type="checkbox"]:focus-visible + .cc-toggle {
    outline: 2px solid var(--cc-color-primary, #00aeef);
    outline-offset: 2px;
}

/* Técnicas – ocultar checkbox disabled */
.cookie-consent .cookie-label input[type="checkbox"][disabled] {
    display: none;
}

/* Botones */
.cookie-consent .cookie-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.cookie-consent .cookie-actions > * + * {
    margin-left: 6px;
}
.cookie-consent .cookie-actions > *:nth-child(3) {
    margin-left: 0;
    margin-top: 6px;
}
.cookie-consent .cookie-btn {
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: center;
    line-height: 1.3;
    font-family: inherit;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cookie-consent .cookie-btn:focus-visible {
    outline: 2px solid var(--cc-color-primary, #00aeef);
    outline-offset: 2px;
}

.cookie-consent .cookie-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}
.cookie-consent .cookie-btn-secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

.cookie-consent .cookie-btn-primary {
    background: var(--cc-color-secondary, #2c3038);
    color: var(--cc-color-secondary-text, #dde4ed);
}
.cookie-consent .cookie-btn-primary:hover {
    background: var(--cc-color-secondary, #2c3038);
    filter: brightness(1.2);
}

/* Aceptar todas – fila completa */
.cookie-consent .cookie-btn-accent {
    grid-column: 1 / -1;
    background: var(--cc-color-primary, #00aeef);
    color: #fff;
}
.cookie-consent .cookie-btn-accent:hover {
    background: var(--cc-color-primary-hover, #0094cc);
}

/* Footer */
.cookie-consent .cookie-footer {
    text-align: center;
}
.cookie-consent .cookie-policy-link {
    font-size: 11px;
    color: #9ca3af;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}
.cookie-consent .cookie-policy-link:hover {
    color: var(--cc-color-primary, #00aeef);
}

/* Botón flotante de configuración */
.cookie-settings-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99999;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--cc-color-secondary, #2c3038);
    color: var(--cc-color-secondary-text, #dde4ed);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: opacity 0.25s, transform 0.25s, background 0.2s;
    padding: 0;
    opacity: 0;
    transform: scale(0.8);
}
.cookie-settings-btn.is-visible {
    opacity: 1;
    transform: scale(1);
}
.cookie-settings-btn:hover {
    background: var(--cc-color-primary, #00aeef);
    transform: scale(1.08);
}
.cookie-settings-btn:focus-visible {
    outline: 2px solid var(--cc-color-primary, #00aeef);
    outline-offset: 3px;
}
.cookie-settings-btn svg {
    width: 20px;
    height: 20px;
}

/* ── Responsive ── */
@media (max-width: 420px) {
    .cookie-consent .cookie-consent-panel {
        width: auto;
        max-width: calc(100vw - 24px);
    }
    .cookie-consent .cookie-consent-content {
        padding: 16px;
    }
    .cookie-consent .cookie-consent-content > * + * {
        margin-top: 12px;
    }
    .cc-pos-bottom-left,
    .cc-pos-bottom-right {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    .cookie-settings-btn {
        bottom: 12px;
        left: 12px;
    }
}
