/**
 * Global Menu Styles for Morse Trainer Pro
 * Professional navigation styling that works across all pages
 */

/* Import Real Professional Flags */
@import url('../css/real-flags.css');

.morse-logo {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 2px;
    color: #60a5fa;
    padding: 8px 12px;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    border-radius: 8px;
    border: 1px solid #4b5563;
    display: inline-block;
}

.professional-header {
    background: linear-gradient(135deg, #1f2937, #111827) !important;
    border-bottom: 2px solid #374151 !important;
    padding: 5px 0 !important;
    position: relative !important;
    z-index: 9999 !important;
}

.nav-link {
    position: relative !important;
    transition: all 0.3s ease !important;
}

.nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    border-radius: 1px;
}

/* Dropdown container improvements for better usability */
.relative {
    position: relative;
}

/* Dropdown menu positioning - remove gap between button and menu */
.relative > div[id$="DropdownMenu"] {
    margin-top: 0px !important; /* Remove gap that causes dropdown to close */
    padding-top: 8px; /* Add padding inside menu instead */
    z-index: 10000 !important; /* Ensure dropdowns are always on top */
}

/* Ensure all dropdown menus appear on top of everything */
[id$="DropdownMenu"] {
    z-index: 10000 !important;
    position: absolute !important;
}

/* Dropdown menu hover states */
.dropdown-item {
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #374151;
    transform: translateX(2px);
}

/* Animation for dropdown appearance */
.dropdown-menu {
    transform-origin: top center;
    animation: fadeInDown 0.2s ease-out;
}

/* Improved dropdown hover area */
.relative:hover > div[id$="DropdownMenu"] {
    pointer-events: auto;
}

/* Make sure dropdown links are clickable */
.relative div[id$="DropdownMenu"] a {
    display: block;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px) translateX(-50%);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(-50%);
    }
}

/* Fix spacing gaps in navigation */
.professional-header nav {
    gap: 4px !important; /* Consistent small gaps */
    position: relative !important;
    z-index: 10000 !important;
}

.professional-header nav .nav-link {
    margin: 0 !important; /* Remove any margin that creates gaps */
}

/* Ensure all nav dropdowns appear on top */
.professional-header nav .relative {
    z-index: 10000 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .professional-header {
        padding: 1rem;
    }
    
    .professional-header .container {
        padding: 1rem;
    }
    
    .professional-header nav {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .dropdown-menu {
        position: fixed;
        left: 1rem;
        right: 1rem;
        width: auto;
        transform: none;
    }
    
    .morse-logo {
        font-size: 14px;
        padding: 6px 10px;
    }
}

/* Focus states for accessibility */
.nav-link:focus,
button:focus {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

/* Loading state for menu items */
.nav-link.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Active state for current page */
.nav-link.active {
    color: #60a5fa !important;
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    border-radius: 1px;
}

/* Help menu specific styles */
.help-category {
    background-color: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    padding: 8px;
    height: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.help-category:hover {
    background-color: rgba(30, 41, 59, 0.7);
}

/* Position help dropdown to align with the last menu item */
#helpDropdownMenu {
    width: 600px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-width: 90vw !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    margin-right: 8px !important; /* Add small margin to align with last menu item */
    z-index: 10000 !important;
    position: absolute !important;
}

/* Force 3-column layout with explicit grid */
#helpDropdownMenu .help-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
}

/* Ensure help menu links are properly styled */
#helpDropdownMenu a {
    transition: all 0.15s ease;
}

#helpDropdownMenu a:hover {
    background-color: rgba(55, 65, 81, 0.7);
}

/* Statistics menu specific styles */
.statistics-category, .analytics-category {
    background-color: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    padding: 8px;
    height: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.statistics-category:hover, .analytics-category:hover {
    background-color: rgba(30, 41, 59, 0.7);
}

/* Force 2-column layout with small gap for statistics grid */
#statisticsDropdownMenu .statistics-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
}

/* Ensure statistics menu links are properly styled */
#statisticsDropdownMenu a {
    transition: all 0.15s ease;
}

#statisticsDropdownMenu a:hover {
    background-color: rgba(55, 65, 81, 0.7);
}

/* Training menu specific styles - Force 4-column layout with minimal gaps */
#trainingDropdownMenu {
    width: 720px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-width: 90vw !important;
    z-index: 10000 !important;
    position: absolute !important;
}

#trainingDropdownMenu .training-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr 1fr !important;
    gap: 4px !important;
    width: 100% !important;
}

/* Training category styling */
.training-category {
    background-color: rgba(30, 41, 59, 0.5);
    border-radius: 6px;
    padding: 6px;
    height: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.training-category:hover {
    background-color: rgba(30, 41, 59, 0.7);
}

/* Ensure training menu links are properly styled */
#trainingDropdownMenu a {
    transition: all 0.15s ease;
}

#trainingDropdownMenu a:hover {
    background-color: rgba(55, 65, 81, 0.7);
}

/* COMPLETELY INVISIBLE Language Switcher Container - NO BOX AT ALL */
#flagLanguageSwitcher {
    position: relative;
    z-index: 10;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-left: 8px;
}

#flagLanguageSwitcher * {
    /* Remove ALL possible box styling from ALL children */
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

#flagLanguageSwitcher .flex {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Professional Flag Buttons - NO BACKGROUND BOX */
.flag-btn {
    padding: 2px !important;
    border-radius: 0 !important;
    background: none !important;
    border: none !important;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    margin: 0 1px !important;
}

.flag-btn:hover {
    background: none !important;
    opacity: 1;
    transform: translateY(-1px);
}

.flag-btn.active {
    opacity: 1;
    background: none !important;
    transform: none;
}

.flag-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 1px;
    background: #60a5fa;
    border-radius: 1px;
}

.flag-emoji {
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.15s ease;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", "Android Emoji", sans-serif;
    font-style: normal;
    font-weight: normal;
}

.flag-btn:hover .flag-emoji {
    transform: scale(1.1);
}

/* Styling for text fallback when flag emojis aren't supported */
.flag-text {
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.flag-btn:hover .flag-text {
    transform: scale(1.05);
}

/* Professional Country Flags - Beautiful and Clean */
.pro-country-flag {
    display: inline-block !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.flag-btn:hover .pro-country-flag {
    transform: scale(1.1) translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.flag-btn.active .pro-country-flag {
    transform: scale(1.05) !important;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.9), 0 2px 8px rgba(0, 0, 0, 0.5) !important;
    border-color: rgba(96, 165, 250, 0.8) !important;
}

/* Remove any box styling that might appear */
.flag-btn:focus {
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
}

/* Responsive adjustments for flag switcher */
@media (max-width: 768px) {
    .flag-btn {
        padding: 3px 4px;
    }
    
    .flag-emoji {
        font-size: 1.25rem !important;
    }
}