/* Enhanced Table Styles */

/* Table Container */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

/* Enhanced Table */
.table-enhanced {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.table-enhanced thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    padding: 1.25rem 1rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    position: sticky;
    top: 0;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-bottom: 3px solid #e2e8f0;
}

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

.table-enhanced thead th.sortable:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0c4a6e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom-color: #0ea5e9;
}

.table-enhanced thead th.sorted {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    border-bottom-color: #3b82f6;
}

.table-enhanced thead th.sorted.asc {
    border-bottom: 4px solid #3b82f6;
}

.table-enhanced thead th.sorted.desc {
    border-bottom: 4px solid #3b82f6;
}

/* Sort Icons */
.sort-icon {
    margin-left: 8px;
    opacity: 0.6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.8em;
    color: #64748b;
}

.table-enhanced thead th.sortable:hover .sort-icon {
    opacity: 1;
    transform: scale(1.2) rotate(5deg);
    color: #0ea5e9;
}

.table-enhanced thead th.sorted .sort-icon {
    opacity: 1;
    color: #3b82f6;
    transform: scale(1.1);
}

/* Table Body */
.table-enhanced tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.table-enhanced tbody tr:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-enhanced tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
    border: none;
    font-size: 0.875rem;
    color: #374151;
}

/* Status Indicators */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.status-indicator.bg-warning {
    background-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.status-indicator.bg-success {
    background-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-indicator.bg-danger {
    background-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Priority Badges */
.priority-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-badge.high {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.priority-badge.medium {
    background-color: #fffbeb;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.priority-badge.low {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* Category Badges */
.category-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Checkboxes */
.table-enhanced input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-enhanced input[type="checkbox"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.table-enhanced input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Select Dropdowns */
.table-enhanced select {
    padding: 0.375rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-enhanced select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Action Buttons */
.btn-action {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    margin: 0 0.125rem;
}

/* Prevent conflicts with Select2 elements */
.select2-container *,
.select2-container button,
.select2-container .select2-selection,
.select2-container .select2-selection__arrow,
.select2-container .select2-selection__clear {
    transform: none !important;
    box-shadow: none !important;
    transition: none !important;
}

/* Exclude Select2 dropdowns from button hover effects */
.select2-container:hover,
.select2-container .select2-selection:hover {
    transform: none !important;
    box-shadow: none !important;
}

.btn-action.btn-edit {
    background-color: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.btn-action.btn-edit:hover {
    background-color: #bfdbfe;
    color: #1e3a8a;
    transform: translateY(-1px);
}

.btn-action.btn-delete {
    background-color: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-action.btn-delete:hover {
    background-color: #fecaca;
    color: #b91c1c;
    transform: translateY(-1px);
}

/* Table Controls */
.table-controls {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-radius: 12px 12px 0 0;
}

/* Filter Buttons */
.filter-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.filter-group .btn-group .btn[data-filter] {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #475569;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group .btn-group .btn[data-filter]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s ease;
}

.filter-group .btn-group .btn[data-filter]:hover::before {
    left: 100%;
}

.filter-group .btn-group .btn[data-filter]:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: #cbd5e1;
    color: #334155;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-group .btn-group .btn[data-filter].active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.filter-group .btn-group .btn[data-filter].active:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #2563eb;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* Search Input */
.search-input {
    position: relative;
    min-width: 280px;
    flex: 1;
    max-width: 400px;
}

.search-input .input-group-text {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 2px solid #e2e8f0;
    color: #64748b;
    border-radius: 8px 0 0 8px;
    transition: all 0.2s ease;
}

.search-input .form-control {
    border: 2px solid #e2e8f0;
    border-left: none;
    border-radius: 0 8px 8px 0;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-input .form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 8px rgba(59, 130, 246, 0.1);
    background: #ffffff;
    transform: translateY(-1px);
}

.search-input .form-control:focus + .input-group-text {
    border-color: #3b82f6;
    color: #3b82f6;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.search-input .input-group:focus-within {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Pagination */
.table-pagination {
    padding: 1rem;
    background-color: #f8fafc;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
}

/* Page Size Selector */
.page-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-size-selector .form-select {
    min-width: 140px;
    font-size: 0.875rem;
    border-radius: 6px;
}

.page-size-selector::before {
    content: "Show";
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Additional Select2 exclusions */
.form-select-enhanced,
.form-select-enhanced:hover,
.form-select-enhanced:focus {
    transform: none !important;
    box-shadow: none !important;
}

/* Comprehensive Select2 isolation */
.select2-container *,
.select2-container button,
.select2-container .select2-selection,
.select2-container .select2-selection__arrow,
.select2-container .select2-selection__clear,
.select2-container:hover *,
.select2-container .select2-selection:hover,
.select2-dropdown,
.select2-results__option {
    transform: none !important;
    box-shadow: none !important;
    transition: none !important;
}

/* Ensure Select2 dropdown doesn't get button hover effects */
.select2-dropdown {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #dee2e6 !important;
}

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

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-controls .btn {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    background-color: white;
    color: #374151;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination-controls .btn:hover:not(:disabled) {
    background-color: #f1f5f9;
    border-color: #9ca3af;
    transform: none;
    box-shadow: none;
}

.pagination-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .table-controls {
        gap: 1rem;
    }

    .filter-group .btn-group .btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.8rem;
    }

    .search-input {
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    .table-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }

    .filter-group {
        justify-content: center;
        flex-wrap: wrap;
    }

    .filter-group .btn-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-group .btn-group .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
        min-width: 90px;
    }

    .search-input {
        min-width: auto;
        max-width: none;
    }

    .table-pagination {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 0.75rem;
    }

    .page-size-selector {
        justify-content: center;
    }

    .page-size-selector::before {
        display: none;
    }

    .page-size-selector .form-select {
        min-width: 120px;
    }

    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .table-enhanced {
        font-size: 0.8rem;
    }

    .table-enhanced thead th,
    .table-enhanced tbody td {
        padding: 0.6rem 0.4rem;
    }

    .table-enhanced thead th {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    .status-indicator {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.65rem;
    }

    .btn-action {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.7rem;
    }

    .badge-enhanced {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 576px) {
    .table-container {
        margin: 0 -0.5rem;
    }

    .table-controls {
        padding: 0.75rem;
    }

    .filter-group .btn-group .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 80px;
    }

    .table-enhanced {
        font-size: 0.75rem;
    }

    .table-enhanced thead th,
    .table-enhanced tbody td {
        padding: 0.5rem 0.3rem;
    }

    .table-pagination {
        padding: 0.5rem;
    }

    .pagination-info {
        font-size: 0.8rem;
    }

    .page-info {
        font-size: 0.8rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading States */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty State */
.table-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.table-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.table-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.table-empty-description {
    font-size: 0.875rem;
    color: #6b7280;
}

