/* Custom Styles for AdZ Landing Page - COMPLETE FILE */

/* ============================================
   MOBILE OVERFLOW FIX - CRITICAL
   ============================================ */
/* These rules ensure Bootstrap's mobile behavior doesn't break */
.navbar-nav .nav-link {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.navbar-nav .nav-item {
    display: flex !important;
    visibility: visible !important;
    /* FIX 1: Added position: relative for mobile dropdown stability to fix flicker */
    position: relative !important; 
}

.navbar-collapse {
    visibility: visible !important;
}

/* Ensure bootstrap classes work properly */
.navbar-expand-lg .navbar-nav {
    flex-direction: row !important;
}

@media (max-width: 991.98px) {
    .navbar-expand-lg .navbar-nav {
        flex-direction: column !important;
    }
}

/* Fix for dropdown visibility */
.dropdown-toggle {
    display: inline-flex !important;
    align-items: center;
}

/* Ensure text is visible */
.nav-link, .dropdown-item {
    color: #334155 !important;
    text-decoration: none;
}

* {
    box-sizing: border-box;
}

/* ============================================
   GLOBAL SCROLLBAR FIX (The single source of truth)
   ============================================ */
html {
    overflow-x: hidden !important; /* ONLY apply overflow-x: hidden here */
    max-width: 100vw;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-top: 80px; /* Offset for fixed header */
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
    position: relative;
}

/* Prevent all sections from causing horizontal scroll */
section, div, .container, main {
    max-width: 100%;
}

/* Fix for row elements */
.row {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
    width: 100%; 
}

.col, [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100%;
}

/* Fix for images and media */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Fix for tables */
table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* ============================================
   NAVBAR STYLES - FIXED HEADER
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 0;
    z-index: 1050;
    width: 100%;
}

/* Hamburger Menu Icon Fix */
.navbar-toggler {
    border: 2px solid #2563EB;
    padding: 0.5rem 0.75rem;
    z-index: 1051;
    background: white;
    position: relative;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
    outline: none;
}

/* Custom Hamburger Icon */
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(37, 99, 235, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 24px;
    height: 24px;
    display: inline-block;
}

.navbar-collapse {
    z-index: 1049;
}

.navbar-brand img {
    height: 80px;
}

.nav-link {
    color: #374151 !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s;
}


.nav-link.active {
    color: #ffffff !important;
}

.btn-primary {
    background-color: #2563EB;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    color: white;
    display: inline-block;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

/* .navbar-nav .nav-item rule moved up to critical fixes (line 30) */

.dropdown-toggle::after {
    margin-left: 0.5rem;
}

/* Desktop Alignment for Region Dropdown and Signup Button */
.navbar-nav {
    align-items: center; 
}
.navbar-nav .dropdown-toggle {
    padding: 0.5rem 0.75rem !important; 
    margin-right: 0.5rem; 
    border-radius: 0.5rem; 
    display: inline-flex !important;
    align-items: center;
}
.navbar-nav .btn-primary {
    margin-left: 1rem; 
    align-self: center; 
    white-space: nowrap; 
}

/* ============================================
   MOBILE RESPONSIVE FIXES
   ============================================ */
@media (max-width: 991.98px) {
    body {
        padding-top: 70px;
        width: 100vw;
    }

    .navbar {
        min-height: 70px;
        padding: 0.75rem 0;
        width: 100%;
    }

    .container {
        padding-left: 15px;
        padding-right: 15px;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .navbar-brand img {
        max-height: 80px;
    }

    .navbar-toggler {
        padding: 0.4rem 0.6rem;
        margin-right: 0.5rem;
    }

    .navbar-collapse {
        background: white;
        padding: 1rem;
        margin-top: 1rem;
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0.5rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        max-width: 100%;
    }

    .navbar-nav {
        align-items: flex-start;
        gap: 0;
        width: 100%;
    }

    .navbar-nav .nav-item,
    .navbar-nav .nav-link,
    .btn-heading {
        width: 100%;
        display: block;
        margin: 0.5rem 0;
        text-align: left;
    }

    /* Mobile Dropdown Fixes */
    .dropdown-menu {
        position: static !important; 
        width: 100% !important; /* Ensure it takes full width of the collapsed navbar */
        border-radius: 0.5rem;
        background: #f8f9fa;
        box-shadow: none;
        margin-top: 0.5rem;
        padding-left: 1rem;
        
        /* FIX 2: Force GPU rendering for smooth scrolling (anti-flicker) */
        transform: translate3d(0, 0, 0); 
    }
    .dropdown-menu .dropdown-item {
        padding: 0.5rem 1rem;
        color: #334155;
    }
    .dropdown-menu .dropdown-item:hover {
        background-color: #e9ecef;
        color: #2563EB;
    }
    .dropdown-menu {
        box-shadow: none !important;
        border: none !important;
    }
    
    /* === MOBILE DROPDOWN FLICKER FIX (Blinking & Positioning) === */
    .navbar-collapse .dropdown-menu {
        z-index: 1052 !important; 
        position: static !important; 
        background-color: white !important; 
    }
    /* ========================================================== */


    /* ===== FIX NAVBAR TEXT COLOR & REMOVE HORIZONTAL SCROLLBAR ===== */

    /* Ensure navbar links are visible (black text) */
    .navbar-nav .nav-link,
    .dropdown-menu .dropdown-item {
        color: #000 !important;
    }

    /* Highlight active or hover states in blue */
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link.active,
    .dropdown-menu .dropdown-item:hover {
        color: #2563EB !important;
    }

    /* Fix for sections causing overflow */
    section {
        padding-left: 1rem;
        padding-right: 1rem;
        width: 100%;
    }

    /* Tailwind utility class fixes */
    .max-w-6xl, .max-w-4xl {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Grid fixes for mobile */
    .grid {
        width: 100%;
        max-width: 100%;
    }

    /* Tab content fixes */
    .tab-content {
        max-width: 100%;
    }

    .tab-pane .row {
        margin-left: 0;
        margin-right: 0;
    }

    /* Activity cards on mobile */
    .activity-card {
        max-width: 100%;
        word-wrap: break-word;
    }

    /* Comparison table wrapper for mobile */
    .comparison-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Nav pills overflow fix */
    .nav-pills {
        gap: 0.5rem;
        padding: 0.5rem 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-pills .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
    }

    /* Text overflow fix */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    /* Padding utilities fix */
    .px-4, .px-6, .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* ============================================
   DROPDOWN OVERRIDE (Desktop Fix)
   ============================================ */
@media (min-width: 992px) {
    /* CRITICAL: Set parent to static for correct positioning context in fixed navbar */
    .navbar-nav .nav-item.dropdown {
        position: static; 
    }
    
    /* Ensure the dropdown menu is absolutely positioned and aligns to the right edge of the button/navbar */
    .dropdown-menu {
        position: absolute;
        top: 100%; 
        border: 1px solid #ddd;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        /* FIX: Align the dropdown's right edge with the button. */
        right: 0 !important; 
        left: auto !important;
    }
}

/* Nav pills responsive */
.nav-pills {
    flex-wrap: wrap;
    max-width: 100%;
}

/* ============================================
   SCROLL TO TOP BUTTON - FIXED
   ============================================ */
#scrollTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    width: 50px;
    height: 50px;
    background-color: #2563EB;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
    outline: none;
}

#scrollTopBtn:hover {
    background-color: #1d4ed8;
    transform: scale(1.1);
}

#scrollTopBtn:active {
    transform: scale(0.95);
}

/* Mobile positioning for scroll button */
@media (max-width: 768px) {
    #scrollTopBtn {
        bottom: 80px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* ============================================
   WHATSAPP BUTTON
   ============================================ */
#whatsappBtn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 998;
    width: 50px;
    height: 50px;
    background-color: #25d366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    text-decoration: none;
    transition: all 0.3s;
}

#whatsappBtn:hover {
    background-color: #1ebc57;
    color: white;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    #whatsappBtn {
        bottom: 80px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    padding: 3rem 0;
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem !important;
    }
    
    .hero-section h2 {
        font-size: 1.5rem !important;
    }
}

/* ============================================
   CARD STYLES
   ============================================ */
.ai-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 1.5rem;
    height: 100%;
    max-width: 100%;
}

.gradient-box {
    background-image: linear-gradient(135deg, #F9D6FF 0%, #B8E1FF 100%);
}

.transit-bg {
    background-color: #F8FFF9;
    border: 1px solid #E6F7E6;
}

@media (max-width: 768px) {
    .ai-card {
        margin-bottom: 1.5rem;
    }
}

/* ============================================
   FOOTER STYLES
   ============================================ */
footer {
    background: #1a202c;
    color: white;
    padding: 60px 0 20px 0;
    max-width: 100vw;
}

footer .container {
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 40px;
    padding-right: 40px;
}

.footer-content { 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: #4F46E5;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #cbd5e0;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #4F46E5;
}

.social-icons a {
    margin-right: 10px;
    font-size: 20px;
    color: white;
    transition: color 0.3s;
}

.social-icons a:hover {
    color: #0c3cda;
}

.footer-bottom {
    border-top: 1px solid #2d3748;
    padding-top: 2rem;
    text-align: center;
    color: #cbd5e0;
}

@media (max-width: 992px) {
    footer .container {
        max-width: 95%;
        padding-left: 30px;
        padding-right: 30px;
    }

    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    footer .container {
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}