/**
 * ChessStake - Cookie Consent Styles
 * Modern, accessible, and GDPR compliant cookie banner
 */

/* Overlay */
/* El aviso de cookies NO bloquea la página: nada de oscurecer ni desenfocar
   todo el sitio hasta que el visitante decida (muro de cookies). El aviso es
   un panel al pie; la página sigue viéndose y usándose mientras tanto. */
.cookie-overlay {
    display: none;
}

/* Cookie Banner Container */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.active {
    transform: translateY(0);
}

/* Banner Content */
.cookie-content {
    background: linear-gradient(135deg, rgba(30, 27, 46, 0.98) 0%, rgba(20, 17, 35, 0.98) 100%);
    border-top: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4),
                0 -4px 20px rgba(139, 92, 246, 0.1);
    padding: 0;
    max-height: 90vh;
    overflow-y: auto;
}

.cookie-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* Header */
.cookie-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cookie-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.cookie-icon svg {
    width: 26px;
    height: 26px;
    color: white;
}

.cookie-title-group {
    flex: 1;
}

.cookie-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.cookie-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* Main Content Grid */
.cookie-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: start;
}

/* Description */
.cookie-description {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin: 0;
}

.cookie-description a {
    color: #a78bfa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cookie-description a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* Cookie Categories */
.cookie-categories {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cookie-category {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.625rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.cookie-category:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
}

.cookie-category.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cookie-category.disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Custom Checkbox */
.cookie-checkbox {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.cookie-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 1;
    margin: 0;
}

.cookie-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.cookie-checkbox input:checked ~ .checkmark {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border-color: #8b5cf6;
}

.cookie-checkbox .checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.cookie-checkbox input:checked ~ .checkmark::after {
    display: block;
}

.cookie-checkbox input:disabled ~ .checkmark {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.cookie-checkbox input:disabled:checked ~ .checkmark::after {
    display: block;
}

.cookie-category-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.cookie-category-required {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.25rem;
}

/* Actions */
.cookie-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 200px;
}

.cookie-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.cookie-btn-accept {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.cookie-btn-accept:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.cookie-btn-accept:active {
    transform: translateY(0);
}

.cookie-btn-selected {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cookie-btn-selected:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
}

.cookie-btn-reject {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.cookie-btn-reject:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

/* Expand/Collapse Settings */
.cookie-settings-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.cookie-settings-toggle:hover {
    color: rgba(255, 255, 255, 0.9);
}

.cookie-settings-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.cookie-settings-toggle.expanded svg {
    transform: rotate(180deg);
}

/* Detailed Settings Panel */
.cookie-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, margin 0.3s ease;
    margin-top: 0;
}

.cookie-details.expanded {
    max-height: 500px;
    margin-top: 1.25rem;
}

.cookie-details-inner {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.cookie-detail-item {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cookie-detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cookie-detail-item:first-child {
    padding-top: 0;
}

.cookie-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.cookie-detail-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
}

.cookie-detail-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-weight: 500;
}

.cookie-detail-badge.required {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.cookie-detail-badge.optional {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.cookie-detail-desc {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    margin: 0;
}

/* Legal Links Footer */
.cookie-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cookie-legal a {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s ease;
}

.cookie-legal a:hover {
    color: #a78bfa;
}

/* Responsive */
@media (max-width: 900px) {
    .cookie-main {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .cookie-actions {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 100%;
    }

    .cookie-btn {
        flex: 1;
        min-width: 140px;
    }
}

@media (max-width: 600px) {
    .cookie-inner {
        padding: 1.25rem 1rem;
    }

    .cookie-header {
        flex-wrap: wrap;
    }

    .cookie-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .cookie-icon svg {
        width: 22px;
        height: 22px;
    }

    .cookie-title {
        font-size: 1.125rem;
    }

    .cookie-description {
        font-size: 0.875rem;
    }

    .cookie-categories {
        flex-direction: column;
    }

    .cookie-category {
        width: 100%;
    }

    /* Compacto en móvil: dos botones a la vista (aceptar / rechazar) y las
       categorías solo al abrir «Configurar cookies». Un aviso de 900 px de
       alto en un teléfono es otra forma de muro. */
    .cookie-actions {
        flex-direction: row;
    }

    .cookie-banner:not(.settings-open) .cookie-categories,
    .cookie-banner:not(.settings-open) .cookie-btn-selected,
    .cookie-banner:not(.settings-open) .cookie-legal {
        display: none;
    }

    .cookie-subtitle {
        display: none;
    }

    .cookie-btn {
        width: 100%;
    }

    .cookie-legal {
        flex-wrap: wrap;
        gap: 1rem;
    }
}

/* Animation for first appearance */
@keyframes cookieSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-banner.animate-in {
    animation: cookieSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Focus states for accessibility */
.cookie-btn:focus-visible,
.cookie-category:focus-visible,
.cookie-settings-toggle:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.cookie-checkbox input:focus-visible ~ .checkmark {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}
