/* =============================
   Property Sort Settings Styles
   ============================= */

:root {
    --sort-primary: #21808d;
    /* Teal-500 from main.css */
    --sort-primary-dark: #1d7480;
    /* Teal-600 */
    --sort-bg: #f8f9fa;
    --sort-border: #e9ecef;
    --sort-text: #495057;
}

.sort-criteria-list {
    min-height: 120px;
    padding: 1rem;
    border: 2px dashed var(--sort-border);
    border-radius: 8px;
    background-color: var(--sort-bg);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.sort-criteria-list:empty,
.sort-criteria-list:has(.empty-message) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sort-criterion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: white;
    border: 1px solid var(--sort-border);
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.sort-criterion-item:last-child {
    margin-bottom: 0;
}

.sort-criterion-item:hover {
    border-color: var(--sort-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.sort-criterion-item.dragging {
    opacity: 0.6;
    border-style: dashed;
    background: #fff;
    transform: scale(0.98);
    cursor: grabbing;
}

.drag-handle {
    color: #adb5bd;
    cursor: grab;
    font-size: 1.2rem;
    padding: 0.25rem;
    transition: color 0.2s;
}

.sort-criterion-item:hover .drag-handle {
    color: var(--sort-primary);
}

.drag-handle:active {
    cursor: grabbing;
}

.criterion-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.priority-number {
    font-weight: 700;
    color: var(--sort-primary);
    min-width: 1.5rem;
    font-size: 0.9rem;
    background: rgba(33, 128, 141, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.field-name {
    font-weight: 600;
    color: var(--sort-text);
    min-width: 150px;
    font-size: 0.95rem;
}

/* Button Styles within Item */
.toggleSortOrderBtn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--sort-border);
    background: #fff;
    color: var(--sort-text);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.toggleSortOrderBtn:hover {
    background: var(--sort-bg);
    border-color: var(--sort-primary);
    color: var(--sort-primary);
}

.toggleSortOrderBtn i {
    font-size: 0.8rem;
}

.removeSortCriterionBtn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background-color: #fff;
    /* Ensure background is white to be visible */
    color: #dc3545;
    border: 1px solid #dc3545;
    /* Add border to make it distinct */
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 1;
    /* Force full opacity */
}

.removeSortCriterionBtn:hover {
    background-color: #dc3545;
    color: white;
    transform: rotate(90deg);
}

/* Add Section Styles */
.add-criterion-section {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: var(--sort-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--sort-border);
}

.add-criterion-section select {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--sort-border);
    border-radius: 6px;
    background-color: white;
    font-size: 0.95rem;
    color: var(--sort-text);
    cursor: pointer;
    transition: border-color 0.2s;
}

.add-criterion-section select:focus {
    outline: none;
    border-color: var(--sort-primary);
}

.add-criterion-section button {
    white-space: nowrap;
    padding: 0.6rem 1.2rem;
    background-color: var(--sort-text);
    /* Dark grey/black */
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-criterion-section button:hover {
    background-color: #343a40;
    transform: translateY(-1px);
}

.empty-message {
    text-align: center;
    color: #adb5bd;
    padding: 2rem;
    font-style: italic;
    font-size: 0.95rem;
}

/* Modal Footer Buttons Override */
#propertySortModal .modal-footer {
    border-top: 1px solid var(--sort-border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

#savePropertySortBtn {
    background-color: var(--sort-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s;
}

#savePropertySortBtn:hover {
    background-color: var(--sort-primary-dark);
}

#resetPropertySortBtn {
    background-color: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
}

#resetPropertySortBtn:hover {
    background-color: #dc3545;
    color: white;
}