/* Dropdown Navigation Fixes */

/* Base dropdown styles */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown > button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 1rem 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
    white-space: nowrap;
}

/* Mega menu styling */
.nav-mega-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 900px;
    max-width: 95vw;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    margin-top: 0.5rem;
    opacity: 0;
    transform: translateX(-70%) translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
    padding: 1rem;
    left: 50%;
}

/* Special positioning for startup tools dropdown */
.startup-tools-dropdown .nav-mega-dropdown-menu {
    left: 0;
    
    transform: translateX(0) translateY(-10px);
}

.startup-tools-dropdown:hover .nav-mega-dropdown-menu {
    transform: translateX(-50%) translateY(0);
}

[dir="rtl"] .startup-tools-dropdown:hover .nav-mega-dropdown-menu {
    transform: translateX(-60%) translateY(0);
}

.nav-dropdown:hover .nav-mega-dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateX(-35%) translateY(0);
}

.ecosystem-nav-dropdown:hover .nav-mega-dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.mega-menu-section {
    padding: 0.5rem;
}

.mega-menu-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.mega-menu-section a {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

.mega-menu-section a:hover {
    background: #f3f4f6;
    color: #7c3aed;
}

.mega-menu-section a i {
    width: 20px;
    margin-right: 0.5rem;
    text-align: center;
    color: #6b7280;
}

.mega-menu-section a:hover i {
    color: #7c3aed;
}

.mega-menu-featured {
    grid-column: span 4;
    display: flex;
    align-items: center;
    background: #f9fafb;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.mega-menu-featured-title {
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.mega-menu-image {
    width: 120px;
    height: 80px;
    border-radius: 0.375rem;
    object-fit: cover;
    margin-right: 1rem;
}

.mega-menu-featured-content {
    flex: 1;
}

/* Auto-sliding featured carousel - ENHANCED */
.mega-menu-featured-carousel {
    position: relative;
    overflow: hidden;
    width: 100%;
    grid-column: span 4;
    background: #f9fafb;
    border-radius: 0.375rem;
    margin-top: 0.5rem;
    /* Fixed height to ensure consistent display */
    height: 140px;
}

.mega-menu-featured-slider {
    display: flex;
    width: 100%;
    height: 100%;
    /* Remove transition from here - will be added via JS */
    will-change: transform;
}

.mega-menu-featured-slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    padding: 0.75rem;
    display: flex;
    align-items: center;
}

.mega-menu-carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    /* Semi-transparent background for better visibility */
    background-color: rgba(255, 255, 255, 0.7);
}

.mega-menu-carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #e5e7eb;
    transition: all 0.2s;
    cursor: pointer;
}

.mega-menu-carousel-indicator.active {
    background-color: #7c3aed;
    transform: scale(1.3);
}

/* Make images consistent in carousel */
.mega-menu-featured-slide .mega-menu-image {
    width: 100px;
    height: 70px;
    min-width: 100px;
    object-fit: cover;
    border-radius: 0.375rem;
    margin-right: 1rem;
}

/* Ensure the content doesn't overflow */
.mega-menu-featured-slide .mega-menu-featured-content {
    flex: 1;
    overflow: hidden;
}

/* Dark theme adjustments for the carousel */
.dark-theme .mega-menu-featured-carousel {
    background: #1f2937;
}

.dark-theme .mega-menu-carousel-indicators {
    background-color: rgba(31, 41, 55, 0.7);
}

.dark-theme .mega-menu-carousel-indicator {
    background-color: #4b5563;
}

.dark-theme .mega-menu-carousel-indicator.active {
    background-color: #a78bfa;
}

/* RTL support for carousel */
[dir="rtl"] .mega-menu-featured-slide .mega-menu-image {
    margin-right: 0;
    margin-left: 1rem;
}

/* Dropdown menu - initially hidden */
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    margin-top: 0.5rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
}

/* Dropdown menu links */
.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-dropdown-menu a:hover {
    background: #f3f4f6;
    color: #7c3aed;
}

.nav-dropdown-menu a i {
    width: 20px;
    margin-right: 0.5rem;
    text-align: center;
    color: #6b7280;
}

.nav-dropdown-menu a:hover i {
    color: #7c3aed;
}

/* Dark theme dropdown */
.dark-theme .nav-dropdown-menu {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.dark-theme .nav-dropdown-menu a {
    color: #d1d5db;
}

.dark-theme .nav-dropdown-menu a:hover {
    background: #374151;
    color: #a78bfa;
}

.dark-theme .nav-dropdown-menu a i {
    color: #9ca3af;
}

.dark-theme .nav-dropdown-menu a:hover i {
    color: #a78bfa;
}

/* Enhanced Dark theme mega menu */
.dark-theme .nav-mega-dropdown-menu {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.dark-theme .mega-menu-section h4 {
    color: #e5e7eb;
    border-color: #374151;
}

.dark-theme .mega-menu-section a {
    color: #d1d5db;
}

.dark-theme .mega-menu-section a:hover {
    background: #374151;
    color: #a78bfa;
}

.dark-theme .mega-menu-section a i {
    color: #9ca3af;
}

.dark-theme .mega-menu-section a:hover i {
    color: #a78bfa;
}

.dark-theme .mega-menu-featured {
    background: #111827;
}

.dark-theme .mega-menu-featured-title {
    color: #e5e7eb;
}

.dark-theme .mega-menu-featured p {
    color: #9ca3af !important;
}

.dark-theme .mega-menu-featured a,
.dark-theme .mega-menu-featured-content a {
    color: #a78bfa !important;
}

.dark-theme .mega-menu-featured a:hover,
.dark-theme .mega-menu-featured-content a:hover {
    color: #c4b5fd !important;
}

/* Auto-sliding featured carousel - ENHANCED DARK MODE */
.dark-theme .mega-menu-featured-carousel {
    background: #111827;
    border: 1px solid #374151;
}

.dark-theme .mega-menu-featured-slide p {
    color: #9ca3af !important;
}

.dark-theme .mega-menu-carousel-indicators {
    background-color: rgba(17, 24, 39, 0.8);
}

.dark-theme .mega-menu-carousel-indicator {
    background-color: #4b5563;
}

.dark-theme .mega-menu-carousel-indicator.active {
    background-color: #a78bfa;
}

.dark-theme .mega-menu-featured-slide .mega-menu-featured-title {
    color: #e5e7eb;
}

.dark-theme .mega-menu-featured-slide .mega-menu-featured-content a {
    color: #a78bfa !important;
}

.dark-theme .mega-menu-featured-slide .mega-menu-featured-content a:hover {
    color: #c4b5fd !important;
}

/* RTL support */
[dir="rtl"] .nav-dropdown-menu {
    left: auto;
    right: 0;
}

[dir="rtl"] .nav-dropdown-menu a i {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Header dropdown fixes */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    min-width: 200px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
}

.dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Fix for dark theme header dropdowns */
.dark-theme .dropdown-menu {
    background: #1f2937;
    border-color: #374151;
}

.dark-theme .dropdown-menu a {
    color: #d1d5db;
}

.dark-theme .dropdown-menu a:hover {
    background: #374151;
}

/* Mobile menu fixes */
.mobile-menu {
    display: block;
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.mobile-menu.show {
    left: 0;
}

[dir="rtl"] .mobile-menu {
    left: auto;
    right: -100%;
}

[dir="rtl"] .mobile-menu.show {
    left: auto;
    right: 0;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.mobile-menu-overlay.show {
    display: block;
}

/* Dark theme mobile menu */
.dark-theme .mobile-menu {
    background: #1f2937;
}

.dark-theme .mobile-menu a {
    color: #d1d5db;
}

.dark-theme .mobile-menu a:hover {
    background: #374151;
}

/* Mobile dropdown styles */
.mobile-nav-dropdown .dropdown-content {
    display: none;
    padding-left: 1rem;
    background: #f9fafb;
}

.dark-theme .mobile-nav-dropdown .dropdown-content {
    background: #111827;
}

.mobile-nav-dropdown.open .dropdown-content {
    display: block;
}

.mobile-nav-dropdown .dropdown-toggle {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-nav-dropdown .dropdown-toggle i.fa-chevron-down {
    transition: transform 0.3s;
}

.mobile-nav-dropdown.open .dropdown-toggle i.fa-chevron-down {
    transform: rotate(180deg);
}

/* Ensure dropdowns are above other content */
.nav-dropdown,
.relative {
    z-index: auto;
}

/* Active state for dropdown buttons */
.nav-dropdown > button.active {
    border-bottom-color: #7c3aed;
    color: #7c3aed;
}

/* Horizontal sliding mega menu styles */
.mega-menu-slider-container {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.mega-menu-slider {
    display: flex;
    transition: transform 0.4s ease;
    width: 100%;
}

.mega-menu-slide {
    min-width: 100%;
    flex-shrink: 0;
}

/* Slider navigation buttons */
.mega-menu-nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.mega-menu-nav-button {
    background: #f3f4f6;
    border: none;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}

.mega-menu-nav-button:hover {
    background: #e5e7eb;
    color: #7c3aed;
}

.mega-menu-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #9ca3af;
}

.mega-menu-slide-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.mega-menu-slide-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #e5e7eb;
    transition: all 0.2s;
    cursor: pointer;
}

.mega-menu-slide-dot.active {
    background-color: #7c3aed;
    transform: scale(1.2);
}

/* Dark theme for slider */
.dark-theme .mega-menu-nav-buttons {
    border-color: #374151;
}

.dark-theme .mega-menu-nav-button {
    background: #1f2937;
    color: #d1d5db;
}

.dark-theme .mega-menu-nav-button:hover {
    background: #374151;
    color: #a78bfa;
}

.dark-theme .mega-menu-slide-dot {
    background-color: #4b5563;
}

.dark-theme .mega-menu-slide-dot.active {
    background-color: #a78bfa;
}

/* RTL support for slider */
[dir="rtl"] .mega-menu-nav-button i.fa-chevron-left {
    transform: rotate(180deg);
}

[dir="rtl"] .mega-menu-nav-button i.fa-chevron-right {
    transform: rotate(180deg);
}

/* Responsive adjustments for slider */
@media (max-width: 640px) {
    .mega-menu-nav-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .desktop-nav {
        display: none !important;
    }
    
    .mobile-menu-button {
        display: flex !important;
    }
}

@media (min-width: 1025px) {
    .mobile-menu-button {
        display: none !important;
    }
}

/* Fix for navigation overflow on tablets */
@media (max-width: 1280px) {
    .desktop-nav .container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .desktop-nav .flex {
        min-width: max-content;
    }
}