/**
 * WebOscar Dropdown Tabs Styling
 * Provides consistent styling for dropdown menus across all pages
 */

/* Dropdown Menus Container */
.dropdown-menus-container {
    position: fixed;
    top: 32px; /* Below the top header */
    left: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none; /* Allow clicks to pass through when dropdowns are closed */
}

/* Individual Dropdown Menu */
.dropdown-menu {
    position: absolute;
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    min-width: 200px;
    max-width: 300px;
    display: none;
    pointer-events: auto; /* Enable clicks on visible dropdowns */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    z-index: 10000;
}

/* Dropdown Items */
.dropdown-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333333;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid transparent;
}

.dropdown-item:hover {
    background-color: #f0f8ff;
    color: #1976d2;
}

.dropdown-item:active {
    background-color: #e3f2fd;
}

/* Menu Text and Shortcuts */
.menu-text {
    flex: 1;
    font-weight: 400;
}

.menu-shortcut {
    font-size: 0.75rem;
    color: #666666;
    margin-left: 20px;
    font-family: 'Courier New', monospace;
}

.menu-arrow {
    margin-left: 10px;
    color: #666666;
    font-size: 0.7rem;
}

/* Submenu indicator for items with submenus */
.has-submenu {
    position: relative;
}

.has-submenu .menu-arrow {
    color: #999999;
}

.has-submenu:hover .menu-arrow {
    color: #1976d2;
}

/* Dropdown Separators */
.dropdown-separator {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
    border: none;
}

/* Active Tab Styling */
.dropdown-tab.active {
    background-color: #0d6efd !important;
    color: white !important;
    border-color: #0d6efd !important;
}

/* Compact Tab Hover Effects */
.nav-tabs-compact .nav-link.dropdown-tab:hover:not(.active) {
    background-color: #dee2e6;
    transform: none; /* Prevent any unwanted transforms */
}

/* Enhanced Menu Item Styling */
.dropdown-item:first-child {
    border-radius: 0 0 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 4px 4px;
}

/* Special styling for important actions */
.dropdown-item[onclick*="import-cpap"] {
    font-weight: 500;
}

.dropdown-item[onclick*="exit"] {
    border-top: 1px solid #e0e0e0;
    margin-top: 4px;
}

.dropdown-item[onclick*="exit"]:hover {
    background-color: #fff5f5;
    color: #d32f2f;
}

/* Disabled menu items (for future use) */
.dropdown-item.disabled {
    color: #999999;
    cursor: not-allowed;
    background-color: transparent;
}

.dropdown-item.disabled:hover {
    background-color: transparent;
    color: #999999;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 180px;
        font-size: 0.8rem;
    }
    
    .dropdown-item {
        padding: 6px 12px;
    }
    
    .menu-shortcut {
        display: none; /* Hide shortcuts on mobile */
    }
}

/* Animation for dropdown appearance */
.dropdown-menu {
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.dropdown-menu[style*="display: block"] {
    opacity: 1;
    transform: translateY(0);
}

/* Ensure dropdowns appear above other content */
.dropdown-menus-container {
    z-index: 9999;
}

.dropdown-menu {
    z-index: 10000;
}

/* Checked/enabled menu items styling */
.dropdown-item-checked {
    font-weight: 500;
}

.dropdown-item-checked .menu-text {
    color: #1976d2;
}

.dropdown-item-checked:hover .menu-text {
    color: #1976d2;
}

/* Focus styles for keyboard navigation (future enhancement) */
.dropdown-item:focus {
    outline: 2px solid #1976d2;
    outline-offset: -2px;
    background-color: #f0f8ff;
}

/* Print styles - hide dropdowns when printing */
@media print {
    .dropdown-menus-container,
    .dropdown-menu {
        display: none !important;
    }
}