.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: #ffffff;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    width: 100%;
    color: #333;
}

header.scrolled {
    padding: 10px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    max-height: 80px; /* Ajustado a un tamaño razonable por defecto */
    width: auto;
    transition: all 0.3s ease;
}

header.scrolled .logo img {
    max-height: 60px;
}

.main-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-menu li {
    position: relative;
    margin-left: 30px;
}

.main-menu a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
    display: block;
    padding: 10px 0;
    position: relative;
}

.main-menu a:hover,
.main-menu a.active {
    color: #c00000;
}

.main-menu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 5px;
    left: 0;
    background-color: #c00000;
    transition: width 0.3s ease;
}

.main-menu a:hover::after,
.main-menu a.active::after {
    width: 100%;
}

/* Submenu Styles */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    list-style: none;
    padding: 15px 0;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.main-menu li:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu li {
    margin: 0;
    display: block;
}

.submenu a {
    padding: 12px 20px;
    white-space: nowrap;
    border-bottom: 1px solid #f0f0f0;
}

.submenu a:hover {
    background-color: #f9f9f9;
    padding-left: 25px;
    color: #c00000;
}

.submenu li:last-child a {
    border-bottom: none;
}

.submenu a::after {
    display: none; /* Remove underline animation for submenu items */
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1002;
}

.mobile-menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #333;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Responsive Styles */
@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .main-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: #fff;
        flex-direction: column;
        padding: 80px 30px;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.4s ease;
        z-index: 1000;
        overflow-y: auto;
    }

    .main-menu.active {
        right: 0;
    }

    .main-menu li {
        margin: 0 0 20px 0;
        width: 100%;
    }
    
    .submenu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        padding-left: 15px;
        background-color: #f9f9f9;
        margin-top: 10px;
        width: 100%;
    }
    
    .main-menu li:hover .submenu {
        display: block;
    }
    
    .logo img {
        max-height: 50px;
    }
}

/* Back to Top Button Styles */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #c00000;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: translateY(20px);
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#backToTop:hover {
    background-color: #a00000;
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
