/**
 * UA3F Rule Manager Styles
 */

.rule-actions button {
    margin: 0 2px;
}

.empty-message {
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Modal Styles */
.cbi-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;
}

.cbi-modal-dialog {
    background: var(--background-color-high, #fff);
    color: var(--text-color-primary, #000);
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.cbi-modal-dialog-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color-medium, #ddd);
}

.cbi-modal-dialog-header h3 {
    margin: 0;
}

.cbi-modal-dialog-body {
    padding: 20px;
}

/* Rule Section */
.rule-section {
    margin-bottom: 20px;
}

.rule-section-title {
    font-weight: bold;
    margin-bottom: 10px;
}

.rule-section-description {
    color: #999;
    font-size: 90%;
    margin-bottom: 10px;
}

/* Table cell overflow handling */
.td-ellipsis {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Drag Handle Styles */
.drag-handle {
    cursor: grab;
    user-select: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
    color: #888;
}

.drag-handle:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    display: block;
}

.drag-handle-cell {
    vertical-align: middle;
}

/* Drag States */
.cbi-section-table-row.dragging {
    opacity: 0.5;
    background-color: #e3f2fd !important;
}

.cbi-section-table-row.drag-over-top {
    border-top: 2px solid #2196f3 !important;
}

.cbi-section-table-row.drag-over-bottom {
    border-bottom: 2px solid #2196f3 !important;
}

/* Ensure draggable rows show proper cursor */
.cbi-section-table-row[draggable="true"] {
    transition: opacity 0.2s, background-color 0.2s;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .drag-handle {
        color: #aaa;
    }

    .drag-handle:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .cbi-section-table-row.dragging {
        background-color: #1a3a5c !important;
    }
}