/* ====================================
   RESPONSIVE DESIGN - VERSIÓN CORREGIDA
   ==================================== */

/* Responsive general */
@media (max-width: 768px) {
    .top-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .main-header {
        flex-direction: column;
        padding: 15px 20px;
        text-align: center;
        height: auto;
        min-height: 90px;
    }
    
    .main-logo-section {
        justify-content: center;
    }
    
    .main-logo-mdm {
        height: 50px;
    }
    
    .main-logo-texto-line1 {
        font-size: 14px;
    }
    
    .main-logo-texto-line2 {
        font-size: 12px;
    }
    
    .logo-section {
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .logo-mdm {
        height: 70px;
    }
    
    .logo-texto {
        margin-left: 5px;
    }
    
    .logo-texto-line1 {
        font-size: 14px;
    }
    
    .logo-texto-line2 {
        font-family: 'Poppins', 'Inter', Arial, sans-serif;
        font-size: 12px;
    }
    
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .nav-item {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    /* ==== RESPONSIVE DESIGN PRINCIPAL ==== */

/* Pantallas extra grandes */
@media (min-width: 1400px) {
    .container {
        max-width: 100vw;
        gap: 0;
    }
    
    .content {
        padding: 40px 25px 40px 35px;
        margin-right: 20px;
    }
}

/* Móvil para sitio-web.html */
@media (max-width: 768px) {
    .container {
        padding: 0;
        gap: 0;
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-width: unset;
        padding: 15px 10px;
        border-radius: 0;
        position: relative;
        order: 1;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        height: auto;
        border-bottom: var(--glass-border);
        border-right: none;
    }
    
    .sidebar button,
    .sidebar .sidebar-link {
        margin: 0;
        padding: 10px 16px;
        font-size: 0.8rem;
        border-radius: 12px;
        width: auto;
        min-width: 120px;
        flex: 0 0 auto;
        text-align: center;
    }
    
    .content {
        width: 100%;
        padding: 20px 15px;
        border-radius: 0;
        margin: 0;
        order: 2;
        overflow-x: hidden;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 10px 8px;
        gap: 6px;
    }
    
    .sidebar button,
    .sidebar .sidebar-link {
        font-size: 0.75rem;
        padding: 8px 12px;
        min-width: 100px;
    }
    
    .content {
        padding: 15px 10px;
    }
}

/* ==== RESPONSIVE DESIGN PARA CREDENCIALES ==== */
    
    /* Modal de credencial en móvil */
    .credencial-modal {
        margin: 10px;
        max-width: calc(100% - 20px);
        max-height: calc(100% - 20px);
    }
    
    .credencial-modal .credencial-container {
        padding: 20px;
    }
    
    .credencial-modal .tarjetas-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .credencial-modal .tarjeta {
        width: 100%;
        max-width: 350px;
        margin: 0 auto;
    }
    
    /* Ajustes para la tarjeta con imagen de fondo en móvil */
    .tarjeta-frente {
        width: 70vw !important;
        max-width: 18.75rem !important;
        height: 11.25rem !important;
        min-height: unset !important;
        aspect-ratio: unset !important;
    }
    
    .tarjeta-reverso {
        width: 70vw !important;
        max-width: 18.75rem !important;
        height: 11.25rem !important;
        min-height: unset !important;
        aspect-ratio: unset !important;
    }
    
    /* Ajustar proporciones para móvil con posicionamiento mejorado */
    .valor-nombre {
        left: 10% !important;
        top: 32% !important;
        font-size: 0.6rem !important;
        width: 70% !important;
        line-height: 1.2 !important;
        max-width: none !important;
    }
    
    .valor-afiliado {
        left: 10% !important;
        top: 52% !important;
        font-size: 0.6rem !important;
        width: 70% !important;
    }
    
    .valor-vigencia {
        left: 10% !important;
        top: 58% !important;
        font-size: 0.6rem !important;
        width: 70% !important;
    }
    
    .fecha-vencimiento-separada {
        left: 16% !important;
        top: 75% !important;
        font-size: 0.55rem !important;
        width: 65% !important;
        z-index: 20 !important;
    }
    
    /* Ajustes para el reverso de la tarjeta en móvil */
    .tarjeta-body {
        padding: 0.375rem 0.875rem 0.5rem 0.125rem;
        gap: 0.25rem;
    }
    
    .campo {
        font-size: 0.5rem;
        margin-bottom: 0.125rem;
    }
    
    .campo strong {
        font-size: 0.4375rem;
    }
    
    .campo span {
        font-size: 0.5rem;
        margin-left: 0.1875rem;
    }
    
    .contacto-emergencia {
        margin-top: 0.25rem;
        padding-top: 0.25rem;
        gap: 0.25rem !important;
    }
    
    .contacto-emergencia span {
        font-size: 0.4375rem !important;
    }
    
    .phone-emergency {
        font-size: 0.4375rem !important;
    }
    
    .fecha-consulta {
        margin-top: 0.125rem;
        font-size: 0.4375rem !important;
        gap: 0.25rem !important;
    }
    
    .fecha-consulta strong {
        font-size: 0.375rem !important;
        min-width: 3rem !important;
    }
    
    .fecha-consulta span {
        font-size: 0.4375rem !important;
    }
    
    /* QR Code en móvil */
    .qr-box {
        width: 3.5rem;
        height: 3.5rem;
    }
    
    .qr-box span {
        font-size: 0.8rem;
    }
    
    .qr-box small {
        font-size: 0.5rem;
    }
    
    .content-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .floating-buttons {
        position: static;
        flex-direction: row;
        justify-content: center;
        margin: 20px 0;
        transform: none;
    }
    
    .authorization-btn {
        position: static;
        text-align: center;
        margin-top: 20px;
    }
    
    .tarjetas-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tarjeta {
        width: 100%;
        max-width: 350px;
    }
    
    .credencial-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-print, .btn-new-search {
        width: 100%;
        max-width: 250px;
    }
}

/* Responsive para pantallas pequeñas */
@media (max-width: 480px) {
    .main-content {
        padding: 20px 10px;
    }
    
    .credential-section,
    .contact-section {
        padding: 15px;
    }
    
    .logo-section {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .logo-mdm {
        height: 60px;
    }
    
    .logo-texto {
        margin-left: 0;
        text-align: center;
    }
    
    .logo-texto-line1 {
        font-size: 12px;
    }
    
    .logo-texto-line2 {
        font-size: 10px;
    }
    
    .nav-item {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    /* ==== CREDENCIALES EN PANTALLAS MUY PEQUEÑAS ==== */
    
    .tarjeta-frente {
        width: 80vw !important;
        max-width: 16rem !important;
        height: 10rem !important;
        min-height: unset !important;
        aspect-ratio: unset !important;
    }
    
    .tarjeta-reverso {
        width: 80vw !important;
        max-width: 16rem !important;
        height: 10rem !important;
        min-height: unset !important;
        aspect-ratio: unset !important;
    }
    
    .valor-nombre {
        left: 8% !important;
        top: 30% !important;
        font-size: 0.55rem !important;
        width: 60% !important;
        line-height: 1.1 !important;
    }
    
    .valor-afiliado {
        left: 8% !important;
        top: 50% !important;
        font-size: 0.55rem !important;
        width: 60% !important;
    }
    
    .valor-vigencia {
        left: 8% !important;
        top: 58% !important;
        font-size: 0.5rem !important;
        width: 75% !important;
    }
    
    .fecha-vencimiento-separada {
        left: 14% !important;
        top: 68% !important;
        font-size: 0.5rem !important;
        width: 60% !important;
    }
    
    .sidebar {
        padding: 10px 8px;
        gap: 6px;
    }
    
    .sidebar button,
    .sidebar .sidebar-link {
        font-size: 0.75rem;
        padding: 8px 12px;
        min-width: 100px;
    }
    
    .content {
        padding: 15px 10px;
    }
    
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .inicio-logo-mdm {
        width: 50px;
        height: 50px;
    }
    
    .inicio-logo-texto-line1 {
        font-size: 1rem;
    }
    
    .inicio-logo-texto-line2 {
        font-size: 0.8rem;
    }
    
    /* Reverso de tarjeta en pantallas muy pequeñas */
    .tarjeta-body {
        padding: 0.25rem 0.5rem 0.375rem 0.0625rem;
        gap: 0.1875rem;
    }
    
    .campo {
        font-size: 0.4375rem;
        margin-bottom: 0.0625rem;
    }
    
    .campo strong {
        font-size: 0.375rem;
    }
    
    .campo span {
        font-size: 0.4375rem;
        margin-left: 0.125rem;
    }
    
    .contacto-emergencia {
        margin-top: 0.1875rem;
        padding-top: 0.1875rem;
        gap: 0.1875rem !important;
    }
    
    .contacto-emergencia span {
        font-size: 0.375rem !important;
    }
    
    .phone-emergency {
        font-size: 0.375rem !important;
    }
    
    .fecha-consulta {
        margin-top: 0.0625rem;
        font-size: 0.375rem !important;
        gap: 0.1875rem !important;
    }
    
    .fecha-consulta strong {
        font-size: 0.3125rem !important;
        min-width: 2.5rem !important;
    }
    
    .fecha-consulta span {
        font-size: 0.375rem !important;
    }
    
    .qr-box {
        width: 2.8rem;
        height: 2.8rem;
    }
    
    .qr-box span {
        font-size: 0.7rem;
    }
    
    .qr-box small {
        font-size: 0.4rem;
    }
}

/* Media query para tablets */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        flex-direction: column;
        gap: 20px;
        padding: 0 15px;
    }
    
    .sidebar {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 20px;
        position: relative;
        order: 1;
    }
    
    .sidebar button,
    .sidebar .sidebar-link {
        width: auto;
        min-width: 140px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .content {
        width: 100%;
        order: 2;
        padding: 30px 20px;
    }
    
    .hero-content {
        padding: 30px 20px;
    }
    
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .feature {
        padding: 25px;
    }
    
    .feature h3 {
        font-size: 1.4rem;
    }
    
    .feature p {
        font-size: 1rem;
    }
    
    .shield-logo {
        font-size: 2.5rem;
    }
    
    .shield-content h3 {
        font-size: 1.3rem;
    }
    
    .shield-content p {
        font-size: 1rem;
    }
    
    .argentina-map {
        font-size: 2rem;
    }
}

/* Media queries para pantallas grandes */
@media (min-width: 1400px) {
    .container {
        max-width: 1380px;
        margin: 0 auto;
        padding: 0 40px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.4rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }
    
    .feature {
        padding: 40px;
    }
    
    .feature h3 {
        font-size: 1.8rem;
    }
    
    .info-box {
        padding: 30px;
    }
    
    .info-box h4 {
        font-size: 1.3rem;
    }
}

/* Media queries para dispositivos de alta resolución */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-mdm,
    .inicio-logo-mdm {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .tarjeta-frente,
    .tarjeta-reverso {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ========================================
   CORRECCIONES DE ALTURA Y ESPACIADO
   SECCIÓN DE INICIO
   ======================================== */

/* PRIORIDAD 1: Aumentar altura de la sección principal */
#inicio {
    /* Asegurar altura mínima completa del viewport */
    min-height: 100vh;
    /* Padding vertical generoso para separar de otras secciones */
    padding-top: 2rem;
    padding-bottom: 3rem;
}

#inicio .hero-section {
    /* Altura mínima para acomodar todo el contenido */
    min-height: 90vh;
    /* Padding interno adicional */
    padding: 2rem 0;
    /* Asegurar que ocupe toda la altura disponible */
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#inicio .hero-overlay {
    /* Padding generoso para separar el contenido de los bordes */
    padding: 3rem 1rem 4rem 1rem;
    /* Altura mínima para dispositivos móviles */
    min-height: 80vh;
    /* Flexbox para centrado vertical */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#inicio .hero-content {
    /* Gap generoso entre los tres bloques principales */
    gap: 3rem;
    /* Ancho máximo para evitar que se extienda demasiado */
    max-width: 1200px;
    width: 100%;
    /* Padding interno para el contenido */
    padding: 2rem 1rem;
    /* Asegurar flexbox correcto */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* AJUSTES RESPONSIVOS PARA DIFERENTES DISPOSITIVOS */

/* Mobile (hasta 767px) */
@media (max-width: 767px) {
    #inicio {
        min-height: 100vh;
        padding-top: 1.5rem;
        padding-bottom: 2.5rem;
    }
    
    #inicio .hero-overlay {
        padding: 2rem 1rem 3rem 1rem;
        min-height: 95vh;
    }
    
    #inicio .hero-content {
        gap: 2.5rem;
        padding: 1.5rem 1rem;
    }
    
    /* PRIORIDAD 2: Ajustar tamaño de tarjetas en móviles si es necesario */
    #inicio .feature-card {
        padding: 1.5rem 1.2rem;
        min-height: 180px;
    }
    
    #inicio .feature-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    #inicio .feature-card p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    #inicio {
        min-height: 100vh;
        padding-top: 2rem;
        padding-bottom: 3rem;
    }
    
    #inicio .hero-overlay {
        padding: 3rem 2rem 4rem 2rem;
        min-height: 85vh;
    }
    
    #inicio .hero-content {
        gap: 3.5rem;
        padding: 2rem 1.5rem;
    }
    
    #inicio .feature-card {
        padding: 2rem 1.5rem;
        min-height: 200px;
    }
}

/* Desktop (1024px en adelante) */
@media (min-width: 1024px) {
    #inicio {
        min-height: 100vh;
        padding-top: 2.5rem;
        padding-bottom: 4rem;
    }
    
    #inicio .hero-overlay {
        padding: 4rem 3rem 5rem 3rem;
        min-height: 90vh;
    }
    
    #inicio .hero-content {
        gap: 4rem;
        padding: 3rem 2rem;
    }
    
    #inicio .feature-card {
        padding: 2.5rem 2rem;
        min-height: 220px;
    }
}

/* Pantallas muy grandes (más de 1400px) */
@media (min-width: 1400px) {
    #inicio {
        padding-top: 3rem;
        padding-bottom: 5rem;
    }
    
    #inicio .hero-overlay {
        padding: 5rem 4rem 6rem 4rem;
    }
    
    #inicio .hero-content {
        gap: 5rem;
        padding: 4rem 3rem;
    }
    
    #inicio .feature-card {
        padding: 3rem 2.5rem;
        min-height: 250px;
    }
}

/* MEJORAS ADICIONALES PARA EVITAR CORTES */

/* Asegurar que las tarjetas nunca se corten */
#inicio .features-grid {
    margin-bottom: 2rem;
}

#inicio .features-grid-container {
    /* Margen inferior para separar de la siguiente sección */
    margin-bottom: 3rem;
}

/* Separación clara entre sección inicio y noticias */
.noticias-section {
    margin-top: 4rem;
    padding-top: 3rem;
}

/* En móviles, reducir un poco la separación para optimizar espacio */
@media (max-width: 767px) {
    #inicio .features-grid-container {
        margin-bottom: 2rem;
    }
    
    .noticias-section {
        margin-top: 3rem;
        padding-top: 2rem;
    }
}
