/**
 * Custom styles for Cookie Consent - Senzia.care
 * Adapted to match Senzia brand colors and design
 */

:root {
    --cc-primary-color: #38bdf8;      /* sky-400 - primary brand color */
    --cc-primary-hover: #0ea5e9;      /* sky-500 - hover state */
    --cc-secondary-color: #4e598c;    /* brand purple from footer */
    --cc-text-color: #404040;         /* neutral-700 */
    --cc-bg-color: #ffffff;
    --cc-border-radius: 0.75rem;      /* rounded-xl like buttons */
    --cc-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --cc-bg-color: #1f2937;
        --cc-text-color: #f3f4f6;
    }
}

/* Consent Modal (main banner) */
#cc-main .cm {
    background: var(--cc-bg-color);
    color: var(--cc-text-color);
    border-radius: var(--cc-border-radius);
    box-shadow: var(--cc-shadow);
    font-family: 'Noto Sans', sans-serif;
    padding: 1.5rem;
}

#cc-main .cm__title {
    color: var(--cc-text-color);
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

#cc-main .cm__desc {
    color: var(--cc-text-color);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Primary button - Match Senzia's sky-400 buttons */
#cc-main .cm__btn.cm__btn--primary {
    background: var(--cc-primary-color);
    border-color: var(--cc-primary-color);
    color: white;
    border-radius: calc(var(--cc-border-radius) / 1.2);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
}

#cc-main .cm__btn.cm__btn--primary:hover {
    background: var(--cc-primary-hover);
    border-color: var(--cc-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* Secondary button */
#cc-main .cm__btn.cm__btn--secondary {
    background: transparent;
    border: 2px solid var(--cc-secondary-color);
    color: var(--cc-secondary-color);
    border-radius: calc(var(--cc-border-radius) / 1.2);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
}

#cc-main .cm__btn.cm__btn--secondary:hover {
    background: var(--cc-secondary-color);
    color: white;
    transform: translateY(-2px);
}

/* Links in modal */
#cc-main .cc-link {
    color: var(--cc-primary-color);
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

#cc-main .cc-link:hover {
    color: var(--cc-primary-hover);
}

/* Settings Modal */
#cc-main .pm {
    background: var(--cc-bg-color);
    color: var(--cc-text-color);
    font-family: 'Noto Sans', sans-serif;
    border-radius: var(--cc-border-radius);
    max-width: 42rem;
}

#cc-main .pm__header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#cc-main .pm__title {
    color: var(--cc-text-color);
    font-weight: 700;
    font-size: 1.5rem;
}

#cc-main .pm__close-btn {
    color: var(--cc-text-color);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

#cc-main .pm__close-btn:hover {
    opacity: 1;
}

/* Settings sections */
#cc-main .pm__section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

#cc-main .pm__section-title {
    color: var(--cc-text-color);
    font-weight: 600;
    font-size: 1.1rem;
}

#cc-main .pm__section-desc {
    color: var(--cc-text-color);
    opacity: 0.8;
    line-height: 1.6;
    font-size: 0.9rem;
}

/* Toggle switch */
#cc-main .sc__toggle-wrapper {
    margin-left: auto;
}

#cc-main .sc__toggle-checkbox:checked ~ .sc__toggle-switch {
    background: var(--cc-primary-color);
}

#cc-main .sc__toggle-checkbox:checked ~ .sc__toggle-switch:before {
    transform: translateX(1.25rem);
}

#cc-main .sc__toggle-switch {
    background: #94a3b8;
    border-radius: 9999px;
    width: 2.75rem;
    height: 1.5rem;
    position: relative;
    transition: background 0.3s ease;
}

#cc-main .sc__toggle-switch:before {
    content: '';
    position: absolute;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: white;
    top: 0.1875rem;
    left: 0.1875rem;
    transition: transform 0.3s ease;
}

/* Readonly toggle (necessary cookies) */
#cc-main .sc__toggle-checkbox:disabled ~ .sc__toggle-switch {
    background: var(--cc-secondary-color);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Cookie table */
#cc-main .sc__cookie-table-container {
    margin-top: 1rem;
}

#cc-main .sc__cookie-table {
    background: #f8fafc;
    border-radius: calc(var(--cc-border-radius) / 2);
    overflow: hidden;
    width: 100%;
    border-collapse: collapse;
}

#cc-main .sc__cookie-table th {
    background: #e2e8f0;
    color: var(--cc-text-color);
    font-weight: 600;
    padding: 0.75rem;
    text-align: left;
    font-size: 0.875rem;
}

#cc-main .sc__cookie-table td {
    padding: 0.75rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: var(--cc-text-color);
}

/* Settings modal buttons */
#cc-main .pm__btn {
    border-radius: calc(var(--cc-border-radius) / 1.2);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    border: none;
}

/* ========================================
   BOTONES DEL MODAL DE PREFERENCIAS
   ======================================== */

/* Resetear estilos base de todos los botones del settings modal usando clase c-bn */
#cc-main .c-bn,
#cc-main #s-bns button {
    border-radius: calc(var(--cc-border-radius) / 1.2) !important;
    font-weight: 600 !important;
    padding: 0.625rem 1.25rem !important;
    transition: all 0.2s ease !important;
    border: none !important;
    cursor: pointer !important;
}

/* Botón "Aceptar todo" - VERDE (#s-all-bn) */
#cc-main #s-all-bn {
    background: #10b981 !important;  /* green-500 - Tailwind */
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: white !important;
}

#cc-main #s-all-bn:hover {
    background: #059669 !important;  /* green-600 */
    background-color: #059669 !important;
    border-color: #059669 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

/* Botón "Guardar configuración" - AZUL (#s-sv-bn) */
#cc-main #s-sv-bn {
    background: #3b82f6 !important;  /* blue-500 - Tailwind */
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: white !important;
}

#cc-main #s-sv-bn:hover {
    background: #2563eb !important;  /* blue-600 */
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}

/* Botón "Solo necesarias" - GRIS NEUTRO (#s-rall-bn) */
#cc-main #s-rall-bn {
    background: #6b7280 !important;  /* gray-500 - Tailwind */
    background-color: #6b7280 !important;
    border-color: #6b7280 !important;
    color: white !important;
}

#cc-main #s-rall-bn:hover {
    background: #4b5563 !important;  /* gray-600 */
    background-color: #4b5563 !important;
    border-color: #4b5563 !important;
    transform: translateY(-2px) !important;
}

/* Overlay */
#cc-main .cm__overlay,
#cc-main .pm__overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #cc-main .cm {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    #cc-main .pm {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    #cc-main .cm__btns {
        flex-direction: column;
        gap: 0.5rem;
    }

    #cc-main .cm__btn {
        width: 100%;
        justify-content: center;
    }

    #cc-main .sc__cookie-table {
        font-size: 0.75rem;
    }

    #cc-main .sc__cookie-table th,
    #cc-main .sc__cookie-table td {
        padding: 0.5rem;
    }
}

/* Animations */
@keyframes cc-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#cc-main .cm--cloud {
    animation: cc-fade-in 0.3s ease;
}

/* Focus states for accessibility */
#cc-main .cm__btn:focus,
#cc-main .pm__btn:focus,
#cc-main .cc-link:focus {
    outline: 2px solid var(--cc-primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #cc-main .cm__btn,
    #cc-main .pm__btn {
        border-width: 2px;
    }

    #cc-main .cm {
        border: 2px solid var(--cc-text-color);
    }
}

/* ========================================
   Floating Cookie Settings Button
   ======================================== */

.c-settings {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999999;
    background: var(--cc-primary-color);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: 'Noto Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: none; /* Hidden by default, shown after first action */
}

.c-settings:hover {
    background: var(--cc-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.3);
}

.c-settings:focus {
    outline: 2px solid var(--cc-primary-color);
    outline-offset: 2px;
}

/* Icon for floating button (cookie emoji) */
.c-settings::before {
    content: '🍪 ';
    margin-right: 0.25rem;
}

/* Responsive floating button */
@media (max-width: 768px) {
    .c-settings {
        bottom: 15px;
        left: 15px;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .c-settings {
        bottom: 10px;
        left: 10px;
        padding: 0.5rem 0.9rem;
        font-size: 0.8rem;
    }

    .c-settings::before {
        content: '🍪';
        margin-right: 0;
    }
}
