/* ===== DATA TABLE COMPONENT STYLES ===== */

.table-component {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin: 1rem;
    position: relative;
}

.table-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.table-filters {
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.filters-row.compact {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.search-section {
    grid-column: span 2;
    min-width: 200px;
}

.search-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.search-input-group {
    display: flex;
    align-items: center;
}

.search-container .form-control {
    max-width: 300px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.search-container .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.search-container .btn {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    transition: all 0.2s ease;
}

.search-container .btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.filter-dropdowns {
    display: contents;
}

.filter-dropdowns .form-select,
.filter-dropdowns .form-control {
    min-width: 140px;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    background: white;
    transition: all 0.2s ease;
}

.filter-dropdowns .form-select:focus,
.filter-dropdowns .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.filter-dropdowns .form-control {
    background: white;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin: 0;
}

/* Status Tabs */
.status-tabs-container {
    grid-column: span 3;
    width: fit-content;
    margin-right: 1rem;
}

.status-tabs {
    display: flex;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.status-tab {
    flex: 0 0 auto;
    padding: 0.5rem 1rem;
    border: none;
    background: white;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-right: 1px solid #e5e7eb;
    position: relative;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.status-tab:last-child {
    border-right: none;
}

.status-tab:hover {
    background: #f9fafb;
    color: #374151;
}

.status-tab.active {
    background: #1f2937;
    color: white;
    font-weight: 600;
}

.status-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #3b82f6;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.5rem;
    flex-wrap: nowrap;
}

.apply-filters-btn {
    background: #4f46e5;
    border: 1px solid #4f46e5;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.apply-filters-btn:hover {
    background: #4338ca;
    border-color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.apply-filters-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
}

/* Clear Filters Section */
.clear-filters-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.clear-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

/* iPhone-style Toggle Switch - Theme Consistent */
.iphone-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
    cursor: pointer;
}

.iphone-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    border-radius: 30px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.iphone-toggle input:checked + .toggle-slider {
    background-color: #7c3aed;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.iphone-toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.iphone-toggle input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.clear-filters-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.clear-filters-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

.table-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.table-controls .btn {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    transition: all 0.2s ease;
}

.table-controls .btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.table-content {
    position: relative;
    min-height: 300px;
}

.table-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.table-responsive {
    overflow-x: auto;
}

.table {
    margin: 0;
    min-width: 800px;
}

.table thead th {
    background: #f8f9fa;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
    border-top: none;
    white-space: nowrap;
    position: relative;
}

.table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.table thead th.sortable:hover {
    background: #e9ecef;
}

.table thead th.sortable::after {
    content: '';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #9ca3af;
    opacity: 0.3;
    transition: all 0.2s ease;
}

.table thead th.sortable.sort-asc::after {
    border-bottom: 4px solid var(--primary-color);
    border-top: none;
    opacity: 1;
}

.table thead th.sortable.sort-desc::after {
    border-top: 4px solid var(--primary-color);
    border-bottom: none;
    opacity: 1;
}

.table tbody td {
    padding: 0.75rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table tbody tr.selected {
    background: rgba(79, 70, 229, 0.05);
    border-left: 3px solid var(--primary-color);
}

/* Column types */
.col-checkbox {
    width: 40px;
    text-align: center;
}

.col-id {
    width: 100px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

.col-status {
    width: 120px;
    text-align: center;
}

.col-date {
    width: 140px;
    text-align: center;
}

.col-actions {
    width: 120px;
    text-align: center;
}

.col-text {
    min-width: 150px;
}

.col-number {
    width: 100px;
    text-align: right;
}

/* Cell content styling */
.cell-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cell-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-multiline .cell-text {
    white-space: normal;
    line-height: 1.4;
}

.cell-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.cell-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #374151;
    flex-shrink: 0;
}

.cell-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

.cell-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Empty state */
.empty-state-icon {
    font-size: 3rem !important;
    opacity: 0.5;
    color: #9ca3af;
}

/* Bulk actions bar */
.bulk-actions-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 400px;
}

.bulk-actions-content {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bulk-selection-info {
    font-weight: 500;
    color: var(--text-primary);
}

.bulk-actions-buttons {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

/* Pagination */
.pagination-component {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    min-height: 60px;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.875rem;
}

.pagination {
    margin: 0;
}

.pagination .page-link {
    color: var(--text-secondary);
    border-color: #e5e7eb;
    padding: 0.375rem 0.75rem;
}

.pagination .page-link:hover {
    color: var(--primary-color);
    background-color: #f8f9fa;
    border-color: #e5e7eb;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #9ca3af;
    background-color: #f8f9fa;
    border-color: #e5e7eb;
}

/* Responsive design */
@media (max-width: 1200px) {
    .filters-row.compact {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .table-component {
        margin: 0.5rem;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filters-row.compact {
        grid-template-columns: 1fr;
    }
    
    .search-section {
        grid-column: span 1;
        max-width: none;
    }
    
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    .clear-filters-section {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .clear-toggle-container {
        justify-content: center;
    }
    
    .table-controls {
        justify-content: center;
        margin-left: 0;
    }
    
    .pagination-component {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .bulk-actions-bar {
        left: 1rem;
        right: 1rem;
        transform: none;
        min-width: auto;
    }
    
    .bulk-actions-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .bulk-actions-buttons {
        justify-content: center;
    }
}
