/* ==========================================================================
   ECOPHOT - SYSTÈME DE TABLEAUX UNIFIÉ
   Fichier: 03-components/tables.css
   ========================================================================== */

/* ==========================================================================
   TABLEAUX DE BASE
   ========================================================================== */

/* Table générique */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
}

table tr:nth-child(even) {
    background-color: var(--light);
}

table tr:hover {
    background-color: #e8f0fe;
}

/* Conteneur pour scroll horizontal */
.table-container {
    overflow-x: auto;
    margin: 30px 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ==========================================================================
   TABLEAUX DE SPÉCIFICATIONS
   ========================================================================== */

.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.specs-table th,
.specs-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.specs-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

.specs-table .section-header th {
    background-color: #1a73e8;
    color: white;
    font-size: 16px;
}

.specs-table tr:nth-child(even) {
    background-color: var(--light);
}

.specs-table tr:hover {
    background-color: #e8f0fe;
}

/* Table spécialisée pour spécifications détaillées */
.spec-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    margin: 15px 0;
}

.spec-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.spec-table td:first-child {
    font-weight: 500;
    color: #555;
    width: 45%;
    padding-right: 20px;
}

.spec-table td:last-child {
    color: #333;
    font-weight: 400;
}

.spec-table tr:hover {
    background-color: #e8f0fe;
}

/* Table détaillée avec en-têtes */
.spec-detailed-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.spec-detailed-table th,
.spec-detailed-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.spec-detailed-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

.spec-detailed-table tbody tr:hover {
    background-color: #e8f0fe;
}

/* ==========================================================================
   TABLEAUX DE COMPARAISON
   ========================================================================== */

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin: 30px 0;
}

.comparison-table th {
    background: #343a40;
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: bold;
}

.comparison-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
}

.comparison-table tr:nth-child(even) {
    background: #f8f9fa;
}

/* Ligne en surbrillance */
.highlight-row {
    background: #e8f5e8 !important;
    font-weight: bold;
}

.highlight-row td {
    border-top: 2px solid #28a745;
    border-bottom: 2px solid #28a745;
}

.highlight-row td:first-child {
    border-left: 2px solid #28a745;
}

.highlight-row td:last-child {
    border-right: 2px solid #28a745;
}

/* ==========================================================================
   TABLEAUX RASPBERRY PI
   ========================================================================== */

.rpi-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.rpi-comparison-table th,
.rpi-comparison-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.rpi-comparison-table th {
    background: linear-gradient(135deg, var(--primary), #0d5bbc);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
}

.rpi-comparison-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.rpi-comparison-table tbody tr:hover {
    background-color: #e8f4f8;
}

/* Cellules spécialisées avec codes couleur */
.spec-basic {
    background-color: #fff8f0;
}

.spec-good {
    background-color: #f0f7ff;
}

.spec-highlight {
    background-color: #e8f5e8;
}

/* ==========================================================================
   TABLEAUX DE PUISSANCE
   ========================================================================== */

.power-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.power-table th,
.power-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.power-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

.power-table tr:nth-child(even) {
    background-color: var(--light);
}

.power-table .total-row {
    background-color: #e8f4f8;
    font-weight: bold;
}

/* ==========================================================================
   TABLEAUX DE PRIX ET TARIFICATION
   ========================================================================== */

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.pricing-table th {
    background: linear-gradient(135deg, #1a73e8, #0d5bbc);
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: bold;
}

.pricing-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.pricing-table tr:nth-child(even) {
    background: #f8f9fa;
}

.pricing-table tr:hover {
    background-color: #e8f4f8;
}

/* Cellule de prix en surbrillance */
.pricing-table .price-highlight {
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    font-weight: bold;
    color: #155724;
}

/* ==========================================================================
   TABLEAUX POUR COMPOSANTS ÉLECTRONIQUES
   ========================================================================== */

/* Table générique pour composants */
.component-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.component-table th {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.component-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
}

.component-table tr:hover {
    background-color: #f8f9ff;
}

.component-table .component-name {
    font-weight: 600;
    color: var(--primary);
}


/* ==========================================================================
   TABLEAUX AVEC ICÔNES
   ========================================================================== */

.table-with-icons td:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tech-icon {
    margin-right: 8px;
    font-size: 1.1rem;
    color: var(--primary);
}

/* ==========================================================================
   STYLES SPÉCIAUX POUR SECTIONS
   ========================================================================== */

/* Section de comparaison avec table */
.comparison-section {
    background: #f8f9fa;
    padding: 50px 0;
}

.comparison-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
    font-size: 2rem;
}

/* Container pour grandes tables */
.large-table-container {
    overflow-x: auto;
    margin: 30px 0;
    padding: 20px 0;
}

.large-table-container::-webkit-scrollbar {
    height: 8px;
}

.large-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.large-table-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.large-table-container::-webkit-scrollbar-thumb:hover {
    background: #0d5bbc;
}

/* ==========================================================================
   TABLEAUX AVEC DONNÉES COMPLEXES
   ========================================================================== */

/* Table avec groupes de données */
.grouped-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.group-header {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    font-weight: bold;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.group-header td {
    padding: 15px;
    border-bottom: 2px solid #adb5bd;
}

/* Sous-groupes */
.sub-group {
    background: #f8f9fa;
    font-style: italic;
}

/* ==========================================================================
   TABLEAUX AVEC ACTIONS
   ========================================================================== */

.action-table {
    width: 100%;
    border-collapse: collapse;
}

.action-table .action-cell {
    width: 120px;
    text-align: center;
    padding: 10px 5px;
}

.table-action-btn {
    padding: 5px 10px;
    margin: 2px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.table-action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ==========================================================================
   TABLEAUX RÉACTIFS/ADAPTATIFS
   ========================================================================== */

/* Table empilable sur mobile */
.responsive-table {
    width: 100%;
    border-collapse: collapse;
}

@media (max-width: 768px) {
    .responsive-table,
    .responsive-table thead,
    .responsive-table tbody,
    .responsive-table th,
    .responsive-table td,
    .responsive-table tr {
        display: block;
    }
    
    .responsive-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .responsive-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 8px;
        background: white;
    }
    
    .responsive-table td {
        border: none;
        position: relative;
        padding-left: 50% !important;
        text-align: right;
    }
    
    .responsive-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--primary);
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN GÉNÉRAL
   ========================================================================== */

@media (max-width: 992px) {
    .comparison-table,
    .specs-table,
    .power-table,
    .rpi-comparison-table {
        font-size: 0.9rem;
    }
    
    .comparison-table th,
    .comparison-table td,
    .specs-table th,
    .specs-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    /* Tables en scroll horizontal */
    .table-container {
        -webkit-overflow-scrolling: touch;
    }
    
    .comparison-table,
    .specs-table,
    .power-table,
    .rpi-comparison-table,
    .component-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        min-width: 600px;
    }
    
    .comparison-table th,
    .comparison-table td,
    .specs-table th,
    .specs-table td,
    .power-table th,
    .power-table td {
        min-width: 120px;
        font-size: 0.8rem;
        padding: 8px;
    }
    
    /* Instructions de scroll */
    .table-container::after {
        content: "← Faites défiler horizontalement →";
        display: block;
        text-align: center;
        font-size: 0.8rem;
        color: #666;
        font-style: italic;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .comparison-table,
    .specs-table,
    .power-table {
        min-width: 500px;
    }
    
    .comparison-table th,
    .comparison-table td,
    .specs-table th,
    .specs-table td {
        min-width: 100px;
        font-size: 0.75rem;
        padding: 6px 4px;
    }
    
    .table-action-btn {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
    
}

/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */

/* Amélioration du contraste pour l'accessibilité */
table th {
    color: white;
    background-color: var(--primary);
}

/* Indication visuelle pour les cellules importantes */
.table-highlight {
    background: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
}

/* Focus visible pour les éléments interactifs dans les tables */
.table-action-btn:focus,
.table-link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==========================================================================
   ANIMATIONS ET TRANSITIONS
   ========================================================================== */

/* Animation au survol des lignes */
table tr {
    transition: background-color 0.2s ease;
}

.performance-badge:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .table-container,
    table {
        overflow: visible !important;
        box-shadow: none !important;
        background: white !important;
    }
    
    table th {
        background: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
    }
    
    table tr:nth-child(even) {
        background: #f8f8f8 !important;
        -webkit-print-color-adjust: exact;
    }
    
    .table-action-btn {
        display: none !important;
    }
    
    /* Éviter les coupures de page dans les tables */
    table {
        page-break-inside: avoid;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    thead {
        display: table-header-group;
    }
    
    tfoot {
        display: table-footer-group;
    }
}