/* ═══════════════════════════════════════════
   kdFast - Listes
   ═══════════════════════════════════════════ */

:root {
    --kl-radius: 8px;
    --kl-border: #e5e7eb;
    --kl-bg: #fff;
    --kl-text: #1f2937;
    --kl-text-muted: #9ca3af;
    --kl-hover: #f9fafb;
    --kl-row-height: 38px;
    --kl-header-height: 36px;
    --kl-font-size: 13px;
}

/* ── Conteneur liste ── */
.kl-container {
    background: var(--kl-bg);
    border-radius: var(--kl-radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Barre du haut (titre + boutons) ── */
.kl-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    gap: 10px;
}

.kl-toolbar-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kl-toolbar-title .kl-back {
    font-size: 22px;
    color: var(--kdBlue);
    cursor: pointer;
    transition: transform 0.2s;
}

.kl-toolbar-title .kl-back:hover {
    transform: scale(1.1);
}

.kl-toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Boutons ── */
.kl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.kl-btn-blue {
    background: var(--kdBlue);
    color: white;
}

.kl-btn-blue:hover {
    background: #2563eb;
}

.kl-btn-green {
    background: var(--kdGreen);
    color: white;
}

.kl-btn-green:hover {
    background: #3da35d;
}

.kl-btn-grey {
    background: var(--kdGreyL);
    color: var(--kl-text);
}

.kl-btn-grey:hover {
    background: #d1d5db;
}

.kl-btn-red {
    background: #fee2e2;
    color: #dc2626;
}

.kl-btn-red:hover {
    background: #fecaca;
}

/* ── Entête colonnes ── */
.kl-header {
    display: flex;
    align-items: center;
    min-height: var(--kl-header-height);
    border-bottom: 2px solid var(--kl-border);
    background: #f8fafc;
}

.kl-header > div {
    display: flex;
    align-items: center;
    padding: 0 6px;
    height: 100%;
}

.kl-header input {
    width: 100%;
    height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 12px;
    background: transparent;
    color: var(--kl-text);
    transition: all 0.2s;
}

.kl-header input::placeholder {
    color: var(--kl-text-muted);
    font-weight: 500;
}

.kl-header input:focus {
    border-color: var(--kdBlue);
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(62,151,255,0.1);
}

/* Input avec filtre actif */
.kl-header input.kl-filter-active {
    background: rgba(82,179,108,0.08);
    border-bottom: 2px solid var(--kdGreen);
    border-radius: 4px 4px 0 0;
}

.kl-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--kl-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Icône tri ── */
.kl-sort {
    cursor: pointer;
    font-size: 12px;
    color: var(--kl-text-muted);
    margin-right: 4px;
    transition: color 0.2s;
}

.kl-sort:hover, .kl-sort.active {
    color: var(--kdBlue);
}

/* ── Icône calendrier ── */
.kl-calendar {
    cursor: pointer;
    font-size: 12px;
    color: var(--kdGreen);
    margin-left: 4px;
    transition: color 0.2s;
}

.kl-calendar:hover {
    color: var(--kdGreenD);
}

/* ── Badge filtre actif ── */
.kl-filter-badge {
    display: none;
    position: absolute;
    top: -10px;
    left: -5px;
    z-index: 10;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: white;
    border: 1px solid var(--kl-border);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    cursor: pointer;
    font-size: 11px;
}

.kl-filter-badge .kl-filter-count {
    background: var(--kdOrange);
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Corps de la liste (lignes) ── */
.kl-body {
    overflow-y: auto;
    flex: 1;
}

/* ── Ligne ── */
.kl-row {
    display: flex;
    align-items: center;
    min-height: var(--kl-row-height);
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.kl-row:hover {
    background: var(--kl-hover);
}

/* ── Cellule ── */
.kl-cell {
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: var(--kl-font-size);
    color: var(--kl-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-height: var(--kl-row-height);
}

.kl-cell.center { justify-content: center; }
.kl-cell.right { justify-content: flex-end; }
.kl-cell.left { justify-content: flex-start; }

.kl-cell.hand {
    cursor: pointer;
}

.kl-cell.hand:hover {
    color: var(--kdBlue);
}

/* ── Icônes actions dans les cellules ── */
.kl-cell .kl-icon-edit {
    color: var(--kdBlue);
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.kl-cell .kl-icon-edit:hover {
    transform: scale(1.15);
}

.kl-cell .kl-icon-delete {
    color: #dc2626;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.kl-cell .kl-icon-delete:hover {
    transform: scale(1.15);
}

/* ── Message aucun résultat ── */
.kl-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--kl-text-muted);
    font-size: 14px;
}

/* ── Opt personnalisation (config bouton) ── */
.kl-config-btn {
    font-size: 18px;
    color: var(--kdBlue);
    cursor: pointer;
    transition: transform 0.2s;
}

.kl-config-btn:hover {
    transform: rotate(30deg);
}

/* ── Redimensionnement colonnes ── */
.kl-resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
}

.kl-resizer::after {
    content: '';
    display: block;
    width: 1px;
    height: 100%;
    background: #e5e7eb;
    margin: auto;
    transition: background 0.2s;
}

.kl-resizer:hover::after {
    background: var(--kdBlue);
    width: 2px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .kl-toolbar {
        flex-wrap: wrap;
    }
    
    .kl-toolbar-buttons {
        width: 100%;
        justify-content: flex-end;
    }
    
    .kl-cell {
        font-size: 12px;
        padding: 0 4px;
    }
}
