/* استایل‌های اختصاصی صفحه مدیریت فهرست‌ها */

.action-buttons-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
input.menu-item-checkbox {
    display: none;
}
.add-menu-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.add-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.refresh-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

#menu-form-container {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
}

#menu-form-container.hidden {
    display: none;
}

#form-title {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.5em;
}

.required {
    color: #dc3545;
}

.form-help {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 13px;
}

/* لیست منوها */
.menus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.menu-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.menu-name {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.menu-location {
    font-size: 12px;
    color: #17a2b8;
    background: #e7f3ff;
    padding: 4px 10px;
    border-radius: 12px;
    margin-top: 5px;
}

.menu-info {
    margin-bottom: 15px;
}

.menu-item-count {
    font-size: 14px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 5px;
}

.menu-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn.edit {
    background: #17a2b8;
    color: white;
}

.action-btn.edit:hover {
    background: #138496;
}

.action-btn.delete {
    background: #dc3545;
    color: white;
}

.action-btn.delete:hover {
    background: #c82333;
}

.action-btn.items {
    background: #28a745;
    color: white;
}

.action-btn.items:hover {
    background: #218838;
}

/* مودال */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #e9ecef;
    color: #dc3545;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* لیست آیتم‌های منو */
.menu-items-list {
    margin-bottom: 30px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: move;
    position: relative;
}

.menu-item:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.menu-item.dragging {
    opacity: 0.5;
    border-color: #667eea;
}

.menu-item.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
    border-style: dashed;
}

.menu-item.drag-over-parent {
    border-color: #28a745;
    background: #d4edda;
    border-style: solid;
}

.menu-item-drag-handle {
    color: #adb5bd;
    font-size: 18px;
    cursor: move;
}

.menu-item-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #667eea;
    color: white;
    border-radius: 6px;
    font-size: 14px;
}

.menu-item-info {
    flex: 1;
}

.menu-item-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
}

.menu-item-url {
    font-size: 12px;
    color: #6c757d;
}

.menu-item-children-count {
    font-size: 11px;
    color: #17a2b8;
    margin-top: 3px;
    font-weight: 500;
}

.menu-item-actions {
    display: flex;
    gap: 5px;
}

.menu-item-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.menu-item-btn.edit {
    background: #17a2b8;
    color: white;
}

.menu-item-btn.edit:hover {
    background: #138496;
}

.menu-item-btn.delete {
    background: #dc3545;
    color: white;
}

.menu-item-btn.delete:hover {
    background: #c82333;
}

.menu-item-btn.set-parent {
    background: #ffc107;
    color: #212529;
}

.menu-item-btn.set-parent:hover {
    background: #e0a800;
}

/* نوار عملیات منو */
.menu-actions-bar {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.btn-add-categories {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-add-categories:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-add-categories:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* فرم افزودن آیتم */
.add-menu-item-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.add-menu-item-section h4 {
    margin-bottom: 15px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.menu-item-type-btn {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    border: 2px solid #ced4da;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    color: #495057;
}

.menu-item-type-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.menu-item-type-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.menu-item-form-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-primary:hover {
    background: #218838;
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #adb5bd;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #495057;
}

.loader {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 16px;
}

/* Loader Overlay */
.ajax-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.ajax-loader-overlay.hidden {
    display: none;
}

.ajax-loader-spinner {
    text-align: center;
    color: white;
}

.ajax-loader-spinner .spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    color: white;
    font-size: 18px;
    font-weight: 500;
    margin-top: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .menus-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .menu-actions {
        flex-direction: column;
    }

    .menu-item-type-selector {
        flex-direction: column;
    }

    .menu-item-type-btn {
        min-width: 100%;
    }
}

/* دکمه‌های عملیاتی دسته‌جمعی */
.menu-items-bulk-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.btn-bulk-action {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-bulk-action:first-child {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-bulk-action:first-child:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-delete-bulk {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-delete-bulk:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* چک‌باکس آیتم‌های منو */
.menu-item-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-right: 10px;
}

.menu-item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.menu-checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #adb5bd;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    background: white;
    transition: all 0.2s ease;
    margin-right: 5px;
}

.menu-item-checkbox:checked + .menu-checkbox-custom {
    background: #28a745;
    border-color: #28a745;
}

.menu-item-checkbox:checked + .menu-checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.menu-checkbox-custom.indeterminate {
    background: #ffc107;
    border-color: #ffc107;
}

.menu-checkbox-custom.indeterminate::after {
    content: '▢';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.menu-item {
    display: flex;
    align-items: center;
}

.menu-item-wrapper {
    position: relative;
}

.menu-item-wrapper.dragging-wrapper {
    opacity: 0.5;
}

.menu-item-toggle {
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    margin-right: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.menu-item-toggle:hover {
    background: #e9ecef;
    color: #495057;
}

.menu-item-toggle i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.menu-item-toggle-placeholder {
    width: 24px;
    height: 24px;
    margin-right: 5px;
    display: inline-block;
}

.menu-item-children {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.menu-item-children.collapsed {
    max-height: 0;
    opacity: 0;
    display: none;
}

.menu-item-children.expanded {
    max-height: 10000px;
    opacity: 1;
    display: block;
}

/* خط راهنمای drop */
.drop-indicator {
    background: #28a745;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
    pointer-events: none;
    transition: all 0.2s ease;
}

.drop-indicator-before {
    background: linear-gradient(90deg, transparent, #28a745, transparent);
}

.drop-indicator-after {
    background: linear-gradient(90deg, transparent, #28a745, transparent);
}

/* هایلایت برای والد */
.menu-item-wrapper.drag-over-parent {
    background: #e7f3ff !important;
    border: 2px solid #17a2b8 !important;
    border-radius: 8px;
    padding: 5px;
    margin: 5px 0;
    box-shadow: 0 0 15px rgba(23, 162, 184, 0.3);
}

.menu-item-wrapper.drag-over-parent .menu-item {
    background: transparent;
}

/* دکمه ذخیره تغییرات */
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-save-order {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save-order:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-save-order.has-changes {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(40, 167, 69, 0);
    }
}

/* بخش انتخاب دسته‌بندی‌ها - حذف شده */
.categories-selection-section {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.categories-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.categories-selection-header h4 {
    margin: 0;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 10px;
}

.categories-selection-actions {
    display: flex;
    gap: 10px;
}

.btn-select-all,
.btn-add-selected,
.btn-delete-selected {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-add-selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-add-selected:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-select-all {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-select-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-delete-selected {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-delete-selected:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.categories-tree-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.category-item {
    padding: 8px 0;
    display: flex;
    align-items: center;
}

.category-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.category-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #adb5bd;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    background: white;
    transition: all 0.2s ease;
}

.category-checkbox:checked + .checkbox-custom {
    background: #28a745;
    border-color: #28a745;
}

.category-checkbox:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-custom.indeterminate {
    background: #ffc107;
    border-color: #ffc107;
}

.checkbox-custom.indeterminate::after {
    content: '▢';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.category-name {
    font-weight: 500;
    color: #495057;
    flex: 1;
}

.category-children-count {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

.category-item:hover {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 8px;
    margin: 0 -8px;
}

/* استایل indeterminate برای checkbox */
.category-checkbox[data-indeterminate="true"],
.category-checkbox:indeterminate {
    background: #ffc107;
    border-color: #ffc107;
}

/* Progress Modal */
.progress-container {
    padding: 20px;
}

.progress-bar-wrapper {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 10px;
}

.progress-percentage {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #28a745;
}

