/* ================================
   Global CSS Variables & Settings
================================ */

:root {
    /* Fonts */
    --font-primary: "Poppins", sans-serif;

    /* Primary Colors */
    --primary-blue: #155dfc;
    --primary-blue-hover: #1249d6;
    --primary-dark: #1a1a2e;

    /* Neutral Colors */
    --white: #ffffff;
    --black: #000000;
    --gray-100: #f8fafc;
    --gray-200: #eef2f6;
    --gray-300: #e5e5e5;
    --gray-400: #ddd;
    --gray-500: #999;
    --gray-600: #777;
    --gray-700: #666;
    --gray-800: #333;

    /* Accent Colors */
    --accent-yellow: #d4a900;
    --accent-light-blue: #ebf4fe;

    /* Spacing */
    --container-max: 1600px;
    --container-padding: 40px;

    /* Border Radius */
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* Global Reset & Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--white);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary-dark);
}

p {
    font-family: var(--font-primary);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-normal);
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, textarea, select {
    font-family: var(--font-primary);
    font-size: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* Selection */
::selection {
    background: var(--primary-blue);
    color: var(--white);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ================================
   Header & Navigation
================================ */

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 70px;
}

/* Logo */
.logo {
    flex-shrink: 0;
}

.logo img {
    height: 50px;
    width: auto;
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-item {
    position: relative;
}

.nav-item > a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-item > a:hover {
    color: #155dfc;
}

.nav-item svg {
    width: 10px;
    height: 6px;
}

/* Active/Hover State */
.nav-item > a:hover,
.nav-item.active > a {
    color: #155dfc;
    position: relative;
}

.nav-item > a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #155dfc;
    transition: width 0.3s ease;
}

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

/* Dropdown Arrow */
.dropdown-arrow {
    margin-left: 4px;
    transition: transform 0.3s ease;
}

/* Arrow rotation is handled via .mega-menu-open class in the @media block below */

/* Mega Menu */
.nav-item.has-mega-menu {
    position: static;
}

/* Invisible bridge: a pseudo-element that fills the gap between the nav link
   and the mega menu panel so the mouse never leaves the hover target. */
@media (min-width: 901px) {
    .nav-item.has-mega-menu > a {
        position: relative;
    }
    .nav-item.has-mega-menu > a::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: -20px;   /* extend downward to cover the gap */
        height: 20px;
        background: transparent;
        display: none;    /* only show when menu is open */
    }
    .nav-item.has-mega-menu.mega-menu-open > a::before {
        display: block;
    }
}

.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-top: 4px solid #155dfc;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 1000;
    pointer-events: none;
}

/* Desktop: JS .mega-menu-open class is the sole controller.
   We no longer rely on CSS :hover which causes race conditions. */
@media (min-width: 901px) {
    .nav-item.has-mega-menu.mega-menu-open .mega-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-item.has-mega-menu.mega-menu-open .dropdown-arrow {
        transform: rotate(180deg);
    }
}

.mega-menu-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 60px;
}

/* Mega Menu Column */
.mega-menu-column {
    display: flex;
    flex-direction: column;
}

.mega-menu-title {
    font-size: 13px;
    font-weight: 700;
    color: #155dfc;
    letter-spacing: 0.5px;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e5e5;
    text-transform: uppercase;
}

.mega-menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mega-menu-list li {
    border-bottom: 1px solid #f0f0f0;
}

.mega-menu-list li:last-child {
    border-bottom: none;
}

.mega-menu-list li a {
    display: block;
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    position: relative;
    margin: 2px 0;
}

.mega-menu-list li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background: #155dfc;
    transition: width 0.3s ease;
}

.mega-menu-list li a:hover {
    background: #f0f7ff;
    color: #155dfc;
    padding-left: 24px;
}

.mega-menu-list li a:hover::before {
    width: 12px;
}

/* CTA Button */
.cta-btn {
    margin-left: 20px;
    padding: 10px 25px;
    border: 2px solid #155dfc;
    border-radius: 5px;
    color: #155dfc;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cta-btn:hover {
    background: #155dfc;
    color: #fff;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Header Responsive */
@media (max-width: 1024px) {
    .nav-item > a {
        padding: 10px 10px;
        font-size: 13px;
    }

    .cta-btn {
        padding: 8px 15px;
    }
}

@media (max-width: 900px) {
    .hamburger {
        display: flex;
    }

    .nav {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        padding: 20px;
        border-bottom: 1px solid #e5e5e5;
        box-shadow: 0 5px 20px rgba(0,0,0,0.1);
        transform: translateY(-150%);
        opacity: 0;
        transition: all 0.3s ease;
        z-index: 999;
    }

    .nav.active {
        transform: translateY(0);
        opacity: 1;
    }

    .nav-list {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-item {
        width: 100%;
        border-bottom: 1px solid #eee;
    }

    .nav-item > a {
        padding: 15px;
        justify-content: space-between;
    }

    /* Reset active styles for mobile */
    .nav-item.active > a {
        background: rgba(21, 93, 252, 0.1);
        border-radius: 5px;
    }

    .nav-item.active > a::after {
        display: none;
    }

    .cta-btn {
        margin: 20px 0 0 0;
        text-align: center;
        width: 100%;
    }

    /* Mega Menu Mobile */
    .nav-item.has-mega-menu {
        position: relative;
    }

    .mega-menu {
        position: static;
        width: 100%;
        margin-left: 0;
        box-shadow: none;
        border-top: none;
        border-left: 3px solid #155dfc;
        margin-top: 10px;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.4s ease;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* Mobile: Show mega menu on click (active class) */
    .nav-item.has-mega-menu.mega-menu-active .mega-menu {
        max-height: 2000px;
        pointer-events: auto;
    }

    /* No hover overrides needed — desktop uses JS .mega-menu-open class only */

    .mega-menu-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .mega-menu-title {
        font-size: 12px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .mega-menu-list li a {
        padding: 10px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 15px;
    }

    .logo img {
        height: 40px;
    }
}

/* ================================
   Footer
================================ */
.footer {
    background: #1a1a2e;
    color: #ffffff;
    padding: 80px 0 0;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #155dfc 0%, #3b82f6 50%, #155dfc 100%);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Footer Top */
.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 60px;
    padding-bottom: 60px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer Column */
.footer-column {
    display: flex;
    flex-direction: column;
}

/* Footer Logo */
.footer-logo {
    margin-bottom: 24px;
}

.footer-logo img {
    max-width: 180px;
    height: auto;
}

/* Footer Description */
.footer-description {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 28px;
}

/* Footer Social */
.footer-social {
    display: flex;
    gap: 12px;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link:hover {
    background: #155dfc;
    color: #ffffff;
    transform: translateY(-3px);
    border-color: #155dfc;
    box-shadow: 0 8px 20px rgba(21, 93, 252, 0.3);
}

/* Footer Title */
.footer-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 24px;
    position: relative;
    padding-bottom: 12px;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #155dfc 0%, #3b82f6 100%);
    border-radius: 2px;
}

/* Footer Links */
.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links li a {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
    padding-left: 0;
}

.footer-links li a::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background: #155dfc;
    transition: width 0.3s ease;
}

.footer-links li a:hover {
    color: #ffffff;
    padding-left: 20px;
}

.footer-links li a:hover::before {
    width: 12px;
}

/* Footer Contact */
.footer-contact {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.footer-contact li svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #155dfc;
}

.footer-contact li span {
    flex: 1;
}

/* Footer Bottom */
.footer-bottom {
    padding: 30px 0;
}

.footer-bottom-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.copyright {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom-links {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-bottom-links a {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s ease;
}

.footer-bottom-links a:hover {
    color: #155dfc;
}

.footer-bottom-links .separator {
    color: rgba(255, 255, 255, 0.3);
}

/* Footer Responsive */
@media (max-width: 1024px) {
    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .footer {
        padding: 60px 0 0;
    }

    .footer-container {
        padding: 0 20px;
    }

    .footer-top {
        grid-template-columns: 1fr;
        gap: 40px;
        padding-bottom: 40px;
    }

    .footer-logo img {
        max-width: 150px;
    }

    .footer-description {
        font-size: 14px;
    }

    .footer-title {
        font-size: 17px;
        margin-bottom: 20px;
    }

    .footer-links,
    .footer-contact {
        gap: 10px;
    }

    .footer-links li a,
    .footer-contact li {
        font-size: 14px;
    }

    .footer-bottom {
        padding: 24px 0;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .footer-bottom-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 50px 0 0;
    }

    .footer-top {
        gap: 32px;
        padding-bottom: 32px;
    }

    .footer-social {
        gap: 10px;
    }

    .social-link {
        width: 38px;
        height: 38px;
    }

    .footer-title {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .footer-links li a,
    .footer-contact li {
        font-size: 13px;
    }

    .footer-bottom {
        padding: 20px 0;
    }

    .copyright,
    .footer-bottom-links a {
        font-size: 13px;
    }

    .footer-bottom-links {
        gap: 12px;
    }
}
