/* List Component - Cacao UI Framework */

.list {
    background-color: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.list.bordered {
    border: 1px solid #e8e8e8;
}

.list-item {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    position: relative;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: #f8f9fa;
}

.list-item:active {
    background-color: #e9ecef;
}

.list-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.4;
}

.list-item-description {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 0;
}

.list-item-description:empty {
    display: none;
}

/* List Sizes */
.list.small .list-item {
    padding: 8px 12px;
}

.list.small .list-item-title {
    font-size: 12px;
}

.list.small .list-item-description {
    font-size: 11px;
}

.list.large .list-item {
    padding: 20px;
}

.list.large .list-item-title {
    font-size: 16px;
    margin-bottom: 6px;
}

.list.large .list-item-description {
    font-size: 14px;
}

/* List Variants */
.list.split .list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list.split .list-item-content {
    flex: 1;
}

.list.split .list-item-extra {
    margin-left: 16px;
    color: #666;
    font-size: 12px;
}

/* List Item Actions */
.list-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.list-item-actions button,
.list-item-actions .btn {
    font-size: 12px;
    padding: 4px 8px;
}

/* List Item Meta */
.list-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: #999;
}

.list-item-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* List Item Avatar */
.list-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.list-item.with-avatar {
    display: flex;
    align-items: flex-start;
}

.list-item.with-avatar .list-item-content {
    flex: 1;
}

/* List Item Status */
.list-item.active {
    background-color: rgba(139, 69, 19, 0.1);
    border-left: 3px solid #8B4513;
}

.list-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.list-item.selected {
    background-color: #e6f7ff;
    border-left: 3px solid #1890ff;
}

/* List Item Icon */
.list-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #8B4513;
    flex-shrink: 0;
}

.list-item.with-icon {
    display: flex;
    align-items: flex-start;
}

.list-item.with-icon .list-item-content {
    flex: 1;
}

/* List Header */
.list-header {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e8e8e8;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.list.bordered .list-header {
    border-bottom: 1px solid #e8e8e8;
}

/* List Footer */
.list-footer {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-top: 1px solid #e8e8e8;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* List Empty State */
.list-empty {
    padding: 40px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.list-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* List Loading State */
.list.loading {
    position: relative;
    min-height: 200px;
}

.list.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.list.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid #e8e8e8;
    border-top: 3px solid #8B4513;
    border-radius: 50%;
    animation: listSpin 1s linear infinite;
}

@keyframes listSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* List Virtual Scrolling */
.list.virtual {
    height: 400px;
    overflow-y: auto;
}

.list.virtual .list-item {
    border-bottom: 1px solid #f0f0f0;
}

/* List Drag and Drop */
.list.sortable .list-item {
    cursor: move;
}

.list.sortable .list-item:hover {
    background-color: #f8f9fa;
}

.list.sortable .list-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.list.sortable .list-item.drag-over {
    border-top: 2px solid #8B4513;
}

/* List Checkbox */
.list-item-checkbox {
    margin-right: 12px;
    flex-shrink: 0;
}

.list-item.with-checkbox {
    display: flex;
    align-items: flex-start;
}

.list-item.with-checkbox .list-item-content {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .list-item {
        padding: 12px;
    }
    
    .list.small .list-item {
        padding: 8px;
    }
    
    .list.large .list-item {
        padding: 16px;
    }
    
    .list.split .list-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .list.split .list-item-extra {
        margin-left: 0;
        margin-top: 8px;
    }
    
    .list-item-actions {
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* Accessibility */
.list-item:focus {
    outline: 2px solid #8B4513;
    outline-offset: -2px;
}

.list-item[role="button"] {
    cursor: pointer;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .list.bordered {
        border: 2px solid #000;
    }
    
    .list-item {
        border-bottom: 1px solid #000;
    }
    
    .list-header,
    .list-footer {
        border-color: #000;
    }
    
    .list-item.active {
        border-left: 3px solid #000;
    }
    
    .list-item.selected {
        border-left: 3px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .list-item {
        transition: none;
    }
    
    .list-item-actions {
        transition: none;
        opacity: 1;
    }
    
    .list.loading::after {
        animation: none;
    }
    
    .list.sortable .list-item.dragging {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .list {
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .list-item {
        break-inside: avoid;
        border-bottom: 1px solid #000;
    }
    
    .list-item-actions {
        display: none;
    }
    
    .list-item:hover {
        background-color: transparent;
    }
}