/* =========================================
   HEADER STYLES (Compatible con Bootstrap 5)
   ========================================= */

/* Top Nav */
.top-nav {
    background-color: #111827; /* Dark background matching footer */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0;
}

.top-nav a {
    text-decoration: none;
    color: #9ca3af; /* Light gray text for readability on dark background */
    font-size: 0.85rem;
    font-weight: 600;
    padding: 5px 10px;
    position: relative;
    transition: color 0.25s;
}

.top-nav a:hover {
    color: #ffffff; /* White text on hover */
}

.top-nav a.active {
    color: var(--primary-red);
}

.top-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-red);
}

.nav-links .contrata-btn {
    background-color: var(--primary-red) !important;
    color: white !important;
    padding: 8px 18px !important;
    border-radius: 20px;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.25);
    text-decoration: none;
}

.nav-links .contrata-btn::after {
    display: none !important; /* No underline indicator on hover */
}

.nav-links .contrata-btn:hover {
    background-color: var(--primary-blue) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(26, 54, 93, 0.3) !important;
}

@media (max-width: 991.98px) {
    .nav-links .contrata-btn {
        margin: 15px 20px !important;
        display: inline-flex !important;
        align-self: flex-start;
    }
}

/* Main Nav */
.main-nav {
    background-color: var(--bg-white);
    padding: 10px 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Logo */
.logo {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-red) !important;
    text-decoration: none;
    letter-spacing: -1px;
    font-style: italic;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
}

/* Nav Links */
.nav-links {
    align-items: center;
}

.nav-links .nav-link {
    color: var(--primary-dark) !important;
    font-weight: 700;
    font-size: 1.1rem;
    transition: color 0.3s;
    padding: 0.5rem 1rem !important;
}

.nav-links .nav-link:hover,
.nav-links .nav-link.active {
    color: var(--primary-red) !important;
}

.nav-links .speedtest-link {
    color: var(--primary-red) !important;
    font-weight: bold;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-dark);
    cursor: pointer;
}

.mobile-menu-btn:focus {
    box-shadow: none;
    outline: none;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

/* Responsive Fixes */
@media (max-width: 991.98px) {
    .nav-links {
        background: white;
        padding: 1rem;
        border-radius: 8px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        margin-top: 15px;
        width: 100%;
        align-items: flex-start;
    }
    .nav-links .nav-item {
        border-bottom: 1px solid #eee;
        width: 100%;
    }
    .nav-links .nav-item:last-child {
        border-bottom: none;
    }
    .nav-links .nav-link {
        padding: 1rem 0.5rem !important;
        width: 100%;
    }
    .top-nav .container {
        flex-direction: column;
        gap: 10px;
    }
}

/* =========================================
   LOGO PULSE ANIMATION
   ========================================= */
@keyframes pulse-ring {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; text-shadow: 0 0 10px var(--primary-blue); }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.brand-logo i {
    animation: pulse-ring 2s infinite ease-in-out;
}

/* =========================================
   DROPDOWN MENUS (HEADER)
   ========================================= */
.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
    padding: 10px 0;
}

.nav-item > a {
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    transition: color 0.3s;
}

/* Underline indicator */
.nav-item > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--primary-red);
    transition: width 0.3s ease;
}

.nav-item:hover > a::after,
.nav-item.current-section > a::after {
    width: 100%;
}

.nav-item:hover > a,
.nav-item.current-section > a {
    color: var(--primary-red) !important;
}

/* Dropdown Menu styling */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-white);
    min-width: 220px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    pointer-events: none;
    border: 1px solid var(--border);
}

.nav-item:hover .dropdown-menu,
.nav-item.touch-open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.dropdown-menu a:hover {
    background: #f8fafc;
    color: var(--primary-red);
    padding-left: 25px; /* Slight indent effect */
}

/* Mobile adjustments */
@media (max-width: 991.98px) {
    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    .nav-item {
        width: 100%;
        padding: 0;
        border-bottom: 1px solid #eee;
    }
    .nav-item > a {
        padding: 15px 20px;
        justify-content: space-between;
    }
    .nav-item > a::after {
        display: none; /* No underline on mobile */
    }
    .dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: #f8fafc;
        width: 100%;
        display: none;
        opacity: 1;
        visibility: visible;
        padding: 0;
        pointer-events: auto;
    }
    .nav-item:hover .dropdown-menu,
    .nav-item.touch-open .dropdown-menu {
        display: block;
        transform: none;
    }
    .dropdown-menu a {
        padding: 12px 20px 12px 40px; /* Indent sub-items */
        border-bottom: 1px solid #eee;
    }
    .dropdown-menu a:hover {
        padding-left: 45px;
    }
}

/* Fix for Sticky Nav inside injected container */
#header-container {
    display: contents;
}
