﻿/* ============================================
   TABLE STYLES - Unified
   ============================================ */

/* Base table container */
.table-container,
.users-table-container,
.storage-items-table {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Table header section (for tables with actions) */
.table-header {
    background: var(--bg-secondary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0;
}

.table-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Table body wrapper */
.table-body {
    overflow-x: auto;
}

/* Base table styles */
.data-table,
.users-table,
.items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

    /* Table headers */
    .data-table th,
    .users-table th,
    .items-table th {
        background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
        padding: 16px;
        text-align: left;
        font-weight: 700;
        color: #374151;
        border-bottom: 2px solid #e5e7eb;
        font-size: 14px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        white-space: nowrap;
    }

        /* Sortable headers */
        .data-table th.sortable,
        .users-table th.sortable,
        .items-table th.sortable {
            cursor: pointer;
            user-select: none;
            transition: var(--transition);
        }

            .data-table th.sortable:hover,
            .users-table th.sortable:hover,
            .items-table th.sortable:hover {
                background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
            }

    /* Table cells */
    .data-table td,
    .users-table td,
    .items-table td {
        padding: 16px;
        border-bottom: 1px solid #f3f4f6;
        font-size: 14px;
        vertical-align: middle;
    }

    /* Table rows */
    .data-table tbody tr,
    .users-table tbody tr,
    .items-table tbody tr {
        transition: var(--transition);
        cursor: pointer;
    }

        .data-table tbody tr:hover,
        .users-table tbody tr:hover,
        .items-table tbody tr:hover {
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
        }

        .data-table tbody tr:last-child td,
        .users-table tbody tr:last-child td,
        .items-table tbody tr:last-child td {
            border-bottom: none;
        }


        /* Ligne sélectionnée sans décaler le tableau */
        .data-table tbody tr.selected,
        .users-table tbody tr.selected,
        .items-table tbody tr.selected {
            position: relative;
            background: var(--bg-accent);
            border: none;
            box-shadow: inset 4px 0 0 0 var(--primary-blue); /* Simule la bordure à gauche */
            z-index: 1;
        }

    .data-table tbody tr,
    .users-table tbody tr,
    .items-table tbody tr {
        transition: background 0.2s ease, box-shadow 0.2s ease;
    }

        /* Special row states */
        .data-table tbody tr.no-items,
        .users-table tbody tr.no-items,
        .items-table tbody tr.no-items {
            opacity: 0.6;
        }

        .data-table tbody tr.dragging,
        .users-table tbody tr.dragging,
        .items-table tbody tr.dragging {
            opacity: 0.5;
            transform: rotate(1deg);
        }

/* Empty state */
.table-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

    .table-empty svg {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
        opacity: 0.5;
    }

/* Progress bar in table */
.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transition: width 0.3s ease;
}

/* Cell content helpers */
.cell-flex {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cell-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: #6b7280;
}

.cell-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

    .cell-badge.active {
        background: #dcfce7;
        color: #166534;
    }

    .cell-badge.inactive {
        background: #fee2e2;
        color: #991b1b;
    }

    .cell-badge.pending {
        background: #fef3c7;
        color: #92400e;
    }

/* Actions column */
.table-actions-cell {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Sticky header */
.table-sticky-header th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .data-table,
    .users-table,
    .items-table {
        font-size: 0.9rem;
        min-width: 500px;
    }

        .data-table th,
        .data-table td,
        .users-table th,
        .users-table td,
        .items-table th,
        .items-table td {
            padding: var(--spacing-sm) var(--spacing-md);
        }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }

    .progress-bar {
        width: 40px;
    }

    .table-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .data-table,
    .users-table,
    .items-table {
        min-width: 100%;
    }

        .data-table th,
        .data-table td,
        .users-table th,
        .users-table td,
        .items-table th,
        .items-table td {
            padding: 12px 8px;
            font-size: 13px;
        }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .table-container,
    .users-table-container,
    .storage-items-table {
        box-shadow: none;
        border: 1px solid #000;
    }

    .data-table tbody tr:hover,
    .users-table tbody tr:hover,
    .items-table tbody tr:hover {
        background: transparent;
    }

    .table-actions,
    .table-actions-cell {
        display: none;
    }
}
/* ============================================
   ROLE EDITING - Inline Actions
   ============================================ */



.role-container {
    width: 100%;
}

.role-edit-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0; /* Empêche les boutons de rétrécir */
}

/* ============================================
   ROLE DISPLAY - Edit Icon
   ============================================ */

.role-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

    .role-display:hover {
        background: #f3f4f6;
    }

        .role-display:hover .edit-icon {
            opacity: 1;
            transform: translateX(2px);
        }

.role-name {
    font-weight: 500;
    font-size: 14px;
}

    .role-name.editable {
        color: #3b82f6;
    }

.role-id {
    color: #9ca3af;
    font-size: 11px;
}

.edit-icon {
    opacity: 0;
    transition: all 0.2s;
    color: #6b7280;
    flex-shrink: 0;
}

    .edit-icon:hover {
        color: #3b82f6;
    }

/* Role badge colors */
.role-name.admin {
    color: #dc2626;
}

.role-name.manager {
    color: #ea580c;
}

.role-name.user {
    color: #3b82f6;
}

.role-name.guest {
    color: #6b7280;
}