/**
 * Dynamic Data Table Widget Styles
 * 
 * @package Impact_Evaluator
 */

/* Dynamic Data Table Container */
.dynamic-data-table-container {
    position: relative;
    width: 100%;
}

/* Teams Table Section */
.teams-table-section {
    padding: 40px 0;
    background: #ffffff;
}

/* Table Container */
.table-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #f0f1f3;
}

/* Table Header */
.table-header {
    background: linear-gradient(135deg, #020244 0%, #590000 100%);
    color: #ffffff;
    padding: 20px 30px;
    text-align: center;
}

.table-header h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Table Controls */
.table-controls {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.table-search {
    max-width: 300px;
}

.table-search input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.table-search input:focus {
    outline: none;
    border-color: #020244;
    box-shadow: 0 0 0 3px rgba(2,2,68,0.1);
}

/* Table Wrapper */
.table-wrapper {
    overflow-x: auto;
    position: relative;
}

/* Teams Table */
.teams-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Poppins', sans-serif;
    background: #ffffff;
}

/* Table Header */
.teams-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #020244;
}

.teams-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #020244;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    white-space: nowrap;
}

/* Sortable Headers */
.teams-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.3s ease;
}

.teams-table th.sortable:hover {
    background-color: #e9ecef;
}

.sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #666;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.teams-table th.sortable:hover .sort-indicator {
    opacity: 0.7;
}

.teams-table th.sort-asc .sort-indicator {
    border-bottom: none;
    border-top: 4px solid #020244;
    opacity: 1;
}

.teams-table th.sort-desc .sort-indicator {
    border-bottom: 4px solid #020244;
    opacity: 1;
}

/* Table Body */
.teams-table tbody tr {
    border-bottom: 1px solid #f0f1f3;
    transition: background-color 0.3s ease;
}

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

.teams-table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.teams-table tbody tr:nth-child(even):hover {
    background-color: #f1f3f4;
}

.teams-table td {
    padding: 15px 20px;
    color: #333333;
    font-size: 14px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f1f3;
}

/* Column Widths */
.small-col { width: 15%; }
.medium-col { width: 25%; }
.large-col { width: 35%; }
.extra-large-col { width: 45%; }
.auto-col { width: auto; }

/* Links in Table */
.teams-table td a {
    color: #020244;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.teams-table td a:hover {
    color: #590000;
    text-decoration: underline;
}

/* Table Pagination */
.table-pagination {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #666666;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-btn {
    background: #020244;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    background: #590000;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-numbers .page-number {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #333333;
}

.page-numbers .page-number:hover {
    background: #020244;
    color: #ffffff;
    border-color: #020244;
}

.page-numbers .page-number.active {
    background: #020244;
    color: #ffffff;
    border-color: #020244;
}

/* Responsive Table */
@media (max-width: 768px) {
    .responsive-table .table-wrapper {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .responsive-table .teams-table {
        min-width: 600px;
    }
    
    .table-controls {
        padding: 15px 20px;
    }
    
    .table-header {
        padding: 15px 20px;
    }
    
    .table-header h3 {
        font-size: 20px;
    }
    
    .table-pagination {
        padding: 15px 20px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .pagination-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .teams-table th,
    .teams-table td {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .table-header h3 {
        font-size: 18px;
    }
    
    .pagination-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .page-numbers .page-number {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Animation Classes */
.has-animations .table-container {
    opacity: 0;
    transform: translateY(30px);
}

.has-animations .table-container.animate-in {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s ease;
}

/* Loading State */
.dynamic-data-table-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.dynamic-data-table-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #020244;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.teams-table tbody tr td[colspan] {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-style: italic;
}

/* Accessibility */
.teams-table:focus-within {
    outline: 2px solid #020244;
    outline-offset: 2px;
}

.pagination-btn:focus,
.page-numbers .page-number:focus {
    outline: 2px solid #020244;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .table-container {
        border: 2px solid #020244;
    }
    
    .teams-table th {
        color: #000000;
        background: #ffffff;
        border: 1px solid #000000;
    }
    
    .teams-table td {
        color: #000000;
        border: 1px solid #000000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .teams-table th,
    .teams-table td,
    .pagination-btn,
    .page-numbers .page-number {
        transition: none;
    }
    
    .has-animations .table-container {
        opacity: 1;
        transform: none;
    }
}

/* Print Styles */
@media print {
    .teams-table-section {
        background: #ffffff !important;
        padding: 0 !important;
    }
    
    .table-container {
        box-shadow: none !important;
        border: 1px solid #000000 !important;
    }
    
    .table-controls,
    .table-pagination {
        display: none !important;
    }
    
    .teams-table th {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .teams-table td {
        color: #000000 !important;
    }
}
