/**
 * Hierarchical Category Browser CSS
 * Matches the user's image design with Parent → Child → Grandchild columns
 */

/* Modal Overlay */
.epf-category-browser-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Modal */
.epf-category-browser-modal {
    background: white;
    border-radius: 8px;
    width: 95%;
    max-width: 1200px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid #e1e1e1;
}

/* Modal Header */
.epf-category-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    min-height: 60px;
}

.epf-category-browser-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    letter-spacing: 0.3px;
}

.epf-category-browser-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.epf-category-browser-close:hover {
    background: #f0f0f0;
    color: #666;
}

/* Modal Content */
.epf-category-browser-content {
    flex: 1;
    padding: 16px 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Search Box */
.epf-category-search {
    position: relative;
    margin-bottom: 16px;
}

.epf-category-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #f9f9f9;
    color: #333;
}

.epf-category-search-input:focus {
    outline: none;
    border-color: #666;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(102, 102, 102, 0.1);
}

/* Search Results */
.epf-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.epf-search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.epf-search-result-item:hover {
    background-color: #f8f9fa;
}

.epf-search-result-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.epf-search-result-breadcrumb {
    font-size: 12px;
    color: #666;
}

/* Breadcrumb */
.epf-category-breadcrumb {
    margin-bottom: 16px;
    padding: 10px 0;
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
}

.epf-breadcrumb-label {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
    margin-bottom: 6px;
}

.epf-breadcrumb-path {
    font-size: 13px;
    color: #444;
    line-height: 1.4;
}

.epf-breadcrumb-item {
    cursor: pointer;
    color: #007cba;
    text-decoration: none;
    transition: color 0.2s ease;
}

.epf-breadcrumb-item:hover {
    color: #005a87;
    text-decoration: underline;
}

.epf-breadcrumb-item.root {
    font-weight: 500;
}

.epf-breadcrumb-separator {
    color: #999;
    margin: 0 8px;
}

/* Category Columns Container */
.epf-category-columns {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-height: 350px;
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
}

/* Individual Column */
.epf-category-column {
    flex: 0 0 320px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid #f0f0f0;
    margin: 0;
    height: 100%;
    min-height: 400px;
}

.epf-category-column:last-child {
    border-right: none;
}

.epf-category-column:first-child {
    border-left: none;
}

/* Add subtle shadow between columns */
.epf-category-column + .epf-category-column {
    box-shadow: -1px 0 3px rgba(0,0,0,0.04);
}

/* Ensure child and grandchild columns have enough height to trigger scrolling */
.epf-category-column[data-level="1"],
.epf-category-column[data-level="2"] {
    min-height: 400px;
}

/* Column Header */
.epf-column-header {
    background: #f8f9fa;
    color: #555;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 45px;
    display: flex;
    align-items: center;
    position: relative;
}

/* Category List */
.epf-category-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 300px;
    min-height: 250px;
    padding: 0;
    position: relative;
}

/* ULTRA AGGRESSIVE SCROLLBAR FORCING */
.epf-category-list,
.epf-category-column .epf-category-list,
.epf-category-column[data-level] .epf-category-list {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin; /* Firefox - thin scrollbar */
    scrollbar-color: rgba(0,0,0,0.3) transparent; /* Firefox - subtle thumb */
}

/* Clean webkit scrollbars */
.epf-category-list::-webkit-scrollbar,
.epf-category-column .epf-category-list::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

.epf-category-list::-webkit-scrollbar-track,
.epf-category-column .epf-category-list::-webkit-scrollbar-track {
    background: transparent;
}

.epf-category-list::-webkit-scrollbar-thumb,
.epf-category-column .epf-category-list::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
    border: none;
}

.epf-category-list::-webkit-scrollbar-thumb:hover,
.epf-category-column .epf-category-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.4);
}

.epf-category-list::-webkit-scrollbar-thumb:active,
.epf-category-column .epf-category-list::-webkit-scrollbar-thumb:active {
    background: rgba(0,0,0,0.6);
}

/* Responsive column heights */
.epf-category-column[data-level="1"] .epf-category-list,
.epf-category-column[data-level="2"] .epf-category-list {
    max-height: 250px;
    overflow-y: auto;
}

/* ADD EXTRA CONTENT TO FORCE SCROLLING */
.epf-category-column[data-level="1"] .epf-category-list::after,
.epf-category-column[data-level="2"] .epf-category-list::after {
    content: '' !important;
    display: block !important;
    height: 100px !important; /* Force extra height */
    width: 100% !important;
    background: transparent !important;
}

/* Individual Category Item */
.epf-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    border-bottom: 1px solid #fbfbfb;
    font-size: 13px;
    line-height: 1.4;
}

.epf-category-item:last-child {
    border-bottom: none;
}

.epf-category-item:hover {
    background: #f8f9fa;
    color: #333;
    transform: translateX(2px);
}

.epf-category-item.selected {
    background: #f0f4f8;
    font-weight: 500;
    color: #2c5aa0;
    border-left: 3px solid #2c5aa0;
    padding-left: 13px;
}

/* Simple scroll indicator for child and grandchild columns */
.epf-category-column[data-level="1"] .epf-column-header::after,
.epf-category-column[data-level="2"] .epf-column-header::after {
    content: '↕ Scroll';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #666;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    background: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #ddd;
}


.epf-category-name {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: inherit;
    word-break: break-word;
}

.epf-icon-arrow-right {
    color: #bbb;
    font-size: 11px;
    font-weight: normal;
    margin-left: 10px;
    transition: color 0.2s ease;
    opacity: 0.7;
}

.epf-category-item:hover .epf-icon-arrow-right {
    color: #666;
    opacity: 1;
}

/* No Categories Message */
.epf-no-categories {
    text-align: center;
    padding: 30px 20px;
    color: #aaa;
    font-size: 13px;
    background: #fafafa;
    border-radius: 4px;
    margin: 8px;
    border: 1px dashed #e1e1e1;
}

/* Loading State */
.epf-loading {
    text-align: center;
    padding: 30px 20px;
    color: #888;
    font-size: 13px;
    background: #fafafa;
}

.epf-loading:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f0f0f0;
    border-top: 2px solid #2c5aa0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Footer */
.epf-category-browser-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fafafa;
    min-height: 65px;
    align-items: center;
}

/* Buttons */
.epf-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
}

.epf-btn-secondary {
    background: #ffffff;
    color: #666;
    border: 1px solid #d1d1d1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.epf-btn-secondary:hover {
    background: #f8f9fa;
    color: #333;
    border-color: #999;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.epf-btn-primary {
    background: #2c5aa0;
    color: white;
    box-shadow: 0 1px 3px rgba(44, 90, 160, 0.3);
}

.epf-btn-primary:hover {
    background: #1e3f73;
    box-shadow: 0 2px 5px rgba(44, 90, 160, 0.4);
    transform: translateY(-1px);
}

.epf-btn-primary:disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.epf-btn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Category Display Button */
.epf-category-display-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    min-height: 48px;
}

.epf-category-display-button:hover {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.epf-category-display-text {
    flex: 1;
    color: #333;
    text-align: left;
}

.epf-dropdown-arrow {
    color: #999;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.epf-category-display-button:hover .epf-dropdown-arrow {
    color: #007cba;
}

/* Responsive Design */
@media (max-width: 768px) {
    .epf-category-browser-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .epf-category-columns {
        min-height: 250px;
    }
    
    .epf-category-column {
        flex: 0 0 250px;
    }
    
    .epf-category-list {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .epf-category-browser-modal {
        width: 98%;
        margin: 10px;
    }
    
    .epf-category-column {
        flex: 0 0 220px;
    }
    
    .epf-category-browser-header,
    .epf-category-browser-content,
    .epf-category-browser-footer {
        padding: 15px;
    }
}
