/* =========================================
   📊 TABLES.CSS - SISTEMA UNIFICADO
   ========================================= */


/* =========================
   TABLA BASE
========================= */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    table-layout: auto;
}


/* =========================
   ESTADO LICENCIAS
========================= */

.table tbody tr.licencia-activa {
    background: rgba(40, 167, 69, 0.08);
}

.table tbody tr.licencia-inactiva {
    background: rgba(108, 117, 125, 0.05);
}


/* =========================
   CABECERA
========================= */

.table thead {
    background: var(--color-border);
}

.table th {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    font-weight: 700;
}


/* =========================
   CELDAS
========================= */

.table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

/* 🖥️ Ajustes específicos para el cuerpo de la tabla en escritorio */
.table tbody td {
    vertical-align: top;       /* 1. Todo el contenido empieza arriba de forma simétrica */
    line-height: 1.4;          /* 2. Hace que los textos de dos líneas queden compactos */
}

/* 3. Damos anchos proporcionales a las columnas críticas para evitar amontonamientos */
.table th:nth-child(1), .table tbody td:nth-child(1) { min-width: 150px; } /* Nombre */
.table th:nth-child(2), .table tbody td:nth-child(2) { width: 100px; white-space: nowrap; } /* CIF */
.table th:nth-child(3), .table tbody td:nth-child(3) { min-width: 180px; } /* Dirección */
.table th:nth-child(4), .table tbody td:nth-child(4) { width: 110px; white-space: nowrap; } /* Teléfono */


/* =========================
   HOVER
========================= */

.table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}


/* =========================
   STRIPED
========================= */

.table--striped tbody tr:nth-child(even) {
    background: var(--color-bg);
}


/* =========================
   WRAPPER (IMPORTANTE)
========================= */

.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}


/* =========================
   ESTADOS
========================= */

.row-danger {
    background: rgba(220, 53, 69, 0.08);
}

.row-warning {
    background: rgba(255, 193, 7, 0.10);
}

.row-success {
    background: rgba(40, 167, 69, 0.08);
}


/* =========================
   FOOTER
========================= */

.table tfoot {
    font-weight: 700;
}

.table tfoot td {
    border-top: 2px solid var(--color-border);
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 8px 10px;
    }
    
    /* En móviles quitamos los anchos fijos de escritorio */
    .table th:nth-child(1), .table tbody td:nth-child(1),
    .table th:nth-child(3), .table tbody td:nth-child(3) { 
        min-width: auto; 
    }
}