/**
 * Generic Dropdown Styles
 * Core dropdown and tooltip styles that can be used across all dropdowns
 * 
 * Usage:
 * - Add .dropdown-container to the wrapper element
 * - Add .dropdown-menu to the dropdown element
 * - Add .dropdown-tooltip (optional) for tooltip
 * - Add .dropdown-inner for the inner scrollable content area
 * 
 * Each specific dropdown should have its own CSS file for:
 * - Trigger button styles (unique to each dropdown)
 * - Option/item styles (unique to each dropdown's content)
 */

/* Dropdown Container */
.dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Dropdown Tooltip */
.dropdown-tooltip {
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: var(--z-tooltip);
}

.dropdown-tooltip::before {
    content: '';
    position: absolute;
    top: -0.25rem;
    left: 50%;
    transform: translateX(-50%);
    border-left: 0.25rem solid transparent;
    border-right: 0.25rem solid transparent;
}

.dropdown-container:hover .dropdown-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 10rem;
    border: 1px solid;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.2s ease;
    z-index: var(--z-dropdown);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0.5rem);
}

/* Dropdown Inner Content */
.dropdown-inner {
    padding: 0.5rem;
}

/* Scrollable dropdown support */
.dropdown-inner.scrollable {
    max-height: 16rem;
    overflow-y: auto;
}

/* Generic Dropdown Options */
.dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
    .dropdown-menu {
        min-width: 8rem;
    }
    
    .dropdown-tooltip {
        font-size: 0.625rem;
        padding: 0.375rem 0.5rem;
    }
}

@media screen and (max-width: 480px) {
    .dropdown-menu {
        right: -1rem;
        min-width: 8rem;
        max-width: calc(100vw - 2rem); /* Prevent overflow on small screens */
    }
    
    .dropdown-option {
        white-space: normal; /* Allow wrapping on very small screens */
    }
}

/* Theme Coloration - Automatic via CSS variables */
.dropdown-tooltip {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-tooltip::before {
    border-bottom-color: var(--bg-tertiary);
}

.dropdown-menu {
    background-color: var(--bg-secondary);
    border-color: var(--border-primary);
}

.dropdown-option {
    color: var(--text-secondary);
}

.dropdown-option:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.dropdown-option.active {
    background-color: var(--active-bg);
    color: var(--text-primary);
}

.dropdown-option.active:hover {
    background-color: var(--active-bg);
}
