/* Custom styles for TLD Checker */

/* Status indicators */
.status-available {
    color: #10b981;
    font-weight: 600;
}

.status-taken {
    color: #ef4444;
    font-weight: 600;
}

.status-error {
    color: #f59e0b;
    font-weight: 600;
}

/* Hover effect for result rows */
#resultsBody tr {
    transition: background-color 0.2s ease;
}

#resultsBody tr:hover {
    background-color: rgba(243, 244, 246, 0.5);
}

.dark #resultsBody tr:hover {
    background-color: rgba(55, 65, 81, 0.5);
}

/* Domain name highlight */
.domain-name {
    font-weight: 500;
}

/* Custom animation for checking */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.checking {
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Progress bar animation */
#progressBar {
    transition: width 0.3s ease;
}

/* Sort and filter controls - Adjusted for better responsiveness */
#sortSelect, #filterSelect, #categoryFilterSelect {
    min-width: 120px;
    max-width: 100%;
    flex-shrink: 1;
}

@media (max-width: 640px) {
    #sortSelect, #filterSelect, #categoryFilterSelect {
        min-width: 100px;
    }
}

/* Result count text */
#resultCount {
    font-style: italic;
}

/* Empty results message */
.empty-results {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-style: italic;
}

/* Category container when disabled */
#categoryContainer.opacity-50 {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

/* Category checkboxes */
.category-checkbox-container {
    transition: all 0.2s ease;
}

/* Category badges in results */
.category-badge {
    display: inline-block;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

/* Category selection section */
#categorySelectionSection {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 1rem;
}

.dark #categorySelectionSection {
    border-top-color: #374151;
}

/* Category container animations */
#categoryContainer {
    transition: all 0.3s ease-in-out;
    overflow: visible;
    max-height: none;  /* Will be set by JavaScript */
    position: relative;
    z-index: 10;
    margin-bottom: 30px; /* Add space between categories and next element */
}

#categoryContainer.hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}

#categoryContainer:not(.hidden) {
    max-height: 2000px; /* Much higher value to accommodate tooltips */
    opacity: 1;
}

/* Category and subcategory styling - Updated */
.category-group {
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    padding-bottom: 0.75rem;
    overflow: visible !important;
    position: relative;
    z-index: 1;
}

.category-group:last-child {
    border-bottom: none;
}

/* Improve subcategories display */
.subcategories {
    transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
    max-height: 0;
    overflow: visible; /* Changed from hidden to visible */
    opacity: 0;
    position: relative;
    z-index: 15;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.subcategories.show {
    max-height: 1000px;
    opacity: 1;
    padding-top: 0.5rem;
    padding-bottom: 12px;
}

/* Subcategory items for side-by-side arrangement */
.subcategory-item {
    display: inline-block;
    margin-bottom: 0.5rem;
    margin-right: 1rem;
    position: relative; /* Add positioning context */
    z-index: 16; /* Higher than subcategories-wrapper */
}

/* Tooltip styling - Fixed for subcategories with better z-index and positioning */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    z-index: 20; /* Higher than default content */
}

.tooltip-text {
    visibility: hidden;
    position: absolute;
    z-index: 1000; /* Much higher z-index to ensure it's above everything */
    background-color: rgba(55, 65, 81, 0.98);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    width: max-content;
    max-width: 300px; /* Slightly wider to accommodate more text */
    top: 125%;
    left: 0;
    margin-top: 0.5rem; /* Increased margin to avoid cutoff */
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

/* Main category tooltips - center aligned */
.category-group > div > .tooltip-container .tooltip-text {
    left: 50%;
    transform: translateX(-50%);
}

/* Ensure tooltip stays visible when parent is hovered */
.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Subcategory tooltip positioning - improved */
.subcategory-item .tooltip-container {
    position: relative;
}

.subcategory-item .tooltip-text {
    left: 0;
    top: 100%; 
    min-width: 160px;
    z-index: 1000; /* Extremely high z-index to overcome any potential stacking context issues */
}

/* Make sure the tooltip is not cut off by container boundaries */
.subcategories-wrapper {
    overflow: visible !important;
    position: relative;
    z-index: 15; /* Higher than category container */
}

/* Fix for the tooltip container in the subcategory */
.subcategory-item .ml-1 {
    position: relative;
    z-index: 2;
}

/* Add margin between subcategory name and count */
.subcategory-count {
    margin-left: 0.25rem;
}

/* Subcategory items for side-by-side arrangement - improved */
.subcategory-item {
    display: inline-block;
    margin-bottom: 0.5rem;
    margin-right: 1rem;
    position: relative; /* Add positioning context */
}

/* Toggle button styles */
#toggleCategoriesBtn {
    transition: all 0.2s ease;
}

#toggleCategoriesBtn:hover {
    background-color: #e5e7eb;
}

.dark #toggleCategoriesBtn:hover {
    background-color: #4b5563;
}

/* Disabled category styling */
.category-checkbox:disabled + label {
    opacity: 0.6;
}

/* Category group styling */
.advanced-categories-wrapper {
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10; /* Lower than tooltips but higher than regular content */
}

/* TLD Length Range Slider */
#tldMinLengthSlider, #tldMaxLengthSlider {
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
}

.dark #tldMinLengthSlider, .dark #tldMaxLengthSlider {
    background: #374151;
}

#tldMinLengthSlider::-webkit-slider-thumb, #tldMaxLengthSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dark #tldMinLengthSlider::-webkit-slider-thumb, .dark #tldMaxLengthSlider::-webkit-slider-thumb {
    background: #60a5fa;
    border-color: #1f2937;
}

#tldMinLengthSlider::-moz-range-thumb, #tldMaxLengthSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dark #tldMinLengthSlider::-moz-range-thumb, .dark #tldMaxLengthSlider::-moz-range-thumb {
    background: #60a5fa;
    border-color: #1f2937;
}

#tldMinLengthSlider:focus, #tldMaxLengthSlider:focus {
    outline: none;
}

#tldMinLengthSlider:focus::-webkit-slider-thumb, #tldMaxLengthSlider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

#tldMinLengthSlider:focus::-moz-range-thumb, #tldMaxLengthSlider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Search input styling */
#searchResults {
    transition: all 0.2s ease-in-out;
}

#searchResults:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Highlight search matches in results (optional enhancement) */
.search-highlight {
    background-color: rgba(254, 240, 138, 0.5);
    padding: 0 2px;
    border-radius: 2px;
}

.dark .search-highlight {
    background-color: rgba(254, 240, 138, 0.3);
}

/* Additional styles for consistent footer positioning */
html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
    position: relative;
    z-index: 5;
    margin-bottom: 20px; /* Add space between main content and footer */
    padding-bottom: 50px; /* Add extra padding at bottom */
}

footer {
    flex-shrink: 0;
    position: relative;
    z-index: 50; /* Ensure footer is above other content */
}
