/* Hero section - Desktop grande */
    .hero-section {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        z-index: -1;
        display: grid;
        place-items: center;
    }

    .slide img {
        width: 100vw;
        height: 100vh;
        object-fit: cover;
        object-position: center center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .logo {
        width: min(350px, 25vw);
        height: min(350px, 25vw);
        font-size: clamp(24px, 2vw, 28px);
    }

    .logo-img {
        width: 100%;/* ================================================
   RESPONSIVE DESIGN STYLES - ARREGLADO
   ================================================ */

/* ================================================
   TABLET STYLES (768px and below)
   ================================================ */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 60px;
        --sidebar-expanded-width: 280px;
    }

    /* Mostrar botón mobile en tablet */
    .mobile-menu-toggle {
        display: flex !important;
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    /* CRÍTICO: Menú móvil oculto por defecto */
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease;
    }

    /* Solo visible cuando tiene clase mobile-open */
    .sidebar.mobile-open {
        transform: translateX(0) !important;
        width: var(--sidebar-expanded-width);
    }

    /* Desactivar hover en móvil */
    .sidebar:hover {
        transform: translateX(-100%) !important;
        width: var(--sidebar-width);
    }

    .sidebar.mobile-open:hover {
        transform: translateX(0) !important;
        width: var(--sidebar-expanded-width);
    }

    /* CRÍTICO: Controlar overflow del menú en móvil */
    .sidebar .sidebar-menu {
        overflow: hidden !important;
    }

    .sidebar.mobile-open .sidebar-menu {
        overflow-y: auto !important;
    }

    /* Submenús en móvil: solo expandir con clase expanded */
    .menu-item .submenu {
        max-height: 0 !important;
        transition: max-height 0.4s ease;
    }

    .menu-item.expanded .submenu {
        max-height: 400px !important;
    }

    .scrollable-submenu {
        max-height: 0 !important;
    }

    .scrollable-submenu.expanded {
        max-height: 280px !important;
    }

    .scrollable-submenu.expanded .submenu-scroll {
        max-height: 280px !important;
    }

    /* Mostrar flechas en móvil */
    .submenu-arrow {
        opacity: 1 !important;
    }

    .main-content {
        margin-left: 0;
    }

    /* Overlay para mobile */
    .mobile-menu-overlay.active {
        display: block;
    }

    /* Hero section - Centrado perfecto en tablet */
    .hero-section {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        z-index: -1;
        display: grid;
        place-items: center;
    }

    .slider-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: grid;
        place-items: center;
    }

    .slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity 1.5s ease-in-out;
        display: grid;
        place-items: center;
        overflow: hidden;
    }

    .slide.active {
        opacity: 1;
    }

    .slide img {
        width: 100vw;
        height: 100vh;
        object-fit: cover;
        object-position: center center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .logo {
        width: min(200px, 80vw);
        height: min(200px, 80vw);
        font-size: clamp(18px, 4vw, 32px);
    }

    .logo-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center center;
    }

    .page-content {
        padding: 20px;
    }

    .page-title {
        font-size: 28px;
    }

    .page-header {
        padding: 20px;
    }

    .content-card {
        padding: 20px;
    }

    .search-input {
        width: 200px;
    }

    /* Slider dots adjustment */
    .slider-dots {
        bottom: 20px;
    }

    .dot {
        width: 10px;
        height: 10px;
    }

    /* Menu text adjustments */
    .menu-text {
        font-size: 14px;
    }

    .submenu-item {
        font-size: 13px;
        padding: 8px 15px 8px 65px;
    }

    /* Mobile sidebar adjustments */
    .sidebar-header {
        padding: 15px;
    }

    .home-button {
        width: 35px;
        height: 35px;
    }

    .sidebar-content {
        height: calc(100vh - 65px);
    }

    .sidebar-menu {
        padding: 10px 0;
    }

    .menu-link {
        padding: 12px 15px;
    }

    .menu-icon {
        min-width: 35px;
        font-size: 16px;
    }

    .menu-text {
        margin-left: 10px;
    }
}

/* ================================================
   MOBILE STYLES (480px and below)
   ================================================ */

@media (max-width: 480px) {
    :root {
        --sidebar-width: 50px;
        --sidebar-expanded-width: 260px;
    }

    .mobile-menu-toggle {
        display: flex;
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    /* CRÍTICO: Comportamiento de menú móvil */
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
        width: var(--sidebar-expanded-width);
    }

    /* Desactivar completamente hover en móvil */
    .sidebar:hover {
        transform: translateX(-100%) !important;
        width: var(--sidebar-width);
    }

    .sidebar.mobile-open:hover {
        transform: translateX(0) !important;
        width: var(--sidebar-expanded-width);
    }

    /* Control de overflow */
    .sidebar .sidebar-menu {
        overflow: hidden !important;
    }

    .sidebar.mobile-open .sidebar-menu {
        overflow-y: auto !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    /* Hero section - Centrado perfecto en móvil */
    .hero-section {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        z-index: -1;
        display: grid;
        place-items: center;
    }

    .slider-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: grid;
        place-items: center;
    }

    .slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity 1.5s ease-in-out;
        display: grid;
        place-items: center;
        overflow: hidden;
    }

    .slide.active {
        opacity: 1;
    }

    .slide img {
        width: 100vw;
        height: 100vh;
        object-fit: cover;
        object-position: center center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .logo {
        width: min(150px, 75vw);
        height: min(150px, 75vw);
        font-size: clamp(16px, 3vw, 20px);
    }

    .logo-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center center;
    }

    .page-content {
        padding: 15px;
    }

    .page-title {
        font-size: 24px;
    }

    .page-header {
        padding: 15px;
        margin-bottom: 20px;
    }

    .content-card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .content-card h2 {
        font-size: 20px;
    }

    .content-card h3 {
        font-size: 18px;
    }

    /* Search adjustments */
    .search-container {
        top: 15px;
        right: 15px;
        flex-direction: row;
    }

    .search-input {
        width: 180px;
        font-size: 14px;
        order: 1;
        margin-right: 8px;
    }

    .search-button {
        width: 40px;
        height: 40px;
        font-size: 16px;
        order: 2;
    }

    /* Hero section adjustments */
    .hero-overlay {
        padding: 20px;
    }

    .slider-dots {
        bottom: 15px;
        gap: 8px;
    }

    .dot {
        width: 8px;
        height: 8px;
    }

    /* Menu adjustments */
    .sidebar-header {
        padding: 15px;
    }

    .home-button {
        width: 30px;
        height: 30px;
    }

    .sidebar-menu {
        padding: 15px 0;
    }

    .menu-link {
        padding: 12px 15px;
    }

    .menu-icon {
        min-width: 35px;
        font-size: 16px;
    }

    .menu-text {
        font-size: 13px;
        margin-left: 10px;
    }

    .submenu-item {
        font-size: 12px;
        padding: 6px 12px 6px 55px;
    }

    /* Sidebar mobile behavior */
    .sidebar-content {
        height: calc(100vh - 60px);
    }

    .scrollable-submenu {
        max-height: 0 !important;
    }

    .scrollable-submenu.expanded {
        max-height: 250px !important;
    }

    .scrollable-submenu.expanded .submenu-scroll {
        max-height: 250px !important;
    }

    /* Mobile submenu arrows siempre visibles */
    .submenu-arrow {
        opacity: 1 !important;
        font-size: 10px;
    }
}

/* ================================================
   EXTRA SMALL MOBILE (360px and below)
   ================================================ */

@media (max-width: 360px) {
    /* Hero section - Centrado perfecto en pantallas extra pequeñas */
    .hero-section {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        z-index: -1;
        display: grid;
        place-items: center;
    }

    .slide img {
        width: 100vw;
        height: 100vh;
        object-fit: cover;
        object-position: center center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .logo {
        width: min(200px, 70vw);
        height: min(200px, 70vw);
        font-size: clamp(14px, 2.5vw, 20px);
    }

    .logo-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center center;
    }

    .page-title {
        font-size: 20px;
    }

    .page-content {
        padding: 10px;
    }

    .page-header {
        padding: 12px;
    }

    .content-card {
        padding: 12px;
    }

    .search-input {
        width: 150px;
    }

    .search-button {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .home-button {
        width: 25px;
        height: 25px;
    }

    .sidebar-header {
        padding: 12px;
    }

    .scrollable-submenu.expanded {
        max-height: 200px !important;
    }

    .scrollable-submenu.expanded .submenu-scroll {
        max-height: 200px !important;
    }

    :root {
        --sidebar-expanded-width: 240px;
    }
}

/* ================================================
   LARGE SCREENS (1200px and above)
   ================================================ */

@media (min-width: 1200px) {
    .main-content {
        margin-left: 70px;
    }

    .sidebar {
        width: 70px;
    }

    /* DESKTOP: Permitir hover normal */
    .sidebar:hover {
        transform: translateX(0) !important;
        width: var(--sidebar-expanded-width);
    }

    .home-button {
        width: 35px;
        height: 35px;
    }

    /* Hide mobile toggle on desktop */
    .mobile-menu-toggle {
        display: none !important;
    }

    /* Hero section maintains same structure */
    .hero-section {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        z-index: -1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
        flex-shrink: 0;
        min-width: 100vw;
        min-height: 100vh;
    }

    .page-content {
        padding: 60px;
        max-width: 1400px;
        margin: 0 auto;
    }

    .logo {
        width: 200px;
        height: 200px;
        font-size: 28px;
    }

    .logo-img {
        max-width: 100%;
        max-height: 100%;
    }

    .page-title {
        font-size: 36px;
    }

    .content-card {
        padding: 40px;
    }

    .scrollable-submenu {
        max-height: 0;
    }

    .sidebar:hover .scrollable-submenu:hover {
        max-height: 350px !important;
    }

    .sidebar:hover .scrollable-submenu:hover .submenu-scroll {
        max-height: 350px !important;
    }

    /* Desktop submenu behavior */
    .sidebar:hover .menu-item:hover .submenu {
        max-height: 400px !important;
    }
}

/* ================================================
   EXTRA LARGE SCREENS (1600px and above)
   ================================================ */

@media (min-width: 1600px) {
    /* Hero section maintains same structure */
    .hero-section {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        z-index: -1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
        flex-shrink: 0;
        min-width: 100vw;
        min-height: 100vh;
    }

    .page-content {
        padding: 80px;
        max-width: 1600px;
    }

    .logo {
        width: 250px;
        height: 250px;
        font-size: 48px;
    }

    .logo-img {
        max-width: 100%;
        max-height: 100%;
    }

    .sidebar:hover .scrollable-submenu:hover {
        max-height: 400px !important;
    }

    .sidebar:hover .scrollable-submenu:hover .submenu-scroll {
        max-height: 400px !important;
    }
}

/* ================================================
   LANDSCAPE ORIENTATION
   ================================================ */

    /* Hero section - Landscape */
    .hero-section {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        z-index: -1;
        display: grid;
        place-items: center;
    }

    .slide img {
        width: 100vw;
        height: 100vh;
        object-fit: cover;
        object-position: center center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .logo {
        width: min(200px, 35vw);
        height: min(200px, 35vh);
        font-size: clamp(14px, 2.5vw, 18px);
    }

    .logo-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center center;
    }

    .slider-dots {
        bottom: 10px;
    }

    .scrollable-submenu.expanded {
        max-height: 150px !important;
    }

    .scrollable-submenu.expanded .submenu-scroll {
        max-height: 150px !important;
    }
}

/* ================================================
   HOVER BEHAVIOR ADJUSTMENTS - RESTAURADO
   ================================================ */

/* Desktop hover behavior - CRÍTICO */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important;
        width: var(--sidebar-width);
    }

    .mobile-menu-toggle {
        display: none !important;
    }

    .mobile-menu-overlay {
        display: none !important;
    }

    /* PERMITIR hover y scroll en desktop */
    .sidebar:hover {
        width: var(--sidebar-expanded-width) !important;
    }
    
    .sidebar:hover .sidebar-menu {
        overflow-y: auto !important;
    }

    .sidebar:hover .menu-item:hover .submenu {
        max-height: 400px !important;
    }

    .sidebar:hover .scrollable-submenu:hover {
        max-height: 350px !important;
    }

    .sidebar:hover .scrollable-submenu:hover .submenu-scroll {
        max-height: 350px !important;
    }

    /* Asegurar que los submenús inicien contraídos */
    .submenu {
        max-height: 0 !important;
    }

    .scrollable-submenu {
        max-height: 0 !important;
    }
}

/* CRÍTICO: Desactivar hover en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .sidebar:hover {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%) !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
        width: var(--sidebar-expanded-width) !important;
    }

    .sidebar:hover .sidebar-menu {
        overflow: hidden !important;
    }

    .sidebar.mobile-open .sidebar-menu {
        overflow-y: auto !important;
    }

    .sidebar:hover .menu-item:hover .submenu {
        max-height: 0 !important;
    }

    /* Solo permitir expansión cuando está explícitamente abierto */
    .sidebar.mobile-open .menu-item.expanded .submenu {
        max-height: 400px !important;
    }

    .submenu-arrow {
        opacity: 1 !important;
    }

    .menu-item:hover .submenu {
        max-height: 0;
    }

    .menu-item.expanded .submenu {
        max-height: 400px;
    }

    .scrollable-submenu.expanded {
        max-height: 300px;
    }

    .scrollable-submenu.expanded .submenu-scroll {
        max-height: 300px;
    }
}

/* ================================================
   PRINT STYLES
   ================================================ */

@media print {
    .sidebar,
    .slider-dots,
    .search-container,
    .mobile-menu-toggle,
    .mobile-menu-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        display: block !important;
        padding: 20px;
        background: white;
    }

    .hero-section {
        height: auto;
        page-break-after: always;
    }

    .content-card {
        border: 1px solid #ddd;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    body {
        overflow: visible !important;
    }

    body.home-page {
        overflow: visible !important;
        height: auto !important;
    }
}

/* ================================================
   HIGH CONTRAST MODE
   ================================================ */

@media (prefers-contrast: high) {
    :root {
        --primary-color: #000000;
        --accent-color: #ffff00;
        --text-light: #ffffff;
        --text-dark: #000000;
        --background-light: #ffffff;
    }

    .sidebar {
        border-right: 2px solid var(--accent-color);
    }

    .content-card {
        border: 1px solid var(--text-dark);
    }

    .mobile-menu-toggle {
        border: 2px solid var(--accent-color);
    }

    .home-button {
        border: 2px solid var(--accent-color);
    }

    .submenu {
        border: 1px solid var(--accent-color);
    }
}

/* ================================================
   REDUCED MOTION
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .slide {
        transition: none !important;
    }

    .logo {
        animation: none !important;
    }

    .content-card:hover {
        transform: none !important;
    }

    .sidebar {
        transition: none !important;
    }

    .mobile-menu-toggle {
        transition: none !important;
    }

    .submenu {
        transition: none !important;
    }

    .mobile-menu-overlay {
        transition: none !important;
    }
}

/* ================================================
   DARK MODE SUPPORT
   ================================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --background-light: #1a1a1a;
        --text-dark: #e0e0e0;
    }

    .page-content {
        background-color: var(--background-light);
        color: var(--text-dark);
    }

    .content-card {
        background: #2a2a2a;
        color: var(--text-dark);
    }

    .page-header {
        background: #2a2a2a;
    }
}

/* ================================================
   FOCUS MANAGEMENT
   ================================================ */

/* Focus styles for keyboard navigation */
.using-keyboard .menu-link:focus,
.using-keyboard .submenu-item:focus,
.using-keyboard .home-button:focus,
.using-keyboard .mobile-menu-toggle:focus,
.using-keyboard .dot:focus {
    outline: 2px solid var(--accent-color) !important;
    outline-offset: 2px;
    background-color: rgba(255, 215, 0, 0.1);
}

/* Skip link positioning */
.skip-link:focus {
    position: absolute;
    top: 6px !important;
    left: 6px;
    z-index: 10001;
}

/* ================================================
   PERFORMANCE OPTIMIZATIONS
   ================================================ */

/* GPU acceleration for smoother animations */
.sidebar,
.slide,
.mobile-menu-overlay,
.logo {
    will-change: transform;
    transform: translateZ(0);
}

/* ================================================
   BROWSER SPECIFIC FIXES
   ================================================ */

/* Safari iOS viewport fix */
@supports (-webkit-appearance: none) {
    .hero-section {
        height: -webkit-fill-available;
    }
    
    body.home-page {
        height: -webkit-fill-available;
    }
}