/**
 * AFSNote - Checklist Styles
 * Todo list with drag reorder
 */

/* Checklist container inherits from .view-container */
#checklist-container.active {
    flex-direction: column;
    overflow: hidden;
}

/* Input Container - Fixed at top */
.checklist-input-container {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
}

#checklist-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#checklist-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}

.checklist-add-btn {
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checklist-add-btn:hover {
    background: var(--accent-hover);
}

.checklist-add-btn:active {
    transform: scale(0.95);
}

/* Checklist Items - Only this area scrolls */
.checklist-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.checklist-item-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    gap: 12px;
    position: relative;
    transition: all var(--transition-fast);
    overflow: hidden;
    cursor: grab;
}

.checklist-item:active {
    cursor: grabbing;
}

.checklist-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.checklist-item.drag-over {
    border-color: var(--accent);
    background: var(--divider);
}

.checklist-item.selected {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb, 10, 132, 255), 0.1);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 10, 132, 255), 0.2);
}

.checklist-item.completed {
    opacity: 0.5;
}

.checklist-item.completed .checklist-text {
    text-decoration: line-through;
}

/* Drag Handle */
.checklist-drag-handle {
    color: var(--text-secondary);
    opacity: 0.4;
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 4px;
    margin: -4px;
    margin-right: 0;
    transition: opacity var(--transition-fast);
}

.checklist-item:hover .checklist-drag-handle {
    opacity: 0.8;
}

.checklist-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--accent);
    border-radius: 50%;
}

.checklist-text {
    flex: 1;
    color: var(--text);
    word-break: break-word;
    cursor: text;
    line-height: 1.5;
    font-size: 15px;
}

.checklist-edit-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 15px;
    outline: none;
    display: none;
}

.checklist-item.editing .checklist-edit-input {
    display: block;
}

.checklist-item.editing .checklist-text {
    display: none;
}

/* Action buttons */
.checklist-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.checklist-item:hover .checklist-actions {
    opacity: 1;
}

.checklist-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--divider);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checklist-action-btn:hover {
    background: var(--accent);
    color: white;
}

/* Delete button with fade animation */
.checklist-delete {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.checklist-delete.show {
    opacity: 1;
    visibility: visible;
}
