/* Modern & Minimalist UI for UNSPSC - Premium Searchable Selects */
:root {
    --unspsc-primary: #233A79;
    --unspsc-primary-soft: rgba(35, 58, 121, 0.05);
    /* Previous: #2271b1 and rgba(34, 113, 177, 0.05) */
}

.unspsc-frontend-container {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    color: #2d3748;
    padding: 2.5rem;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.03);
    max-width: 1100px;
    margin: 2rem auto;
}

.unspsc-search-header {
    text-align: center;
    margin-bottom: 3rem;
}

.unspsc-search-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.unspsc-subtitle {
    color: #718096;
    font-size: 1.1rem;
}

/* Main Search Box */
.unspsc-search-box {
    display: flex;
    background: #f7fafc;
    padding: 8px;
    border-radius: 18px;
    border: 2px solid #edf2f7;
    margin: 2rem 0;
    position: relative;
    gap: 10px;
    align-items: center;
}

.search-icon {
    color: #a0aec0;
    margin-left: 15px;
    font-size: 20px;
}

.unspsc-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 15px;
    font-size: 1.1rem;
    color: #1a202c;
}

.unspsc-search-box input:focus {
    outline: none;
}

.search-actions {
    display: flex;
    gap: 8px;
    margin-right: 8px;
}

#unspsc-search-btn {
    background: var(--unspsc-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

#unspsc-search-btn:hover {
    background: #1a2d5e;
    transform: translateY(-1px);
}

#unspsc-reset-btn {
    background: #edf2f7;
    color: #4a5568;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

#unspsc-reset-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

#unspsc-reset-btn i {
    font-size: 16px;
    margin-top: -2px;
}

/* Custom Searchable Selects */
.unspsc-advanced-filters {
    display: flex;
    gap: 20px;
    text-align: left;
    position: relative;
}

.filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unspsc-custom-select {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.unspsc-custom-select:hover {
    border-color: #cbd5e0;
}

.unspsc-custom-select.open {
    border-color: var(--unspsc-primary);
    box-shadow: 0 0 0 3px var(--unspsc-primary-soft);
}

.select-trigger {
    padding: 10px 15px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: #4a5568;
}

.select-trigger span.selected {
    color: #1a202c;
    font-weight: 600;
}

.select-trigger i {
    color: #718096;
    font-size: 14px;
    transition: transform 0.2s;
}

.unspsc-custom-select.open .select-trigger i {
    transform: rotate(180deg);
}

.select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.unspsc-custom-select.open .select-dropdown {
    display: flex;
}

.search-container {
    padding: 10px;
    background: #f8fafc;
    border-bottom: 1px solid #edf2f7;
}

.select-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.select-search:focus {
    border-color: var(--unspsc-primary);
}

.select-options {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
}

.select-options li {
    padding: 12px 15px;
    font-size: 0.95rem;
    color: #2d3748;
    transition: background 0.2s;
}

.select-options li:hover {
    background: #ebf0ff;
    color: var(--unspsc-primary);
}

/* Disabled State */
.unspsc-custom-select.disabled {
    background: #f7fafc;
    opacity: 0.7;
    cursor: not-allowed;
}

.unspsc-custom-select.disabled .select-trigger {
    color: #a0aec0;
}

/* Results */
#unspsc-results-info {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 15px;
}

.unspsc-count {
    font-size: 0.95rem;
    color: #718096;
    font-weight: 600;
}

.unspsc-result-item {
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 20px;
    padding: 1.8rem;
    margin-bottom: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.unspsc-result-item:hover {
    border-color: var(--unspsc-primary);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.unspsc-result-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    transition: background 0.3s;
}

.unspsc-result-item:hover::after {
    background: var(--unspsc-primary);
}

.unspsc-result-product {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.unspsc-result-code {
    color: var(--unspsc-primary);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
    display: block;
    background: #ebf0ff;
    padding: 4px 12px;
    border-radius: 8px;
    width: fit-content;
}

.unspsc-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.85rem;
    color: #718096;
}

.unspsc-result-meta span strong {
    color: #4a5568;
    margin-right: 4px;
}

/* Pagination */
#unspsc-pagination-frontend {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f7fafc;
    padding: 8px 20px;
    border-radius: 50px;
}

.page-btn {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #4a5568;
}

.page-btn:hover {
    background: var(--unspsc-primary);
    color: #fff;
    border-color: var(--unspsc-primary);
}

.page-info {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2d3748;
}

.unspsc-export-footer {
    padding-top: 2rem;
    border-top: 1px solid #edf2f7;
    margin-top: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-buttons {
    display: flex;
    gap: 12px;
}

.unspsc-export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 14px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.unspsc-export-btn:hover {
    transform: scale(1.05);
}

.unspsc-export-btn.excel {
    background: #c6f6d5;
    color: #22543d;
}

.unspsc-export-btn.pdf {
    background: #fed7d7;
    color: #822727;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--unspsc-primary);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Custom Modal */
.unspsc-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    display: none !important;
    /* Initial state hidden */
    align-items: center !important;
    justify-content: center !important;
    animation: fadeIn 0.3s;
}

.unspsc-modal.is-open {
    display: flex !important;
}

.unspsc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.unspsc-modal-content {
    position: relative;
    background: #fff;
    width: 95%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 28px;
    padding: 2.5rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s cubic-bezier(0, 0, 0.2, 1);
    z-index: 100000;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f7fafc;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    color: #a0aec0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

.modal-body h3 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.modal-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.modal-detail-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 16px;
    border: 1px solid #edf2f7;
}

.modal-detail-item.full {
    grid-column: span 2;
}

.modal-detail-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--unspsc-primary);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.modal-detail-item span {
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}