/* css/list.css */
.klokin-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* Smooth fade in when changing pages/sorting */
.klokin-list-body {
    transition: opacity 0.2s ease-in-out;
}
.klokin-list-body.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Row animation */
.klokin-row {
    animation: slideIn 0.2s ease-out forwards;
    opacity: 0;
    transform: translateY(5px);
}

@keyframes slideIn {
    to { opacity: 1; transform: translateY(0); }
}

/* Stagger animation for rows (up to 10) */
.klokin-row:nth-child(1) { animation-delay: 0ms; }
.klokin-row:nth-child(2) { animation-delay: 30ms; }
.klokin-row:nth-child(3) { animation-delay: 60ms; }
.klokin-row:nth-child(4) { animation-delay: 90ms; }
.klokin-row:nth-child(5) { animation-delay: 120ms; }
.klokin-row:nth-child(6) { animation-delay: 150ms; }
.klokin-row:nth-child(7) { animation-delay: 180ms; }
.klokin-row:nth-child(8) { animation-delay: 210ms; }
.klokin-row:nth-child(9) { animation-delay: 240ms; }
.klokin-row:nth-child(10) { animation-delay: 270ms; }

/* 
   MOBILE RESPONSIVE STYLES 
   Transforms Table into Cards on small screens (<768px)
*/
@media (max-width: 768px) {
    /* Force table elements to block display */
    .kl-table, .kl-table thead, .kl-table tbody, .kl-table th, .kl-table td, .kl-table tr {
        display: block;
    }

    /* Hide table header visually */
    .kl-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Style Rows as Cards */
    .kl-table tr {
        margin-bottom: 1rem;
        background-color: #fff;
        border: 1px solid #e5e7eb; /* gray-200 */
        border-radius: 0.75rem;
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
        padding: 0.5rem 0;
    }

    /* Dark mode card override */
    :is(.dark .kl-table tr) {
        background-color: #262626; /* neutral-800 */
        border-color: #404040; /* neutral-700 */
    }

    /* Style Cells */
    .kl-table td {
        border: none;
        position: relative;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        text-align: right;
        border-bottom: 1px solid #f3f4f6; /* gray-100 */
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-height: 3.5rem;
    }

    /* Dark mode cell border */
    :is(.dark .kl-table td) {
        border-color: #404040; /* neutral-700 */
    }

    /* Remove border from last cell */
    .kl-table td:last-child {
        border-bottom: 0;
    }

    /* Inject Header Labels via CSS using data-label attribute */
    .kl-table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: #9ca3af; /* gray-400 */
        text-align: left;
        margin-right: 1rem;
    }
    
    /* Hide label if data-label is empty (e.g. actions) */
    .kl-table td[data-label=""]::before {
        content: none;
    }
    
    /* Ensure action buttons in cards align right or take full width if needed */
    .kl-table td:last-child {
        justify-content: flex-end;
        padding-top: 1rem;
    }
}