/**
 * Responsive Tables for Engineering Data
 * Ensures tables display properly on all devices
 */

/* Base Table Styles */
.responsive-table-wrapper {
    overflow-x: auto;
    margin: 25px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    min-width: 600px;
}

.responsive-table thead {
    background-color: #0066cc;
    color: #fff;
}

.responsive-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #003d7a;
}

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

.responsive-table tbody tr:hover {
    background-color: #f8f9fa;
}

.responsive-table tbody tr:last-child td {
    border-bottom: none;
}

/* Striped Rows */
.responsive-table.striped tbody tr:nth-child(odd) {
    background-color: #f5f5f5;
}

/* Compact Table Variant */
.responsive-table.compact th,
.responsive-table.compact td {
    padding: 8px 12px;
    font-size: 14px;
}

/* Data Alignment */
.responsive-table .align-right {
    text-align: right;
}

.responsive-table .align-center {
    text-align: center;
}

/* Number Formatting */
.responsive-table .number {
    font-family: 'Courier New', Consolas, Monaco, monospace;
    text-align: right;
}

/* Mobile Responsive (Stacked Layout) */
@media (max-width: 768px) {
    .responsive-table {
        min-width: 100%;
    }
    
    .responsive-table.mobile-stacked {
        border: 0;
    }
    
    .responsive-table.mobile-stacked thead {
        display: none;
    }
    
    .responsive-table.mobile-stacked tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .responsive-table.mobile-stacked td {
        display: block;
        text-align: right;
        padding: 12px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .responsive-table.mobile-stacked td:last-child {
        border-bottom: none;
    }
    
    .responsive-table.mobile-stacked td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #003d7a;
    }
}

/* Engineering-Specific Table Types */

/* Calculation Results Table */
.calc-results-table th {
    background-color: #ff6600;
}

.calc-results-table .result-value {
    font-weight: 700;
    color: #003d7a;
    font-size: 16px;
}

/* Comparison Table */
.comparison-table th {
    background-color: #28a745;
}

.comparison-table .highlight {
    background-color: #fff3cd;
    font-weight: 600;
}

/* Specifications Table */
.specs-table {
    font-size: 14px;
}

.specs-table th:first-child {
    width: 40%;
}

.specs-table .spec-name {
    font-weight: 600;
    color: #333;
}

.specs-table .spec-value {
    font-family: 'Courier New', Consolas, Monaco, monospace;
}

/* Scrollbar Styling for Table Wrapper */
.responsive-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

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

.responsive-table-wrapper::-webkit-scrollbar-thumb {
    background: #0066cc;
    border-radius: 4px;
}

.responsive-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #003d7a;
}

/* Print Optimization */
@media print {
    .responsive-table-wrapper {
        overflow: visible;
        box-shadow: none;
    }
    
    .responsive-table {
        font-size: 10px;
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 6px 8px;
    }
}
