/* ===== FIXES PARA CARDS RESPONSIVAS - EVITAR EMPALMES ===== */

/* Hero Stats - Mejorar responsive */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    animation: fadeInUp 1s ease-out 0.4s both;
    margin-top: 2rem; /* Agregar margen superior */
}

.hero-stats .stat-item {
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 2rem 1.5rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    min-width: 160px;
    max-width: 200px; /* Limitar ancho máximo */
    flex: 1; /* Permitir que crezcan uniformemente */
    box-sizing: border-box; /* Incluir padding en el width */
}

/* ===== RESPONSIVE PARA HERO STATS ===== */
@media (max-width: 1024px) {
    .hero-stats {
        gap: 2rem;
        margin-top: 3rem;
    }
    
    .hero-stats .stat-item {
        min-width: 140px;
        max-width: 180px;
        padding: 1.8rem 1.2rem;
    }
    
    .stat-number {
        font-size: 2.2rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .nosotros-hero {
        height: 60vh;
        margin-top: 70px;
        padding: 2rem 0; /* Agregar padding para mejor espaciado */
    }
    
    .nosotros-hero h1 {
        font-size: 2.5rem;
        margin-bottom: 1.5rem;
    }
    
    .nosotros-hero p {
        font-size: 1.2rem;
        margin-bottom: 2.5rem;
        padding: 0 1rem; /* Agregar padding para evitar cortes */
    }
    
    .hero-stats {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        margin-top: 2rem;
        padding: 0 1rem; /* Agregar padding lateral */
    }
    
    .hero-stats .stat-item {
        min-width: 250px; /* Hacer más anchas en móvil */
        max-width: 300px;
        width: 100%;
        padding: 1.5rem 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
        line-height: 1.3; /* Mejorar altura de línea */
    }
}

@media (max-width: 480px) {
    .nosotros-hero {
        height: 55vh;
        margin-top: 70px;
        padding: 1.5rem 0;
    }
    
    .nosotros-hero h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .nosotros-hero p {
        font-size: 1rem;
        margin-bottom: 2rem;
        padding: 0 1.5rem;
        line-height: 1.5;
    }
    
    .hero-stats {
        margin-top: 1.5rem;
        padding: 0 1.5rem;
        gap: 1rem;
    }
    
    .hero-stats .stat-item {
        min-width: unset; /* Quitar min-width */
        max-width: unset; /* Quitar max-width */
        width: 100%;
        padding: 1.2rem 1rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
        letter-spacing: 0.3px;
    }
}

/* ===== FIXES PARA SECCIÓN "QUIÉN ES RAILNET" ===== */
.quien-somos {
    padding: 6rem 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    overflow: hidden; /* Evitar scroll horizontal */
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    margin-top: 2rem;
}

.text-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    word-wrap: break-word; /* Evitar overflow de texto */
}

.highlighted-text {
    background: linear-gradient(135deg, #ff6b35, #ffa500);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    display: inline; /* Cambiar de inline-block a inline */
    word-break: keep-all; /* Evitar cortes de palabras */
    white-space: nowrap; /* Evitar saltos de línea dentro del highlight */
}

/* ===== RESPONSIVE PARA CONTENIDO PRINCIPAL ===== */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .image-content {
        order: -1;
    }
    
    .main-image {
        height: 400px;
    }
    
    .text-content {
        padding: 2.5rem;
    }
}

@media (max-width: 768px) {
    .quien-somos {
        padding: 4rem 0;
    }
    
    .content-grid {
        gap: 2rem;
        margin-top: 1.5rem;
    }
    
    .text-content {
        padding: 2rem;
        margin: 0 1rem; /* Agregar márgenes laterales */
    }
    
    .intro-text p {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1.2rem;
    }
    
    .highlighted-text {
        padding: 0.15rem 0.4rem;
        font-size: 0.95em;
        word-break: break-word; /* Permitir cortes si es necesario en móvil */
        white-space: normal; /* Permitir saltos de línea en móvil */
        display: inline; /* Mantener inline en móvil */
    }
    
    .main-image {
        height: 300px;
        margin: 0 1rem; /* Agregar márgenes laterales */
    }
    
    .overlay-content h3 {
        font-size: 2rem;
    }
    
    .overlay-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .text-content {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }
    
    .intro-text p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .highlighted-text {
        padding: 0.1rem 0.3rem;
        font-size: 0.9em;
        border-radius: 3px;
    }
    
    .main-image {
        height: 250px;
        margin: 0 0.5rem;
    }
    
    .overlay-content h3 {
        font-size: 1.5rem;
    }
    
    .overlay-content p {
        font-size: 0.9rem;
    }
}

/* ===== FIXES GENERALES PARA CONTAINERS ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box; /* Importante para evitar overflow */
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
}

/* ===== PREVENIR SCROLL HORIZONTAL ===== */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

/* ===== FIXES PARA GRIDS RESPONSIVOS ===== */
.features-grid,
.reasons-grid,
.ventajas-grid {
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .features-grid,
    .reasons-grid,
    .ventajas-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature-item,
    .reason-card,
    .ventaja-card {
        margin: 0 0.5rem; /* Agregar márgenes para evitar cortes */
    }
}

@media (max-width: 480px) {
    .feature-item,
    .reason-card,
    .ventaja-card {
        margin: 0 0.25rem;
        padding: 1.5rem 1rem;
    }
}

/* ===== FIXES PARA TEXTOS LARGOS ===== */
h1, h2, h3, h4, h5, h6 {
    word-wrap: break-word;
    hyphens: auto;
}

p {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ===== DEBUGGING - REMOVER EN PRODUCCIÓN ===== */
/* 
.hero-stats .stat-item {
    border: 1px solid red !important;
}

.text-content {
    border: 1px solid blue !important;
}

.highlighted-text {
    border: 1px solid green !important;
}
*/