/* --- Definiciones Globales (Variables CSS) --- */
:root {
    --primary: #4f80ed;
    --primary-dark: #1d4ed8;
    --neon-primary: #9333ea;
    --neon-secondary: #06b6d4;
    --neon-table: #f97316;
    --slate-50: #ffffff;
    --slate-100: #f9f9f9;
    --slate-200: #e2e8f0;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --highlighter-yellow: #facc15;
    --highlighter-red: #f87171;
    --custom-cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="%23facc15" stroke="%23000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 19l-9 4 5-13 9-4z"/><path d="M19 14l-5-5"/></svg>') 1 18, crosshair;
    --alert-risk: #f97316;
    --flow-pn: #f59e0b; /* Color para PN */
    --flow-pj: #059669; /* Color para PJ */
    --flow-rec: #4f80ed; /* Color para Recomendación */
    --flow-risk: #e11d48; /* Color para Riesgo/Advertencia */
    --flow-neutral: #1e293b; /* Color para Neutral/Negro */
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    color: var(--slate-700);
    margin: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: white; 
    /* Estilos del footer para asegurar que ocupe todo el alto */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Estructura Principal y Títulos (Responsive) --- */
.section-container { 
    max-width: 800px; 
    margin: 0 auto; 
    padding: 30px 20px; 
}
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 30px; }
@media (min-width: 768px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
}

h1 { font-size: 2rem; font-weight: 800; text-align: center; margin-bottom: 1rem; line-height: 1.2; color: var(--slate-900); }
h2 { 
    font-size: 1.5rem; 
    font-weight: 800; 
    color: var(--slate-900); 
    text-align: left; 
    border-bottom: 2px solid var(--slate-200); 
    padding-bottom: 15px; 
    margin-top: 30px; 
    margin-bottom: 30px; 
}
h3 { font-size: 1.25rem; font-weight: 700; margin-top: 20px; margin-bottom: 15px; color: var(--slate-700); }
p { margin-bottom: 1rem; font-size: 1rem; }
.badge { 
    background: white; 
    color: var(--primary); 
    padding: 4px 12px; 
    border-radius: 999px; 
    font-weight: 700; 
    font-size: 0.8rem;
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    border: 1px solid var(--slate-200); 
}
.text-rose { color: #e11d48; font-weight: 700; }
.text-emerald { color: #059669; font-weight: 700; }

/* --- Estilos de Header --- */
.app-header {
    width: 100%;
    background: var(--slate-900);
    border-bottom: 1px solid var(--slate-800);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-content-wrapper {
    max-width: 90rem;
    margin: 0 auto;
    padding: 1rem;
}
.app-header a, .app-header svg, .app-header i {
    color: white;
    fill: currentColor;
    text-decoration: none;
    transition: color 0.3s;
}
.app-header a:hover { color: var(--neon-secondary); }
.header-top { display: flex; justify-content: space-between; align-items: center; }
.centered-title {
    color: var(--neon-primary); font-size: 1.5rem; font-weight: 800;
    text-align: center; flex-grow: 1; margin: 0 1rem;
    text-shadow: 0 0 5px rgba(147, 51, 234, 0.5);
}
.menu-mobile { position: relative; flex-shrink: 0; display: block; }
#menu-toggle-btn {
    background: none; border: 1px solid var(--slate-700); color: white;
    padding: 0.5rem 0.8rem; font-size: 1.2rem; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.2s;
}
#menu-dropdown {
    position: fixed; top: 65px; left: 50%; transform: translateX(-50%);
    background: var(--slate-800); border: 1px solid var(--slate-700);
    border-radius: 0.5rem; padding: 1rem; width: 90%; max-width: 300px;
    margin-top: 0.5rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none; z-index: 1100;
}
#menu-dropdown.active { display: block; }
#menu-dropdown a { display: block; padding: 0.5rem 0; border-bottom: 1px solid var(--slate-700); text-align: center; color: white; }
.social-icons-desktop, .main-nav-desktop-secondary { display: none; }

@media (min-width: 1024px) {
    .header-top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; }
    .centered-title { grid-column: 2 / 3; font-size: 2rem; }
    .menu-mobile { display: none; }
    .social-icons-desktop { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; grid-column: 3 / 4; }
    .main-nav-desktop-secondary { display: flex; justify-content: center; gap: 2rem; grid-column: 1 / 4; padding: 0.8rem 0; border-top: 1px solid var(--slate-800); }
    #menu-dropdown { display: none !important; }
}

/* --- ESTILOS DE MODOS DE APRENDIZAJE --- */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.mode-btn {
    background: white;
    border: 2px solid var(--slate-200);
    color: var(--slate-700);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.mode-btn.active {
    background: linear-gradient(to right, #9333ea, #c084fc);
    color: white;
    border-color: #a855f7; 
    box-shadow: 0 4px 10px rgba(147, 51, 234, 0.4);
}
.mode-btn:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

/* --- CORRECCIONES DE TABLAS (General) --- */
.table-responsive-container {
    width: 100%;
    overflow-x: auto;
    padding: 1px;
    margin-bottom: 10px; 
}
.table-hint-mobile {
    display: none;
    font-style: italic;
    font-size: 0.85rem;
    color: #64748b;
    text-align: right;
    margin-bottom: 5px;
    padding-right: 5px;
}
table { 
    width: 100%; min-width: 700px; border-collapse: collapse; margin-top: 20px; 
    background: white; border-radius: 1.5rem; overflow: hidden; 
    border: 3px solid var(--neon-table); box-shadow: 0 0 20px rgba(249, 115, 22, 0.5);
    table-layout: fixed;
}
th, td {
    padding: 12px 16px; border: 1px solid var(--slate-200); white-space: normal;
    word-wrap: break-word; vertical-align: top;
}
th {
    background: var(--slate-100); text-align: left; font-size: 0.85rem;
    text-transform: uppercase; color: var(--slate-700); font-weight: 700;
}

/* --- ESTILOS DE HERRAMIENTAS ACTIVAS (Resaltador) --- */
.card-glow {
    border-radius: 1.5rem; background: white; border: 2px solid rgba(147, 51, 234, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), 0 0 20px rgba(147, 51, 234, 0.4), inset 0 0 5px rgba(147, 51, 234, 0.1);
    transition: all 0.3s ease-in-out; padding: 30px;
}
.highlighter-options-row {
    display: flex; align-items: center; margin-bottom: 15px;
    gap: 10px; flex-wrap: wrap; 
}
.highlighter-option {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid #ccc;
    cursor: pointer; transition: border-color 0.2s; flex-shrink: 0;
}
.highlighter-option.active {
    border-color: var(--primary-dark); box-shadow: 0 0 0 3px var(--primary-dark);
}
#highlighter-toggle {
    background: white; border: 1px solid var(--slate-200); color: var(--slate-700);
    padding: 10px 15px; border-radius: 8px; cursor: pointer; font-weight: 600;
    font-size: 0.9rem; flex-grow: 1; min-width: 150px;
}
#highlighter-toggle.active { background: var(--primary); color: white; border-color: var(--primary); }
#annotation-box {
    width: 100%; height: 100px; padding: 15px; border-radius: 8px;
    border: 2px solid var(--slate-200); background: white; margin-top: 15px;
    resize: vertical; font-size: 1rem; color: var(--slate-800);
}
.highlighted {
    background-color: var(--current-highlighter-color, var(--highlighter-yellow)) !important;
    padding: 2px 4px; border-radius: 4px; display: inline;
}
body.highlight-mode { cursor: var(--custom-cursor, crosshair) !important; }

/* Estilos genéricos para secciones que aparecen y desaparecen */
.content-section-wrapper {
    display: block; 
}
.hidden-by-mode {
    display: none !important;
}

/* Estilos para Acordeones */
.accordion-header {
    background-color: white;
    color: var(--slate-800);
    padding: 15px 20px;
    cursor: pointer;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    transition: background-color 0.3s;
}
.accordion-header:hover {
    background-color: var(--slate-200);
}
.accordion-content {
    padding: 15px 20px;
    border: 1px solid var(--slate-200);
    border-top: none;
    border-radius: 0 0 8px 8px;
    display: none;
    overflow: hidden;
    background: white;
}
.accordion-header.active {
    border-radius: 8px 8px 0 0;
    border-color: var(--primary);
    background-color: var(--slate-100);
    color: var(--primary-dark);
}
.accordion-header.active i {
    transform: rotate(180deg);
}
.accordion-header i {
    transition: transform 0.3s;
}

/* Estilos para cajas de riesgo/alerta (NRUS Exclusion, etc.) */
.nrus-exclusion {
    margin-top: 30px;
    padding: 30px;
    border-radius: 1.5rem;
    background: white;
    border: 2px solid var(--alert-risk);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 10px rgba(249, 115, 22, 0.4);
}
.nrus-title {
    color: var(--slate-800);
    font-size: 1.5rem; 
    font-weight: 800;
    margin-top: 0;
    border-bottom: 2px solid var(--slate-200);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nrus-disclaimer {
    background: var(--slate-100);
    padding: 15px;
    border-radius: 8px;
    border-left: 5px solid var(--alert-risk);
    font-size: 0.95rem;
    margin-top: 20px;
}

/* --- ESTILOS SECCIÓN 5: MARCAS (si se usa en el futuro) --- */
.marcas-section {
    margin-top: 30px;
    padding: 40px; 
    border-radius: 1.5rem !important;
    background: white !important;
    border: 2px solid rgba(37, 99, 235, 0.3); 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 10px rgba(37, 99, 235, 0.4);
}
.legal-box {
    background: var(--slate-100);
    border: 1px solid #e11d48; 
    padding: 20px;
    border-radius: 1.5rem;
    margin-bottom: 20px;
}
.legal-box h4 {
    color: var(--slate-800);
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}
.indecopi-role {
    background: var(--slate-100);
    border: 1px solid #059669; 
    padding: 15px;
    border-radius: 1.5rem;
    margin-top: 20px;
}
.indecopi-role h4 {
    color: var(--slate-800);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Estilos Flujo (Timeline) --- */
.timeline-flow {
    position: relative;
    padding: 20px 0;
    margin-top: 40px;
}
.timeline-flow::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--slate-200);
    transform: translateX(-50%);
    z-index: 1;
}
.flow-step {
    display: flex;
    align-items: center;
    margin-bottom: 50px;
    position: relative;
}
.flow-step:nth-child(odd) {
    flex-direction: row-reverse;
}
.flow-icon-container {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    z-index: 10;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    border: 4px solid white;
}
.flow-step:nth-child(even) .flow-icon-container { margin-right: -30px; }
.flow-step:nth-child(odd) .flow-icon-container { margin-left: -30px; }

.flow-content {
    flex-grow: 1;
    padding: 25px;
    border-radius: 1.5rem;
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--slate-200);
    position: relative;
    max-width: 45%;
}
.flow-content h3 { margin-top: 0; margin-bottom: 10px; font-size: 1.25rem; }
.flow-option {
    padding: 15px; border-radius: 8px; margin-top: 15px; font-size: 0.9rem;
    border-left: 5px solid var(--slate-200); background: var(--slate-100);
}
.flow-option strong { display: block; margin-bottom: 5px; font-size: 1rem; }
.flow-option.pn { border-color: var(--flow-pn); }
.flow-option.pj { border-color: var(--flow-pj); }
.flow-option.risk { border-color: var(--flow-risk); }
.flow-option.rec { border-color: var(--flow-rec); }

/* Flechas de conexión en desktop */
.flow-step:nth-child(even) .flow-content { margin-right: 50px; }
.flow-step:nth-child(odd) .flow-content { margin-left: 50px; }
.flow-content::before {
    content: ''; position: absolute; width: 0; height: 0; border-style: solid; 
    top: 50%; transform: translateY(-50%); z-index: 1;
}
.flow-step:nth-child(even) .flow-content::before {
    border-width: 15px 0 15px 15px; border-color: transparent transparent transparent white; right: -15px;
}
.flow-step:nth-child(odd) .flow-content::before {
    border-width: 15px 15px 15px 0; border-color: transparent white transparent transparent; left: -15px;
}

/* --- ARREGLO SECCIÓN 3: TABLA RUC (solo si es necesario para el diseño de 2 columnas) --- */
.table-responsive-container-s3 {
    width: 100%;
    overflow-x: auto; 
    padding: 0;
    margin: 0;
}
.table-responsive-container-s3 table {
    min-width: 600px; 
    box-shadow: none;
    border: none;
    table-layout: auto; 
}
.table-responsive-container-s3 thead th {
    background: transparent;
    border: none;
    padding-bottom: 15px !important;
    font-size: 1.15rem;
}
.table-responsive-container-s3 tbody td {
    border: none;
}

/* --- NUEVOS ESTILOS PARA BOTONES Y CONTENEDORES DE HERRAMIENTAS --- */
.btn-primary {
    display: block;
    width: 100%;
    background: linear-gradient(to right, #6d8eef, var(--primary)); 
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(79, 128, 237, 0.4); 
}
.btn-primary:hover {
    background: linear-gradient(to right, #4f80ed, #6d8eef); 
    box-shadow: 0 6px 15px rgba(79, 128, 237, 0.6);
}

/* ======================================= */
/* ====== MEDIA QUERY PARA MÓVIL ====== */
/* ======================================= */
@media (max-width: 767px) {
    .table-hint-mobile { display: block; }
    
    /* REGLA AÑADIDA: Ocultar la sección de resaltador/herramientas en móvil */
    #highlighter-section {
        display: none !important;
    }
    
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.1rem; }
    
    /* Flujo vertical en Móvil: Replicando el diseño guía */
    .timeline-flow::before { left: 30px; } /* Mueve la línea vertical a la izquierda */
    .flow-step { flex-direction: row !important; align-items: flex-start; }
    .flow-step:nth-child(odd) { flex-direction: row; } /* Asegura que todos vayan en la misma dirección */
    .flow-content { 
        max-width: 85%; 
        margin-left: 20px !important; 
        margin-right: 0 !important; 
    }
    
    /* Puntero de contenido (flecha) */
    .flow-content::before { 
        left: -15px; /* Poner la flecha al lado izquierdo */
        border-width: 15px 15px 15px 0; /* Tipo de flecha apuntando a la izquierda */
        border-color: transparent white transparent transparent; 
    }
    /* Asegura que la flecha esté a la izquierda en todos los pasos (par e impar) */
    .flow-step:nth-child(even) .flow-content::before { right: auto; left: -15px; } 

    /* Icono en la línea vertical */
    .flow-icon-container { 
        margin-left: -50px; 
        position: relative; 
        left: 30px; /* Alinea el centro del icono con la línea vertical */
    } 
    /* Reinicia los márgenes negativos innecesarios para móvil */
    .flow-step:nth-child(even) .flow-icon-container { margin-right: 0; }
    .flow-step:nth-child(odd) .flow-icon-container { margin-left: -15px; left: 30px; }
    .flow-step:nth-child(odd) .flow-content { margin-left: 50px; }

    /* Ajustes para tablas */
    #table-regimenes {
        min-width: 900px; /* Mantener un min-width para que sea scrollable */
    }
    .table-responsive-container-s3 table {
        min-width: 100%; 
        table-layout: fixed;
    }
    .table-responsive-container-s3 thead th:first-child,
    .table-responsive-container-s3 tbody td:first-child {
        width: 45%; 
    }
    .table-responsive-container-s3 thead th:last-child,
    .table-responsive-container-s3 tbody td:last-child {
        width: 55%; 
    }
}

/* --- ESTILOS DEL FOOTER --- */
.footer-new {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 2rem 1rem; 
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.3); 
    border-top: 1px solid rgba(34, 211, 238, 0.2); 
    margin-top: auto;
}
.footer-new-links a {
     color: rgba(255, 255, 255, 0.6);
     font-weight: 500;
     margin: 0 0.5rem; 
     display: inline-block; 
     text-decoration: none;
}
.footer-new-links a:hover {
    color: #fff;
    text-shadow: 0 0 8px #9333ea;
}