/**
 * CMC Cookie Consent - Estilos
 * CompramosTuCoche.com - 2025
 * Colores: Rojo #FF0000, Blanco #FFF, Negro #000
 */

/* Reset y base */
.cmc-cc *,
.cmc-cc *::before,
.cmc-cc *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Contenedor principal */
.cmc-cc {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cmc-cc-visible {
    opacity: 1;
    visibility: visible;
}

.cmc-cc-hiding {
    opacity: 0;
    visibility: hidden;
}

/* Backdrop sutil */
.cmc-cc-backdrop {
    display: none;
}

/* Container del banner */
.cmc-cc-container {
    position: relative;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    margin: 0 auto;
    border-top: 2px solid #FF0000;
}

/* Vista principal */
.cmc-cc-main {
    padding: 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* Header con icono */
.cmc-cc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.cmc-cc-icon {
    font-size: 18px;
    color: #FF0000;
}

.cmc-cc-title {
    font-size: 14px;
    font-weight: 700;
    color: #000;
    margin: 0;
    white-space: nowrap;
}

/* Texto */
.cmc-cc-text {
    color: #555;
    margin: 0;
    font-size: 13px;
    flex: 1;
    min-width: 200px;
}

/* Botones */
.cmc-cc-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
}

.cmc-cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.cmc-cc-btn:focus {
    outline: 2px solid #FF0000;
    outline-offset: 2px;
}

/* Boton primario - Aceptar */
.cmc-cc-btn-primary {
    background: #FF0000;
    color: #fff;
}

.cmc-cc-btn-primary i {
    color: #fff !important;
}

.cmc-cc-btn-primary:hover {
    background: #CC0000;
}

.cmc-cc-btn-primary:hover i {
    color: #fff !important;
}

/* Boton secundario - Rechazar */
.cmc-cc-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.cmc-cc-btn-secondary:hover {
    background: #e0e0e0;
}

/* Boton outline - Configurar */
.cmc-cc-btn-outline {
    background: transparent;
    color: #333;
    border: 2px solid #ddd;
}

.cmc-cc-btn-outline:hover {
    border-color: #FF0000;
    color: #FF0000;
}

/* Link de mas info - oculto en vista compacta */
.cmc-cc-link {
    display: none;
}

/* ========================================
   Panel de preferencias
   ======================================== */
.cmc-cc-preferences {
    padding: 0;
    max-width: 600px;
    margin: 0 auto;
}

.cmc-cc-pref-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.cmc-cc-back,
.cmc-cc-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    font-size: 16px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmc-cc-back:hover,
.cmc-cc-close:hover {
    background: #f0f0f0;
    color: #000;
}

.cmc-cc-close {
    margin-left: auto;
}

.cmc-cc-pref-header .cmc-cc-title {
    font-size: 16px;
    flex: 1;
}

/* Categorias */
.cmc-cc-categories {
    padding: 8px 20px;
    max-height: 300px;
    overflow-y: auto;
}

.cmc-cc-category {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cmc-cc-category:last-child {
    border-bottom: none;
}

.cmc-cc-cat-info {
    flex: 1;
}

.cmc-cc-cat-name {
    display: block;
    font-weight: 600;
    color: #000;
    margin-bottom: 4px;
    cursor: pointer;
}

.cmc-cc-required {
    font-size: 12px;
    color: #666;
    font-weight: 400;
}

.cmc-cc-cat-desc {
    font-size: 13px;
    color: #666;
    margin: 0;
}

/* Toggle switch */
.cmc-cc-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.cmc-cc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cmc-cc-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    border-radius: 26px;
    transition: all 0.3s ease;
}

.cmc-cc-toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cmc-cc-toggle input:checked + .cmc-cc-toggle-slider {
    background-color: #FF0000;
}

.cmc-cc-toggle input:checked + .cmc-cc-toggle-slider::before {
    transform: translateX(22px);
}

.cmc-cc-toggle input:disabled + .cmc-cc-toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.cmc-cc-toggle input:focus + .cmc-cc-toggle-slider {
    box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.3);
}

/* Acciones en preferencias */
.cmc-cc-actions-pref {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    justify-content: flex-end;
    margin-bottom: 0;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .cmc-cc-main {
        padding: 14px 16px;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .cmc-cc-header {
        justify-content: center;
    }

    .cmc-cc-title {
        font-size: 15px;
    }

    .cmc-cc-text {
        text-align: center;
        font-size: 12px;
        line-height: 1.4;
    }

    .cmc-cc-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .cmc-cc-btn {
        flex: 1;
        min-width: 90px;
        padding: 10px 8px;
        font-size: 12px;
        justify-content: center;
    }

    /* Ocultar iconos en móvil para ahorrar espacio */
    .cmc-cc-actions .cmc-cc-btn i {
        display: none;
    }

    .cmc-cc-preferences {
        max-width: 100%;
    }

    .cmc-cc-categories {
        max-height: 45vh;
        padding: 8px 16px;
    }

    .cmc-cc-category {
        padding: 12px 0;
    }

    .cmc-cc-pref-header {
        padding: 12px 16px;
    }

    .cmc-cc-actions-pref {
        flex-direction: row;
        justify-content: stretch;
        gap: 8px;
    }

    .cmc-cc-actions-pref .cmc-cc-btn {
        flex: 1;
    }
}

/* ========================================
   Boton flotante para reabrir preferencias
   ======================================== */
.cmc-cc-reopen {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: #FF0000;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.cmc-cc-reopen i,
.cmc-cc-reopen i:hover {
    color: #fff !important;
}

.cmc-cc-reopen:hover {
    transform: scale(1.1);
    background: #CC0000;
}

.cmc-cc-reopen:hover i {
    color: #fff !important;
}

/* ========================================
   Accesibilidad
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .cmc-cc,
    .cmc-cc *,
    .cmc-cc *::before,
    .cmc-cc *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Focus visible para navegacion con teclado */
.cmc-cc-btn:focus-visible,
.cmc-cc-toggle input:focus-visible + .cmc-cc-toggle-slider,
.cmc-cc-back:focus-visible,
.cmc-cc-close:focus-visible {
    outline: 3px solid #FF0000;
    outline-offset: 2px;
}

/* Dark mode support (si el user lo tiene activado) */
@media (prefers-color-scheme: dark) {
    /* Mantenemos fondo blanco para consistency con la marca */
}
