/* ==========================================
   GLOBAL STYLES (Applies to all screen sizes, mainly for Header/Social)
   ========================================== */

.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #4054b2 0%, #2d3e8f 100%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.social-icons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 1s ease;
    text-decoration: none;
    font-size: 20px; 
    text-decoration: none;
    font-size: 20px;
}

.social-icons a i {
    color:#1a1a1a; /* Dark gray for better contrast on the colored circles */
}

.whatsapp-link { background-color: #25D366; }
.whatsapp-link:hover { background-color: #1fad52; transform: scale(1.1); }

.facebook-link { background-color: #1877F2; }
.facebook-link:hover { background-color: #145dbf; transform: scale(1.1); }

/* Hamburger hidden by default on desktop */
.menu-toggle {
    display: none;
}

/* ==========================================
   MOBILE STYLES (≤768px)
   ========================================== */
@media (max-width: 768px) {

    /* Header Structure */
    .header-container {
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        gap: 10px;
    }
    .header-right {
        display: flex;
        flex-direction: row;
        align-items: center;
        width: auto;
        gap: 12px;
    }
    .logo img {
        max-width: 140px;
    }

    /* Social Icons - Smaller on Mobile */
    .social-icons { gap: 10px; }
    .social-icons a { width: 36px; height: 36px; font-size: 18px; }

    /* Hamburger Button */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1002;
        position: relative;
    }
    .menu-toggle span {
        width: 100%;
        height: 3px;
        background: white;
        border-radius: 3px;
        transition: all 0.3s ease;
        transform-origin: center;
        display: block;
    }
    .menu-toggle.active span:nth-child(1) { transform: translateY(10px) rotate(45deg); }
    .menu-toggle.active span:nth-child(2) { opacity: 0; }
    .menu-toggle.active span:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }

    /* Mobile Navigation Overlay */
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 400px;
        height: 100vh;
        background: linear-gradient(135deg, #4054b2 0%, #2d3e8f 100%);
        box-shadow: -5px 0 15px rgba(0,0,0,0.3);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        overflow-y: auto;
        padding: 80px 0 40px 0;
    }
    nav.active { right: 0; }

    /* Overlay Background */
    nav::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.4s ease;
        z-index: -1;
    }
    nav.active::before { opacity: 1; pointer-events: auto; }

    /* Menu List & Links */
    nav ul {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        padding: 0 20px;
        text-align: right;
    }
    nav li {
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    nav li:last-child {
        border-bottom: none;
    }

    nav a {
        display: block;
        padding: 16px 20px;
        color: white;
        font-size: 1.1em;
        position: relative;
        /* Desktop border-bottom style should be explicitly overridden outside the media query 
           if it exists, but within this mobile scope, we just set the link padding once. */
        border-bottom: none !important; /* Keep for maximum override safety */
    }

    /* Active and Hover States - Consolidated */
    nav li.active > a,
    nav li.current-menu-item > a,
    nav li.current-page-ancestor > a,
    nav a:hover {
        background: rgba(255,255,255,0.15); /* Hover is slightly darker than active, but consolidating for simplicity */
        border-bottom: none !important;
        padding-bottom: 16px; /* Ensure padding is maintained */
    }
    /* Explicitly make the 'active' background slightly less intense, if desired: */
    nav li.active > a,
    nav li.current-menu-item > a,
    nav li.current-page-ancestor > a {
        background: rgba(255,255,255,0.1);
    }

    /* Submenu Styling */
    nav ul ul {
        position: static !important;
        display: none;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.2);
        min-width: auto;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
    }
    nav ul ul.open { max-height: 1000px; }

    /* Submenu Links - Consolidated Padding */
    nav ul ul a {
        padding: 14px 20px 14px 40px !important;
        font-size: 1em;
        border-bottom: none !important;
    }
    nav ul ul a:hover {
        background: rgba(255,255,255,0.15); /* Apply hover to submenus */
    }

    /* Third Level Submenu */
    nav ul ul ul {
        background: rgba(0, 0, 0, 0.3);
    }
    nav ul ul ul a {
        padding: 12px 20px 12px 60px !important;
        font-size: 0.95em;
    }

    /* Arrow Indicators */
    nav li.has-submenu > a::after {
        content: '▼';
        position: absolute;
        left: 20px;
        font-size: 0.8em;
        transition: transform 0.3s ease;
    }
    nav li.has-submenu.open > a::after { transform: rotate(180deg); }
    nav ul ul li.has-submenu > a::after { content: '▼'; left: 40px; }

    /* Submenu Display Control */
    nav li:hover > ul { display: none; }
    nav li.has-submenu.open > ul { display: block !important; }

    /* Body Scroll Lock */
    body.menu-open { overflow: hidden; }
}

/* ==========================================
   EXTRA SMALL MOBILE (≤480px)
   ========================================== */
@media (max-width: 480px) {
    /* Header Structure */
    .header-container { padding: 10px 10px; gap: 8px; }
    .logo img { max-width: 120px; }

    /* Social Icons */
    .social-icons { gap: 8px; }
    .social-icons a { width: 25px; height: 25px; font-size: 16px; }

    /* Hamburger */
    .menu-toggle { width: 28px; height: 28px; }
    .menu-toggle span { height: 2.5px; }
    .menu-toggle.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .menu-toggle.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    /* Navigation */
    nav { width: 90%; }
    nav a { font-size: 1em; padding: 14px 15px; }

    /* Submenu Paddings */
    nav ul ul a { padding: 12px 15px 12px 35px !important; }
    nav ul ul ul a { padding: 10px 15px 10px 50px !important; }
}