/**
 * Modern Gemstone Selector Styles
 * Clean, minimalistic design with luxury touches
 */

.gemstone-selector-wrapper {
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Tier 1 Tabs (Natural vs Lab-Grown) - Compact */
.tier1-selector {
    margin-bottom: 0.75rem;
}

.tier1-tabs {
    display: flex;
    gap: 1px;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 2px;
}

.tier1-tab {
    flex: 1;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: #666;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}

.tier1-tab:hover {
    background: rgba(188, 138, 95, 0.1);
    color: #bc8a5f;
}

.tier1-tab.active {
    background: #bc8a5f;
    color: white;
}

/* Tier 2 Tabs (Category Groups) - Compact */
.tier2-selector {
    margin-bottom: 0.75rem;
}

.tier2-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tier2-tab {
    padding: 0.3rem 0.6rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.tier2-tab:hover {
    background: #e9ecef;
    border-color: #bc8a5f;
    color: #bc8a5f;
}

.tier2-tab.active {
    background: #bc8a5f;
    border-color: #bc8a5f;
    color: white;
}

/* Search Input with Autofill - Compact */
.gemstone-search-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
}

.search-input-container {
    position: relative;
}

.gemstone-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    padding-right: 2rem;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fafafa;
    transition: all 0.2s ease;
}

.gemstone-search-input:focus {
    outline: none;
    border-color: #bc8a5f;
    background: white;
    box-shadow: 0 0 0 2px rgba(188, 138, 95, 0.1);
}

.search-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 0.8rem;
}

/* Suggestions Dropdown */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 120px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s ease;
}

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

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-name {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
}

.suggestion-category {
    display: block;
    font-size: 0.8rem;
    color: #666;
}

/* Gemstone Grid - Responsive Layout */
.gemstone-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    /* Removed max-height and overflow-y to fix diamond matrix upload section scroll issue */
}

.gemstone-card {
    background: white;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 0.5rem 0.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.gemstone-card:hover {
    border-color: #bc8a5f;
    box-shadow: 0 4px 12px rgba(188, 138, 95, 0.15);
    transform: translateY(-2px);
}

.gemstone-card.selected {
    border-color: #bc8a5f;
    background: rgba(188, 138, 95, 0.05);
}

.gemstone-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gemstone-svg {
    width: 100%;
    height: 100%;
}

.gemstone-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.gemstone-type {
    font-size: 0.8rem;
    color: #666;
    font-weight: 400;
}

/* Selected Value Display */
.selected-value {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

.selected-text {
    font-weight: 500;
    color: #333;
}

.clear-selection {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.clear-selection:hover {
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gemstone-selector-wrapper {
        padding: 1rem;
    }
    
    .tier1-tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .tier2-tab {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .gemstone-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .gemstone-card {
        padding: 0.75rem 0.5rem;
        min-height: 90px;
    }
    
    .gemstone-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 0.5rem;
    }
    
    .gemstone-name {
        font-size: 0.8rem;
    }
    
    .gemstone-type {
        font-size: 0.7rem;
    }
}

/* Animation for smooth transitions */
.gemstone-grid {
    transition: opacity 0.3s ease;
}

.tier2-tabs {
    transition: opacity 0.2s ease;
}

/* Focus states for accessibility */
.tier1-tab:focus,
.tier2-tab:focus,
.gemstone-card:focus,
.gemstone-search-input:focus {
    outline: 2px solid #bc8a5f;
    outline-offset: 2px;
}

/* Loading state */
.gemstone-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.gemstone-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #e5e5e5;
    border-top: 2px solid #bc8a5f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}