/* ========================================
   TABLES - Generic ByLearning Styles
   Future: Add custom table themes here
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 51, 102, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

/* ========================================
   TABLE CONTAINER
   ======================================== */

.table-container {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 51, 102, 0.08);
    margin: 1rem 0;
}

.table-container table {
    margin: 0;
    box-shadow: none;
    min-width: 600px;
}

/* ========================================
   HEADERS
   ======================================== */

table thead th {
    background: linear-gradient(135deg, #003366 0%, #336699 100%);
    color: #ffffff;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 14px;
}

/* ========================================
   CELLS
   ======================================== */

table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e1e5e9;
    vertical-align: top;
    background: #ffffff;
    font-weight: normal;
}

/* First Row - Bold and Special */
table tbody tr:first-child td {
    font-weight: 600;
    background: rgba(0, 51, 102, 0.05) !important;
    border-top: 2px solid #003366;
}

/* Alternating Rows */
table tbody tr:nth-child(even) td {
    background: #f8f9fa;
}

/* Override for first row */
table tbody tr:first-child td {
    background: rgba(0, 51, 102, 0.05) !important;
}

/* ========================================
   HOVER EFFECTS
   ======================================== */

table tbody tr:hover td {
    background: #e8f4f8 !important;
    transition: background-color 0.2s ease;
}

table tbody tr:first-child:hover td {
    background: rgba(0, 51, 102, 0.12) !important;
}

/* ========================================
   BORDERS
   ======================================== */

table td:first-child {
    font-weight: inherit;
    background: inherit !important;
    border-left: none;
}

table td:last-child,
table th:last-child {
    border-right: none;
}

/* ========================================
   SCROLLBAR
   ======================================== */

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

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

.table-container::-webkit-scrollbar-thumb {
    background: #336699;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #003366;
}

/* ========================================
   SCROLL INDICATOR
   ======================================== */

.scroll-indicator {
    display: none;
    text-align: center;
    font-size: 12px;
    color: #666666;
    margin-bottom: 8px;
    font-style: italic;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .table-container {
        margin: 0.5rem 0;
        min-width: 90vw;
    }
    
    .table-container table {
        font-size: 13px;
    }
    
    table thead th,
    table tbody td {
        padding: 8px 12px;
        min-width: 100px;
    }
    
    table thead th {
        font-size: 12px;
    }
    
    .scroll-indicator {
        display: block;
    }
}

@media (max-width: 480px) {
    .table-container table {
        min-width: 450px;
        font-size: 12px;
    }
    
    table thead th,
    table tbody td {
        padding: 6px 10px;
        min-width: 80px;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */

.table-container.loading {
    position: relative;
    opacity: 0.7;
}

.table-container.loading::before {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    color: #003366;
    z-index: 100;
}
