/* UserCategories Page Styles - English Theme */
/* Scoped to .category-selection-container to avoid conflicts */

.category-selection-container {
    font-family: 'TenderJO font', Arial, Helvetica, sans-serif;
    padding: 20px;
    color: #838383;
}

.category-selection-container .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

    .category-selection-container .header {
        padding: 24px 32px;
        border-bottom: 1px solid #fff;
        background: #fff;
        box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
    }

.category-selection-container .header h1 {
    color: #2e8795;
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
}

.category-selection-container .header p {
    color: #838383;
    font-size: 0.9167em;
    line-height: 1.6666;
    margin-bottom: 0;
}

    .category-selection-container .main-content {
        padding: 12px;
        background: white;
        box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        min-height: calc(100vh - 300px); /* Viewport height minus header/footer */
    }

@media (max-width: 768px) {
    .category-selection-container .main-content {
        grid-template-columns: 1fr;
        padding: 16px 20px;
        gap: 16px;
    }
}

/* Tree View Styles */
.category-selection-container .tree-section {
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
    height: 1036px; /* Fixed height */
    min-height: 1036px;
    max-height: 1036px;
}

.category-selection-container .tree-header {
    padding: 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.category-selection-container .tree-header h3 {
    color: #2e8795;
    font-size: 1.25em; /* Increased for better readability */
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.5;
}

.category-selection-container .search-box {
    margin-top: 12px;
    position: relative;
}

.category-selection-container .search-box input {
    width: 100%;
    padding: 8px 40px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9167em;
    font-family: 'TenderJO font', Arial, Helvetica, sans-serif;
    transition: all 0.3s;
    color: #838383;
}

.category-selection-container .search-box input:focus {
    outline: none;
    border-color: #2e8795;
    box-shadow: 0 0 0 2px rgba(46, 135, 149, 0.1);
}

.category-selection-container .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #838383;
    pointer-events: none;
}

.category-selection-container .tree-container {
    flex: 1 1 auto; /* Grow to fill available space */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    min-height: 0; /* Important for flex scrolling */
}

.category-selection-container .tree-actions {
    flex: 0 0 auto; /* Fixed height footer */
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: flex-start; /* Always on left */
    align-items: center;
    min-height: 50px; /* Smaller height */
}

.category-selection-container .tree-node {
    margin-bottom: 4px;
   
}

.category-selection-container .tree-item {
    display: flex;
    align-items: center;
    padding: 2px 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    min-height: 30px;
    border-bottom: 1px solid #e5e7eb; /* Light line between items */
}

.category-selection-container .tree-item:hover {
    background: #f3f4f6;
}

.category-selection-container .tree-item.selected {
    background: #e6f7f9;
}

.category-selection-container .tree-item.indeterminate {
    background: #fff4e6;
}

.category-selection-container .tree-item>* {
    pointer-events: none;
}

.category-selection-container .tree-item .uc-category-checkbox,
.category-selection-container .tree-item .toggle-btn {
    pointer-events: auto;
}

.category-selection-container .toggle-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: #838383;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    border-radius: 3px;
    transition: all 0.2s;
}

.category-selection-container .toggle-btn:hover {
    background: #e5e7eb;
    color: #2e8795;
}

.category-selection-container .toggle-btn.collapsed::after {
    content: '▶';
}

.category-selection-container .toggle-btn.expanded::after {
    content: '▼';
}

.category-selection-container .toggle-btn.leaf {
    visibility: hidden;
}

/* Unique checkbox class to avoid theme conflicts */
.category-selection-container .uc-category-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    background: #fff; /* Default gray/white background */
}

.category-selection-container .uc-category-checkbox.checked {
    background: #2e8795;
    border-color: #2e8795;
}

.category-selection-container .uc-category-checkbox.indeterminate {
    background: #ff7f27;
    border-color: #ff7f27;
}

.category-selection-container .uc-category-checkbox.checked::after,
.category-selection-container .uc-category-checkbox.indeterminate::after {
    content: '';
    width: 8px;
    height: 2px;
    background: white;
}

.category-selection-container .uc-category-checkbox.indeterminate::after {
    width: 8px;
    height: 2px;
}

.category-selection-container .item-label {
    flex: 1;
    font-size: 1em; /* Increased for better readability */
    font-weight: 600; /* Semibold for category names */
    color: #838383;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.6; /* Improved line-height for better spacing */
}

.category-selection-container .item-count {
    background: #f0f0f0; /* Light background */
    color: #9ca3af; /* Light gray text */
    font-size: 0.75em; /* Slightly smaller */
    padding: 2px 8px;
    border-radius: 4px; /* Not circle - rounded rectangle */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    margin-left: 6px;
}

.category-selection-container .children {
    margin-left: 24px;
    border-left: 2px solid #c4cdd9;
    padding-left: 12px;
    margin-top: 4px;
    margin-bottom: 4px;
}

/* Sub-category styling - normal weight, smaller size, reduced line spacing */
.category-selection-container .children .item-label {
    font-size: 0.875em; /* Smaller than main category (1em) */
    font-weight: 400; /* Normal weight (not semibold) */
    line-height: 1.3; /* Reduced line spacing (from 1.6) */
}

/* Selected Items Panel */
.category-selection-container .selected-section {
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
    height: calc(100vh - 300px); /* Fixed viewport height */
    min-height: 600px;
    max-height: calc(100vh - 200px);
}

.category-selection-container .selected-header {
    padding: 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-selection-container .selected-header h3 {
    color: #2e8795;
    font-size: 1.25em; /* Increased for better readability */
    font-weight: 700;
    margin: 0;
    line-height: 1.5;
}

.category-selection-container .selected-count {
    background: #ff7f27;
    color: white;
    font-size: 0.8333em;
    padding: 8px 12px;
    min-width: 36px;
    height: 36px;
    border-radius: 50%; /* Perfect circle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.category-selection-container .selected-container {
    flex: 1 1 auto; /* Grow to fill available space */
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    min-height: 0; /* Important for flex scrolling */
    max-height: 914px; /* Maximum scroll height */
}

.category-selection-container .selected-actions {
    flex: 0 0 auto; /* Fixed height footer */
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: flex-start; /* Always on left */
    align-items: center;
    min-height: 50px; /* Smaller height */
}

.category-selection-container .selected-container::-webkit-scrollbar {
    width: 8px;
}

.category-selection-container .selected-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.category-selection-container .selected-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.category-selection-container .selected-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.category-selection-container .selected-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    padding: 8px 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    position: relative;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
    min-height: 70px;
}

.category-selection-container .selected-item:hover {
    background: #f1f5f9;
    border-color: #2e8795;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(46, 135, 149, 0.1);
}

.category-selection-container .selected-item:hover .remove-btn {
    opacity: 1;
    transform: scale(1.1);
}

.category-selection-container .selected-item.newly-added {
    animation: highlightFlash 1s ease-out;
}

@keyframes highlightFlash {
    0% {
        background: #e6f7f9;
        border-color: #2e8795;
    }

    50% {
        background: #f0f9fa;
        border-color: #4a9ba8;
    }

    100% {
        background: #f8fafc;
        border-color: #e5e7eb;
    }
}

.category-selection-container .selected-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.category-selection-container .selected-item-img {
    width: calc(100% - 24px);
    height: calc(100% - 16px);
    min-width: 54px;
    min-height: 54px;
    max-width: 54px;
    max-height: 54px;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0.7;
    border: 2px solid rgba(229, 231, 235, 0.5);
    flex-shrink: 0;
    align-self: center;
}

.category-selection-container .selected-item-info {
    position: relative;
    overflow: visible;
}

.category-selection-container .selected-item-content {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.category-selection-container .selected-item-name {
    font-weight: 600; /* Increased to semibold */
    color: #838383;
    font-size: 1em; /* Increased for better readability */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6; /* Improved line-height for better spacing */
    max-height: 3.2em; /* Adjusted for new line-height */
}

.category-selection-container .selected-item-path {
    font-size: 0.8333em;
    color: #838383;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-selection-container .selected-item-main-category {
    font-size: 0.75em;
    color: #9ca3af;
    margin-top: 4px;
    line-height: 1.4;
}

.category-selection-container .path-separator {
    color: #9ca3af;
}

.category-selection-container .remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
    opacity: 0.7;
}

.category-selection-container .remove-btn::before {
    content: '\f1f8';
    font-family: 'FontAwesome';
    font-weight: 900;
}

.category-selection-container .remove-btn:hover {
    opacity: 1;
    background: #e5e7eb;
    color: #4b5563;
}

.category-selection-container .remove-btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2e8795;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.8333em;
    white-space: nowrap;
    margin-bottom: 4px;
    z-index: 1000;
    pointer-events: none;
}

.category-selection-container .no-selection {
    text-align: center;
    padding: 40px 20px;
    color: #838383;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.category-selection-container .no-selection:hover {
    opacity: 1;
}

.category-selection-container .no-selection svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.category-selection-container .no-selection p {
    font-size: 0.9167em;
    margin-bottom: 0;
}

.category-selection-container .actions {
    flex: 0 0 auto; /* Fixed height footer */
    padding: 20px 32px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
    gap: 16px;
    flex-wrap: wrap;
    min-height: 70px; /* Controlled height */
    position: sticky; /* Fixed when scrolling */
    bottom: 0;
    z-index: 100;
}

/* Button styles removed - using theme button classes from shortcode-buttons.html */

.category-selection-container .action-btn:focus,
.category-selection-container .expand-btn:focus,
.category-selection-container .collapse-btn:focus,
.category-selection-container .tree-item:focus {
    outline: 2px solid #2e8795;
    outline-offset: 2px;
}

.category-selection-container .search-box input:focus {
    border-color: #2e8795;
    box-shadow: 0 0 0 2px rgba(46, 135, 149, 0.1);
}

.category-selection-container .btn-save .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.category-selection-container .tree-item:active {
    transform: scale(0.98);
}

.category-selection-container .action-btn:active {
    transform: translateY(0);
}

.category-selection-container .filter-highlight {
    background: #fff4e6;
    padding: 0 2px;
    border-radius: 2px;
}

.category-selection-container .expand-collapse {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.category-selection-container .expand-btn,
.category-selection-container .collapse-btn {

    font-size: 0.8333em;
    background: #e5e7eb;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    color: #838383;
    transition: all 0.2s;
    font-family: 'TenderJO font', Arial, Helvetica, sans-serif;
}

.category-selection-container .expand-btn:hover:not(:disabled),
.category-selection-container .collapse-btn:hover:not(:disabled) {
    background: #d1d5db;
    color: #2e8795;
}

.category-selection-container .expand-btn:disabled,
.category-selection-container .collapse-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Alert styles removed - using system-wide alert styles from style.css */

/* Toast Notification Styles */
.category-selection-container .toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-selection-container .toast {
    background: white;
    border-radius: 3px;
    padding: 16px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
}

.category-selection-container .toast.success {
    border-left-color: #10b981;
}

.category-selection-container .toast.error {
    border-left-color: #ef4444;
}

.category-selection-container .toast.info {
    border-left-color: #2e8795;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.category-selection-container .toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.category-selection-container .toast.success .toast-icon {
    color: #10b981;
}

.category-selection-container .toast.error .toast-icon {
    color: #ef4444;
}

.category-selection-container .toast.info .toast-icon {
    color: #2e8795;
}

.category-selection-container .toast-message {
    flex: 1;
    font-size: 0.9167em;
    color: #838383;
}

.category-selection-container .toast-close {
    background: none;
    border: none;
    color: #838383;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-selection-container .toast-close:hover {
    color: #2e8795;
}

.category-selection-container .parent-group-badge {
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 0.8333em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.category-selection-container .parent-group-badge:hover {
    background: #e5e7eb;
    color: #6b7280;
    transform: scale(1.05);
}

.category-selection-container .selected-badge {
    background: #e6f7f9;
    color: #2e8795;
    font-size: 0.8333em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 700;
}

/* Better scrollbar styling */
.category-selection-container .tree-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.category-selection-container .tree-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.category-selection-container .tree-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.category-selection-container .tree-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .category-selection-container {
        padding: 12px;
    }

    .category-selection-container .header {
        padding: 16px 20px;
    }

    .category-selection-container .actions {
        flex-direction: column;
        padding: 16px 20px;
    }

    .category-selection-container .actions .action-btn {
        width: 100%;
    }
}

/* Screen reader only text */
.category-selection-container .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}