/* ============================================
   SISTEMA DE DISEÑO GLOBAL | INFRA-CYBER-DEFEND
   ============================================ */

/* 1. VARIABLES GLOBALES */
:root {
    --primary: #10B981;
    --primary-dark: #059669;
    --primary-light: #D1FAE5;
    --secondary: #F59E0B;
    --secondary-light: #FEF3C7;
    --accent: #8B5CF6;
    --accent-light: #EDE9FE;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    
    /* Tema Claro por defecto (Frontend Alumnos) */
    --bg-body: #F9FAFB;
    --bg-card: #FFFFFF;
    --bg-secondary: #F3F4F6;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --border-color: #E5E7EB;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.3s ease;
}

/* 2. MODO OSCURO (Frontend Alumnos) */
body.dark, html.dark body {
    --bg-body: #111827;
    --bg-card: #1F2937;
    --bg-secondary: #1f2937;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #9CA3AF;
    --border: #374151;
    --border-color: #374151;
    --primary-light: #064E3B;
    --danger-light: #7F1D1D;
    --secondary-light: #78350F;
    --accent-light: #4C1D95;
}

/* 3. RESETEO Y BASE */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 600; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: var(--font-body); border: none; outline: none; cursor: pointer; }

/* 4. COMPONENTES COMPARTIDOS: NAVBAR */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000; padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}
body.dark .navbar { background: rgba(0, 0, 0, 0.95); }

.nav-container {
    max-width: 1200px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center; width: 100%;
}
@media (min-width: 1024px) { .nav-container { max-width: 92%; } }
@media (min-width: 1800px) { .nav-container { max-width: 95%; } }

.nav-logo {
    display: flex; align-items: center; gap: 0.75rem;
    font-family: var(--font-heading); font-size: 1.5rem;
    font-weight: 700; color: var(--primary);
}

.nav-menu, .nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-link { font-weight: 500; color: var(--text-secondary); transition: var(--transition); position: relative; }
.nav-link:hover, .nav-link.active { color: var(--primary); }
body.dark .nav-link { color: #D1D5DB; }

.nav-toggle { display: none; font-size: 1.5rem; color: var(--text-primary); background: transparent; }
body.dark .nav-toggle { color: #FFFFFF; }

.theme-toggle {
    background: none; font-size: 1.3rem; color: var(--text-secondary);
    padding: 0.5rem; transition: transform 0.3s ease, color 0.3s ease;
    display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { transform: scale(1.1); color: var(--primary); }
body.dark .theme-toggle { color: #FBBF24; }

/* 5. COMPONENTES COMPARTIDOS: BOTONES GENERALES */
.btn-primary, .btn-submit, .btn-commit, .btn-next {
    background: var(--primary); color: white;
    border-radius: var(--radius-md, 12px); font-weight: 600;
    transition: var(--transition);
}
.btn-primary:hover, .btn-submit:hover:not(:disabled), .btn-commit:hover, .btn-next:hover {
    background: var(--primary-dark);
}

/* 6. COMPONENTES COMPARTIDOS: MODALES INSTITUCIONALES / CUSTOM DIALOGS */
.modal-overlay, .custom-dialog-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; opacity: 0; visibility: hidden; 
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.active, .modal-overlay.show, .custom-dialog-overlay.show { 
    opacity: 1; visibility: visible; 
}

.modal-box, .custom-dialog-box {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; width: 90%; max-width: 450px; padding: 24px;
    text-align: center; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px) scale(0.95); transition: transform 0.3s;
}
.modal-overlay.active .modal-box, .modal-overlay.show .modal-box, .custom-dialog-overlay.show .custom-dialog-box { 
    transform: translateY(0) scale(1); 
}

.modal-icon, .complete-icon { font-size: 3rem; color: var(--warning); margin-bottom: 15px; }
.modal-title, .custom-dialog-title { color: var(--text-primary); font-size: 1.25rem; font-weight: 600; margin-bottom: 10px; }
.modal-message, .custom-dialog-msg { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.5; margin-bottom: 20px; }

/* 7. COMPONENTES COMPARTIDOS: FOOTER */
.footer {
    background: var(--bg-card); color: var(--text-primary);
    padding: 2rem; border-top: 1px solid var(--border-color);
    text-align: center; margin-top: auto;
}
body.dark .footer { background: #0F172A; border-top: 1px solid #334155; }
.footer p { color: var(--text-secondary); font-size: 0.85rem; }
.footer a { color: var(--primary); text-decoration: none; }

/* 8. ADAPTACIÓN MÓVIL GLOBAL (NAVBAR) */
@media (max-width: 768px) {
    .navbar { padding: 1rem 1.25rem; width: 100%; box-sizing: border-box; display: block; }
    .nav-container { flex-direction: row; justify-content: space-between; align-items: center; }
    .nav-logo { font-size: 1.2rem; }
    .nav-toggle { display: block; }
    
    .nav-menu, .nav-links {
        position: fixed; top: 65px; left: 0; right: 0; width: 100%;
        background: var(--bg-card); flex-direction: column; align-items: center;
        padding: 1.5rem 0; gap: 1rem; box-shadow: var(--shadow-md);
        transform: translateY(-150%); opacity: 0; visibility: hidden;
        transition: 0.3s ease-in-out; border-top: 1px solid var(--border-color); z-index: 999;
    }
    body.dark .nav-menu, body.dark .nav-links { background: #111827; border-top-color: #374151; }
    .nav-menu.active, .nav-links.active { transform: translateY(0); opacity: 1; visibility: visible; }
    .nav-link { display: block; width: 100%; text-align: center; padding: 0.5rem 0; }
}

/* 9. JUSTIFICADO GLOBAL MÓVIL (Lectura cómoda) */
@media screen and (max-width: 768px) {
    p, .scenario-text, .feedback-text, .texto-final-justificado {
        text-align: justify !important;
        text-justify: inter-word !important;
        -webkit-hyphens: auto !important;
        hyphens: auto !important;
    }
    .modal-title, .section-title, .hero-title, h1, h2, h3 {
        text-align: center !important;
    }
}