/* ===========================================
   TRANSFORMACIÓN COMPLETA ASOGROVALLE
   =========================================== */

/* ====================
   1. ELIMINAR SECCIÓN MANUAL (si existe)
==================== */
#informacion-manual,
section:has(h4:contains("Información del Manual")),
.card:has(.card-title:contains("Información del Manual")) {
    display: none !important;
}

/* ====================
   2. UNIFORMIDAD DE TABLAS Y ELEMENTOS
==================== */

/* Todas las tablas mismo tamaño y estilo */
.table {
    width: 100% !important;
    table-layout: fixed !important; /* Forzar columnas iguales */
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin-bottom: 2rem !important;
}

/* Columnas iguales para tablas de 5 columnas */
.table th:nth-child(1),
.table td:nth-child(1) { width: 5%; } /* # */
.table th:nth-child(2),
.table td:nth-child(2) { width: 25%; } /* Actividad */
.table th:nth-child(3),
.table td:nth-child(3) { width: 10%; } /* Periodo */
.table th:nth-child(4),
.table td:nth-child(4) { width: 35%; } /* Objetivo */
.table th:nth-child(5),
.table td:nth-child(5) { width: 20%; } /* Resultado */
.table th:nth-child(6),
.table td:nth-child(6) { width: 5%; } /* Estado */

/* Tablas de cronograma (6 columnas) */
.table.cronograma th:nth-child(1),
.table.cronograma td:nth-child(1) { width: 5%; }
.table.cronograma th:nth-child(2),
.table.cronograma td:nth-child(2) { width: 20%; }
.table.cronograma th:nth-child(3),
.table.cronograma td:nth-child(3) { width: 10%; }
.table.cronograma th:nth-child(4),
.table.cronograma td:nth-child(4) { width: 25%; }
.table.cronograma th:nth-child(5),
.table.cronograma td:nth-child(5) { width: 25%; }
.table.cronograma th:nth-child(6),
.table.cronograma td:nth-child(6) { width: 15%; }

/* Uniformidad en celdas */
.table th,
.table td {
    padding: 1rem !important;
    vertical-align: middle !important;
    text-align: left !important;
    border: 1px solid #dee2e6 !important;
    word-wrap: break-word !important;
}

/* Cabeceras uniformes */
.table thead th {
    background: linear-gradient(135deg, #2c5e3e 0%, #4a8c5d 100%) !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

/* Filas alternas para mejor lectura */
.table tbody tr:nth-child(even) {
    background-color: rgba(44, 94, 62, 0.03) !important;
}

.table tbody tr:hover {
    background-color: rgba(44, 94, 62, 0.08) !important;
    transform: translateX(5px);
    transition: all 0.2s ease;
}

/* ====================
   3. AJUSTES DE TEXTO Y TIPOGRAFÍA
==================== */

/* Sistema tipográfico consistente */
body {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif !important;
    line-height: 1.6 !important;
    color: var(--text-main) !important;
    font-size: 16px !important;
    text-rendering: optimizeLegibility !important;
    -webkit-font-smoothing: antialiased !important;
}

/* Jerarquía tipográfica consistente */
h1 { font-size: 2.5rem !important; line-height: 1.2 !important; margin-bottom: 1.5rem !important; }
h2 { font-size: 2rem !important; line-height: 1.3 !important; margin-bottom: 1.25rem !important; }
h3 { font-size: 1.75rem !important; line-height: 1.3 !important; margin-bottom: 1rem !important; }
h4 { font-size: 1.5rem !important; line-height: 1.4 !important; margin-bottom: 0.75rem !important; }
h5 { font-size: 1.25rem !important; line-height: 1.4 !important; margin-bottom: 0.5rem !important; }
h6 { font-size: 1rem !important; line-height: 1.4 !important; margin-bottom: 0.5rem !important; }

/* Párrafos y textos */
p, .card-text, .lead {
    line-height: 1.7 !important;
    margin-bottom: 1.5rem !important;
    text-align: justify !important;
    hyphens: auto !important;
}

.lead {
    font-size: 1.25rem !important;
    font-weight: 300 !important;
    color: var(--text-muted) !important;
}

/* Texto en tarjetas */
.card-text {
    font-size: 0.95rem !important;
    color: var(--text-muted) !important;
    text-align: left !important;
}

/* Listas ordenadas */
ol, ul {
    padding-left: 1.5rem !important;
    margin-bottom: 1.5rem !important;
}

li {
    margin-bottom: 0.5rem !important;
    line-height: 1.6 !important;
}

/* ====================
   4. INTERACTIVIDAD MEJORADA
==================== */

/* Efectos hover en todos los elementos interactivos */
.card, .btn, .nav-link, .table tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Tarjetas con efecto elevación */
.card {
    border: none !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background-color: var(--bg-surface) !important;
    box-shadow: var(--box-shadow) !important;
    transform: translateY(0) !important;
}

.card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
}

/* Botones con efecto moderno */
.btn {
    border-radius: 8px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    position: relative !important;
    overflow: hidden !important;
}

.btn::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 5px !important;
    height: 5px !important;
    background: rgba(255, 255, 255, 0.5) !important;
    opacity: 0 !important;
    border-radius: 100% !important;
    transform: scale(1, 1) translate(-50%) !important;
    transform-origin: 50% 50% !important;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out !important;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* Navegación con efecto subrayado */
.nav-link {
    position: relative !important;
    padding: 0.5rem 1rem !important;
}

.nav-link::after {
    content: "" !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 50% !important;
    width: 0 !important;
    height: 2px !important;
    background: #f5a623 !important;
    transition: all 0.3s ease !important;
    transform: translateX(-50%) !important;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80% !important;
}

/* ====================
   5. GRID Y LAYOUT UNIFORME
==================== */

/* Tarjetas de proyecto mismo tamaño */
.project-card {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.project-card .card-body {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.project-card .card-text {
    flex-grow: 1 !important;
}

/* Grid uniforme para proyectos */
.row.g-4 {
    --bs-gutter-x: 1.5rem !important;
    --bs-gutter-y: 1.5rem !important;
}

/* Contenedores consistentes */
.container {
    max-width: 1200px !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

/* Secciones con padding consistente (excluye hero) */
section:not(.hero-section) {
    padding-top: 5rem !important;
    padding-bottom: 5rem !important;
}

section.hero-section {
    padding-top: 220px !important;
    padding-bottom: 200px !important;
    min-height: 92vh !important;
}

/* ====================
   6. ESTÉTICA GENERAL MEJORADA
==================== */

/* Sombras y profundidad consistentes */
.shadow-sm { box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important; }
.shadow { box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important; }
.shadow-lg { box-shadow: 0 10px 15px rgba(0,0,0,0.1) !important; }

/* Bordes redondeados consistentes */
.rounded { border-radius: 8px !important; }
.rounded-3 { border-radius: 12px !important; }
.rounded-4 { border-radius: 16px !important; }
.rounded-circle { border-radius: 50% !important; }

.bg-surface { background-color: var(--bg-surface) !important; }
.bg-surface-alt { background-color: var(--bg-surface-alt) !important; }
.text-main { color: var(--text-main) !important; }
.text-muted-custom { color: var(--text-muted) !important; }

/* Colores consistentes */
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }

.text-accent { color: var(--accent-color) !important; }
.bg-accent { background-color: var(--accent-color) !important; }

/* Badges mejorados */
.badge {
    padding: 0.35em 0.65em !important;
    font-size: 0.75em !important;
    font-weight: 700 !important;
    border-radius: 10rem !important;
    letter-spacing: 0.5px !important;
}

/* ====================
   7. ANIMACIONES Y TRANSICIONES
==================== */

/* Animación de aparición */
.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animación de carga progresiva */
.stagger-item {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }

/* Efecto de onda en botones */
.wave-effect {
    position: relative;
    overflow: hidden;
}

.wave-effect::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.wave-effect:active::after {
    animation: wave 0.6s ease-out;
}

@keyframes wave {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(30, 30);
        opacity: 0;
    }
}

/* ====================
   8. RESPONSIVE MEJORADO
==================== */

@media (max-width: 768px) {
    /* Tablas scroll horizontal en móvil */
    .table-responsive {
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.9rem;
        min-width: 800px; /* Forzar scroll en móvil */
    }
    
    /* Ajuste de textos en móvil */
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.75rem !important; }
    h3 { font-size: 1.5rem !important; }
    
    .lead { font-size: 1.1rem !important; }
    
    /* Secciones menos padding en móvil */
    section {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Grid 1 columna en móvil */
    .row.g-4 {
        --bs-gutter-y: 1rem !important;
    }
}

/* ====================
   9. ESTILOS PARA MODO OSCURO
==================== */

[data-bs-theme="dark"] {
    /* Colores oscuros con buen contraste */
    --text-color: #e9ecef;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --border-color: #404040;
}

[data-bs-theme="dark"] body {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

[data-bs-theme="dark"] .card {
    background-color: var(--card-bg) !important;
    border-color: var(--border-color) !important;
}

[data-bs-theme="dark"] .table {
    color: var(--text-color) !important;
    background-color: var(--card-bg) !important;
}

[data-bs-theme="dark"] .table th {
    background: linear-gradient(135deg, #1e4620 0%, #2c5e3e 100%) !important;
}

[data-bs-theme="dark"] .table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* ====================
   10. UTILIDADES FINALES
==================== */

/* Scroll suave */
html {
    scroll-behavior: smooth !important;
}

/* Selección de texto */
::selection {
    background-color: rgba(44, 94, 62, 0.3) !important;
    color: inherit !important;
}

/* Focus visible para accesibilidad */
:focus-visible {
    outline: 2px solid #f5a623 !important;
    outline-offset: 2px !important;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

[data-bs-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
}
