/* UserCategories Page Styles - Arabic Theme (RTL) */
/* Scoped to .category-selection-container to avoid conflicts */

.category-selection-container {
    font-family: 'TenderJO font', Arial, Helvetica, sans-serif;
    padding: 20px;
    color: #838383;
    direction: rtl;
    text-align: right;
    font-size: 14px; /* Base font size */
}

.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; /* Title font size */
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
    text-align: right;
}

.category-selection-container .header p {
    color: #838383;
    font-size: 0.9375em; /* Slightly smaller */
    line-height: 1.6666;
    margin-bottom: 0;
    text-align: right;
}

    .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.3em; /* Increased for better readability */
    font-weight: 700;
    margin-bottom: 12px;
    text-align: right;
    line-height: 1.5;
}

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

.category-selection-container .search-box input {
    width: 100%;
    padding: 10px 40px 10px 12px; /* RTL: padding-right for icon, padding-left for text */
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9375em; /* Slightly smaller */
    font-family: 'TenderJO font', Arial, Helvetica, sans-serif;
    transition: all 0.3s;
    color: #838383;
    direction: rtl;
    text-align: right;
}

.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; /* RTL: icon on right side */
    left: auto;
    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;
    direction: rtl;
    min-height: 50px; /* Smaller height */
}

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


.category-selection-container .tree-item {
    display: flex;
    align-items: center;
    padding: 2px 16px; /* Increased padding for better spacing */
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-user-select: none;
    user-select: none;
    min-height: 30px; /* Increased from 44px */
    flex-direction: row-reverse;
    text-align: right;
    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: 28px; /* Increased from 24px */
    height: 28px; /* Increased from 24px */
    border: none;
    background: none;
    cursor: pointer;
    color: #838383;
    font-size: 14px; /* Increased from 12px */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px; /* RTL: margin-left for spacing */
    margin-right: 0;
    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: 20px; /* Increased from 18px */
    height: 20px; /* Increased from 18px */
    border: 2px solid #ddd;
    border-radius: 3px;
    margin-left: 14px; /* RTL: margin-left for spacing */
    margin-right: 0;
    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: 1.0625em; /* Increased for better readability */
    font-weight: 600; /* Semibold for category names */
    color: #838383;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row-reverse;
    text-align: right;
    line-height: 1.7; /* Improved line-height for multi-line Arabic text */
}

.category-selection-container .item-count {
    background: #f0f0f0; /* Light background */
    color: #9ca3af; /* Light gray text */
    font-size: 0.8125em; /* 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-right: 6px;
    font-weight: 500;
    flex-shrink: 0;
}

.category-selection-container .children {
    margin-right: 24px;
    margin-left: 0;
    border-right: 2px solid #c4cdd9;
    border-left: none;
    padding-right: 12px;
    padding-left: 0;
    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.9375em; /* Smaller than main category (1.0625em) */
    font-weight: 400; /* Normal weight (not semibold) */
    line-height: 1.4; /* Reduced line spacing (from 1.7) */
}

/* 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;
}

.category-selection-container .selected-header {
    padding: 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row-reverse; /* RTL: number on right, title on left */
    direction: rtl;
}

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

.category-selection-container .selected-count {
    background: #ff7f27;
    color: white;
    font-size: 0.9375em; /* Increased from 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;
    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;
    direction: rtl;
    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;
}

@supports (scrollbar-width: thin) {
    .category-selection-container .selected-container {
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 #f1f5f9;
    }
}

.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;
    flex-direction: row-reverse;
    direction: ltr;
    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;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row-reverse;
    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.7; /* Improved line-height for multi-line Arabic text */
    max-height: 3.4em; /* Adjusted for new line-height */
    text-align: right;
}

.category-selection-container .selected-item-path {
    font-size: 0.875em; /* Slightly smaller */
    color: #838383;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-direction: row-reverse;
    text-align: right;
}

    .category-selection-container .selected-item-path .path-part {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        direction:rtl;
    }

.category-selection-container .selected-item-path .path-part i {
    font-size: 0.857em; /* Icon slightly smaller than text */
    color: #6b7280;
    opacity: 0.7;
}

.category-selection-container .selected-item-main-category {
    font-size: 0.875em; /* Increased from 0.75em */
    color: #9ca3af;
    margin-top: 6px;
    line-height: 1.5;
    text-align: right;
    direction: rtl;
}

.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%;
    right: 50%;
    left: auto;
    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;
    direction: rtl;
    text-align: right;
}

.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.9375em; /* Slightly smaller */
    margin-bottom: 0;
    text-align: center;
    direction: rtl;
}

.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;
    flex-direction: row-reverse; /* RTL */
    direction: rtl;
    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;
    flex-direction: row-reverse;
}

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

    font-size: 0.9375em; /* Increased from 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;
    direction: rtl;
    text-align: center;
}

.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 - RTL */
.category-selection-container .toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    right: auto;
    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: slideInLeft 0.3s ease-out;
    border-right: 4px solid;
    border-left: none;
    direction: rtl;
    text-align: right;
}

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

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

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

@keyframes slideInLeft {
    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.9375em; /* Slightly smaller */
    color: #838383;
    text-align: right;
    direction: rtl;
}

.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.8125em; /* Slightly smaller for path */
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
    margin-left: 0;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    direction: rtl;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.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.9375em; /* Increased from 0.8333em */
    padding: 3px 10px;
    border-radius: 10px;
    margin-right: 8px;
    margin-left: 0;
    font-weight: 700;
    direction: rtl;
}

/* 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;
}