/* ===================================
   RESPONSIVE IMPROVEMENTS FOR TABLETS AND MOBILE
   =================================== */

/* Estilos base para el botón responsive */
.btn-responsive {
    width: 200px;
    margin-left: 40px;
}

/* Ocultar burger-icon-mobile por defecto en desktop */
.burger-icon-mobile {
    display: none !important;
}

/* Ancho del menú móvil en desktop - más ancho para mejor visualización */
@media only screen and (min-width: 1025px) {
    .mobile-header-wrapper-style {
        width: 420px !important;
    }
}

/* Desktop - ocultar burger icon del header-right */
@media only screen and (min-width: 1025px) {
    .header-right .burger-icon {
        display: none !important;
    }

    .burger-icon-mobile {
        display: none !important;
    }
}

/* Tablets and Small Laptops (768px - 1024px) */
@media only screen and (max-width: 1024px) {
    /* Ancho del menú móvil en tablets */
    .mobile-header-wrapper-style {
        width: 380px !important;
    }

    /* Header Improvements */
    .header .main-header {
        padding: 15px 0;
        position: relative;
    }

    /* Ocultar el burger del header-nav en tablets
    .header-nav .burger-icon {
        display: none !important;
    }*/

    /* Mostrar el burger del header-right */
    .header-right .burger-icon,
    .burger-icon-mobile {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 30px;
        height: 30px;
        cursor: pointer;
        margin-right: 15px;
        margin-left: 0;
        padding: 0;
    }

    .header-right .burger-icon span,
    .burger-icon-mobile span {
        display: block;
        width: 24px;
        height: 3px;
        background-color: #05264e;
        margin: 2.5px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .header .header-right .block-signin .btn-responsive {
        font-size: 13px;
        padding: 8px 15px !important;
        width: auto !important;
        min-width: 150px;
        max-width: 180px;
        text-align: center;
        margin-left: 0 !important;
    }

    /* Asegurar que el menú de navegación se oculte en tablets */
    .header .header-nav .nav-main-menu {
        display: none;
    }

    /* Ajustar el logo */
    .header-logo img {
        max-height: 40px;
        width: auto;
    }

    /* Ajustar header-right */
    .header-right {
        display: flex;
        align-items: center;
        gap: 10px;
    }
}

/* Mobile Devices (menos de 768px) */
@media only screen and (max-width: 767px) {
    /* Ancho del menú móvil en dispositivos móviles - pantalla completa con margen */
    .mobile-header-wrapper-style {
        width: 320px !important;
        max-width: 85vw !important;
    }

    /* Header Mobile */
    .header .main-header {
        padding: 10px 0;
        flex-wrap: nowrap;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header-left,
    .header-right {
        flex: 0 0 auto;
    }

    .header-left {
        flex: 1;
    }

    .header-logo img {
        max-height: 35px;
        width: auto;
    }

    /* Ocultar burger del header-nav */
   /* .header-nav .burger-icon {
        display: none !important;
    }*/

    /* Botón de Login/Dashboard en móvil */
    .header .header-right {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
    }

    .header .header-right .burger-icon,
    .header .header-right .burger-icon-mobile {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 28px;
        height: 28px;
        cursor: pointer;
        margin: 0;
        padding: 0;
        order: 1;
    }

    .header .header-right .burger-icon span,
    .header .header-right .burger-icon-mobile span {
        display: block;
        width: 22px;
        height: 2.5px;
        background-color: #05264e;
        margin: 2.5px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .header .header-right .block-signin {
        order: 2;
        margin: 0;
    }

    .header .header-right .block-signin .btn-responsive {
        font-size: 11px !important;
        padding: 6px 10px !important;
        width: auto !important;
        min-width: 95px !important;
        max-width: 130px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-left: 0 !important;
        line-height: 1.3;
    }

    /* Mobile Menu Improvements */
    .mobile-header-active {
        z-index: 9999;
    }

    .mobile-menu li {
        padding: 12px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-menu li a {
        font-size: 15px !important;
        padding: 8px 15px;
        display: block;
        color: #05264e;
        font-weight: 500;
    }

    .mobile-menu li a:hover {
        color: #3c65f5;
        padding-left: 20px;
        transition: all 0.3s ease;
    }

    /* Sub-menu en móvil */
    .mobile-menu .sub-menu {
        padding-left: 20px;
        margin-top: 10px;
    }

    .mobile-menu .sub-menu li {
        padding: 8px 0;
    }

    .mobile-menu .sub-menu li a {
        font-size: 14px !important;
        color: #4f5e64;
    }

    /* Mobile Account Section */
    .mobile-account {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 2px solid #e0e6f7;
    }

    .mobile-account h6 {
        font-size: 16px;
        font-weight: 700;
        color: #05264e;
        margin-bottom: 15px;
        padding: 0 15px;
    }

    .mobile-account ul li {
        padding: 10px 0;
    }

    .mobile-account ul li a {
        font-size: 14px !important;
        padding: 8px 15px;
    }

    /* Site Copyright */
    .site-copyright {
        text-align: center;
        padding: 20px 15px;
        margin-top: 30px;
        font-size: 12px;
        color: #6c757d;
        border-top: 1px solid #e0e6f7;
    }

    /* Menu Expand Icon */
    .menu-expand {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        background: rgba(60, 101, 245, 0.1);
        border-radius: 4px;
    }

    .menu-expand i {
        color: #3c65f5;
        font-size: 14px;
    }

    /* Active menu item */
    .mobile-menu li.active > a {
        color: #3c65f5;
        font-weight: 600;
    }

    /* Body Overlay */
    .body-overlay-1 {
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
    }

    .mobile-menu-active .body-overlay-1 {
        display: block;
        opacity: 1;
    }

    /* Animación del burger icon cuando está abierto */
    .burger-close .burger-icon-top {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .burger-close .burger-icon-mid {
        opacity: 0;
    }

    .burger-close .burger-icon-bottom {
        transform: rotate(-45deg) translate(6px, -6px);
    }
}

/* Extra Small Devices (menos de 480px) */
@media only screen and (max-width: 480px) {
    /* Ancho del menú móvil en pantallas muy pequeñas */
    .mobile-header-wrapper-style {
        width: 280px !important;
        max-width: 90vw !important;
    }

    .header .header-right .burger-icon,
    .header .header-right .burger-icon-mobile {
        display: flex !important;
        width: 24px;
        height: 24px;
    }

    .header .header-right .burger-icon span,
    .header .header-right .burger-icon-mobile span {
        width: 18px;
        height: 2px;
    }

    .header .header-right .block-signin .btn-responsive {
        font-size: 10px !important;
        padding: 5px 8px !important;
        min-width: 85px !important;
        max-width: 105px !important;
    }

    .header-logo img {
        max-height: 30px;
    }

    .header .header-right .burger-icon {
        width: 24px;
        height: 24px;
    }

    .header .header-right .burger-icon span {
        width: 18px;
        height: 2px;
    }

    .mobile-menu li a {
        font-size: 14px !important;
    }

    .mobile-account h6 {
        font-size: 15px;
    }
}

/* Landscape Mode for Mobile */
@media only screen and (max-height: 500px) and (orientation: landscape) {
    .mobile-header-wrapper-inner {
        max-height: 100vh;
        overflow-y: auto;
    }

    .mobile-menu li {
        padding: 8px 0;
    }

    .mobile-menu li a {
        padding: 5px 15px;
    }
}

/* Fix para evitar scroll horizontal en móvil */
@media only screen and (max-width: 767px) {
    body {
        overflow-x: hidden;
    }

    .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Asegurar que las imágenes no se desborden */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Mejorar el área táctil de los botones en móvil */
@media only screen and (max-width: 767px) {
    .btn,
    .mobile-menu li a,
    .burger-icon {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
    }

    /* Aumentar el área táctil de los enlaces */
    .mobile-menu li a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Ajustes específicos para iPad y tablets */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
    /* Mostrar el menú burger en lugar del menú completo */
    .header-nav .nav-main-menu {
        display: none;
    }

    .header-nav .burger-icon {
        display: none !important;
    }

    .header-right .burger-icon,
    .burger-icon-mobile {
        display: flex !important;
    }

    /* Ajustar el espaciado del header */
    .header .container {
        padding: 0 30px;
    }

    /* Mejorar el botón de login/dashboard */
    .header .header-right .block-signin .btn-responsive {
        font-size: 14px;
        padding: 10px 20px !important;
        width: auto !important;
        min-width: 160px;
        margin-left: 0 !important;
    }

    /* Burger icon en tablets */
    .header-right .burger-icon,
    .burger-icon-mobile {
        width: 30px;
        height: 30px;
        margin-right: 15px;
    }

    .header-right .burger-icon span,
    .burger-icon-mobile span {
        width: 24px;
        height: 3px;
    }
}

/* Fix para botones que se superponen en móvil */
@media only screen and (max-width: 767px) {
    .main-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    .header-right {
        display: flex;
        align-items: center;
        gap: 5px;
    }

    /* Evitar que el texto del botón se desborde */
    .btn {
        white-space: normal;
        line-height: 1.2;
        text-align: center;
    }
}
