/* ==========================================================================
   Estilos Premium para Documentos Legales (Términos, Privacidad, etc.)
   ========================================================================== */

.legal-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-8);
    align-items: start;
    position: relative;
    z-index: 10;
    margin-top: -30px; /* Pull it slightly over the hero */
}

/* ==========================================================================
   Sidebar / Índice (Glassmorphism & Premium Design)
   ========================================================================== */
.legal-sidebar {
    position: sticky;
    top: 100px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-2xl);
    padding: var(--space-5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.legal-sidebar:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.08), 0 4px 15px rgba(0, 0, 0, 0.03);
    transform: translateY(-2px);
}

.legal-sidebar h3 {
    font-size: 1.15rem;
    color: var(--slate-800);
    margin-bottom: var(--space-4);
    font-weight: 800;
    padding-bottom: var(--space-3);
    border-bottom: 2px solid rgba(var(--emerald-500-rgb), 0.1); /* Assuming emerald is used for brand */
    letter-spacing: -0.02em;
    position: relative;
}

.legal-sidebar h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    height: 2px;
    width: 40px;
    background: linear-gradient(90deg, var(--emerald-500), var(--emerald-400));
    border-radius: 2px;
}

.legal-toc {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.legal-toc a {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    color: var(--slate-500);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.legal-toc a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--emerald-500);
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 4px 4px 0;
}

.legal-toc a:hover {
    background: var(--slate-50);
    color: var(--emerald-600);
    padding-left: var(--space-4);
}

.legal-toc a.active {
    background: linear-gradient(90deg, rgba(var(--emerald-50-rgb), 0.5), transparent);
    color: var(--emerald-700);
    font-weight: 700;
    padding-left: var(--space-4);
}

.legal-toc a.active::before {
    transform: scaleY(1);
}

/* ==========================================================================
   Contenido Principal (Artículo Premium)
   ========================================================================== */
.legal-article {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8) var(--space-10);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.02);
    max-width: 850px;
    position: relative;
    overflow: hidden;
}

/* Decorative glow behind article */
.legal-article::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(var(--emerald-400-rgb), 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.legal-section {
    margin-bottom: var(--space-10);
    scroll-margin-top: 140px; 
    position: relative;
}

.legal-section h2 {
    font-size: 1.75rem;
    color: var(--slate-800);
    margin-bottom: var(--space-5);
    font-weight: 800;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--slate-100);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.legal-section h2::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--emerald-500);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--emerald-400);
}

.legal-section p, 
.legal-section li {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--slate-600);
    margin-bottom: var(--space-4);
    letter-spacing: 0.01em;
}

.legal-section ul {
    margin-bottom: var(--space-5);
    padding-left: var(--space-6);
    list-style-type: none; /* Custom bullets */
}

.legal-section li {
    margin-bottom: var(--space-3);
    position: relative;
}

.legal-section li::before {
    content: '→';
    position: absolute;
    left: -1.5rem;
    color: var(--emerald-500);
    font-weight: bold;
}

.legal-section strong {
    font-weight: 700;
    color: var(--slate-800);
    background: linear-gradient(120deg, rgba(var(--emerald-100-rgb), 0.5) 0%, rgba(var(--emerald-50-rgb), 0.5) 100%);
    padding: 0 0.2em;
    border-radius: 4px;
}

/* ==========================================================================
   Acceptance Box (Premium Callout)
   ========================================================================== */
.legal-acceptance {
    background: linear-gradient(135deg, var(--slate-50) 0%, var(--white) 100%);
    border: 1px solid var(--slate-200);
    border-left: 4px solid var(--emerald-500);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    margin-top: var(--space-10);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: hidden;
}

.legal-acceptance::after {
    content: '✓';
    position: absolute;
    right: -20px;
    bottom: -30px;
    font-size: 8rem;
    color: var(--slate-100);
    font-weight: 900;
    opacity: 0.5;
    transform: rotate(-15deg);
    pointer-events: none;
}

.legal-acceptance em {
    display: inline-block;
    color: var(--emerald-600);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
    background: var(--emerald-50);
    padding: 4px 10px;
    border-radius: 20px;
}

.legal-acceptance p {
    color: var(--slate-700);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ==========================================================================
   Botón Flotante Volver Arriba
   ========================================================================== */
#back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
    color: var(--white);
    border: none;
    box-shadow: 0 10px 25px rgba(var(--emerald-500-rgb), 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 999;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#back-to-top:hover {
    background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(var(--emerald-500-rgb), 0.5);
}

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 992px) {
    .legal-layout {
        grid-template-columns: 1fr;
        margin-top: -20px;
    }

    .legal-sidebar {
        position: relative;
        top: 0;
        margin-bottom: var(--space-6);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    }

    .legal-article {
        padding: var(--space-6) var(--space-5);
    }
    
    .legal-section h2 {
        font-size: 1.5rem;
    }
}
