/**
 * Content Dropdown Styles for NAPCH Admin Dashboard
 * Provides styling for searchable dropdown components
 */

/* Main dropdown container */
.content-dropdown-container {
    margin-top: 15px;
    margin-bottom: 20px;
}

.content-dropdown-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.content-dropdown-section {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.content-dropdown-label {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

/* Search input styling */
.content-dropdown-search {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.content-dropdown-search:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.content-dropdown-search.searching {
    border-color: #28a745;
}

/* Search icon - now clickable */
.content-dropdown-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.content-dropdown-icon:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Dropdown menu - NUCLEAR OPTION - ALWAYS HIDDEN BY DEFAULT */
.content-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none !important; /* NUCLEAR OPTION */
    visibility: hidden !important; /* NUCLEAR OPTION */
    opacity: 0 !important; /* NUCLEAR OPTION */
    height: 0 !important; /* NUCLEAR OPTION */
    width: 0 !important; /* NUCLEAR OPTION */
    overflow: hidden !important; /* NUCLEAR OPTION */
    position: absolute !important;
    left: -9999px !important; /* NUCLEAR OPTION - MOVE OFF SCREEN */
}

/* Hide class - NUCLEAR HIDING */
.content-dropdown-menu.hide {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
}

.content-dropdown-menu.show {
    display: block !important; /* Override the default hidden state */
    visibility: visible !important; /* Override the default hidden state */
    opacity: 1 !important; /* Override the default hidden state */
    height: auto !important; /* Override the default hidden state */
    width: auto !important; /* Override the default hidden state */
    overflow: visible !important; /* Override the default hidden state */
    position: absolute !important;
    left: 0 !important; /* Bring back on screen */
    top: 100% !important; /* Bring back on screen */
}

/* Dropdown items */
.content-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.content-dropdown-item:last-child {
    border-bottom: none;
}

.content-dropdown-item:hover,
.content-dropdown-item.highlighted {
    background-color: #f8f9fa;
}

.content-dropdown-item.selected {
    background-color: #e3f2fd;
    color: #1976d2;
}

.content-dropdown-item-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.content-dropdown-item-description {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

/* Category sections */
.content-dropdown-category {
    background-color: #f8f9fa;
    padding: 8px 15px;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e9ecef;
}

/* Loading and empty states */
.content-dropdown-loading,
.content-dropdown-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.content-dropdown-loading {
    background-color: #f8f9fa;
}

.content-dropdown-empty {
    color: #999;
}

/* Search highlighting */
.content-dropdown-item mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Error states */
.content-dropdown-error {
    padding: 15px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-top: 5px;
    font-size: 13px;
}

/* Recent selections */
.content-dropdown-recent {
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 5px;
}

.content-dropdown-recent-item {
    background-color: #fff;
    border-left: 3px solid #28a745;
}

/* Keyboard navigation indicators */
.content-dropdown-item.keyboard-focus {
    background-color: #e3f2fd;
    outline: 2px solid #2196f3;
    outline-offset: -2px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .content-dropdown-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .content-dropdown-section {
        min-width: auto;
    }
    
    .content-dropdown-menu {
        max-height: 250px;
    }
    
    .content-dropdown-item {
        padding: 10px 12px;
    }
    
    .content-dropdown-search {
        padding: 8px 35px 8px 10px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Animation for dropdown appearance */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-dropdown-menu.show {
    animation: dropdownFadeIn 0.2s ease-out;
}

/* Scrollbar styling for webkit browsers */
.content-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.content-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.content-dropdown-menu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.content-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus states for accessibility */
.content-dropdown-search:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.content-dropdown-item:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .content-dropdown-search {
        border-width: 3px;
    }
    
    .content-dropdown-item:hover,
    .content-dropdown-item.highlighted {
        background-color: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .content-dropdown-search,
    .content-dropdown-item {
        transition: none;
    }
    
    .content-dropdown-menu.show {
        animation: none;
    }
}
