/* Table Plugin Styles
 * This file contains all CSS related to the table plugin functionality
 * including table layout, sorting, searching, pagination, and action buttons
 */

/* ============================================
   TABLE BASE STYLES
   ============================================ */

/* Table wrapper for horizontal scrolling - only the table scrolls */
.task-table-container {
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    margin-bottom: 20px; /* Space before pagination */
    border-radius: 8px; /* Match table border-radius */
    /* Firefox scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #667eea #f1f1f1;
}

/* Custom scrollbar styling for Chrome, Safari, Edge */
.task-table-container::-webkit-scrollbar {
    width: 12px; /* Vertical scrollbar width */
    height: 0; /* Horizontal scrollbar hidden */
}

/* Scrollbar track - rounded corners matching container */
.task-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

/* Scrollbar thumb - rounded corners */
.task-table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    border: 2px solid #f1f1f1;
    transition: background 0.2s ease;
}

.task-table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
}

/* Remove scrollbar arrows/buttons */
.task-table-container::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

/* Corner where horizontal and vertical scrollbars meet */
.task-table-container::-webkit-scrollbar-corner {
    background: #f1f1f1;
    border-radius: 0 0 8px 0; /* Rounded bottom-right corner */
}

.task-table {
    min-width: 1300px;
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.task-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.task-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

/* Center align Status column header and cells */
.task-table th:nth-child(3),
.task-table td:nth-child(3) {
    text-align: center;
}

/* Center align Creator, Assigned, Client, Project, and Due column headers and cells */
.task-table th:nth-child(4),
.task-table th:nth-child(5),
.task-table th:nth-child(6),
.task-table th:nth-child(7),
.task-table th:nth-child(8),
.task-table td:nth-child(4),
.task-table td:nth-child(5),
.task-table td:nth-child(6),
.task-table td:nth-child(7),
.task-table td:nth-child(8) {
    text-align: center;
}

.task-table th:first-child {
    padding-left: 16px;
}

.task-table th:last-child {
    padding-right: 16px;
}

/* ============================================
   COLUMN WIDTHS
   ============================================
   
   To customize column widths, modify the nth-child selectors below.
   The widths should add up to 100% (or close to it).
   
   Example: To make the Title column wider and Client narrower:
   .task-table th:nth-child(2) { width: 35%; }  /* Title */
   .task-table th:nth-child(6) { width: 6%; }  /* Client */
   
   Note: The table uses table-layout: fixed, so column widths are
   determined by the first row (header). All columns must have widths
   defined for consistent layout across pages.
   */

.task-table th:nth-child(1) { width: 6%; }   /* ID */
.task-table th:nth-child(2) { width: 34%; }  /* Title */
.task-table th:nth-child(3) { width: 10%; }   /* Status */
.task-table th:nth-child(4) { width: 8%; }  /* Created By */
.task-table th:nth-child(5) { width: 8%; }  /* Assigned To */
.task-table th:nth-child(6) { width: 8%; }  /* Client */
.task-table th:nth-child(7) { width: 10%; }  /* Project */
.task-table th:nth-child(8) { width: 10%; }   /* Finish Date */
.task-table th:nth-child(9) { width: 6%; }  /* Actions */

/* Users table specific column widths */
.users-table th:nth-child(1) { width: 5%; }   /* ID */
.users-table th:nth-child(2) { width: 8%; }   /* Username - smaller */
.users-table th:nth-child(3) { width: 22%; }  /* Full Name - bigger */
.users-table th:nth-child(4) { width: 9%; }   /* Mobile */
.users-table th:nth-child(5) { width: 13%; }  /* Role (Job) */
.users-table th:nth-child(6) { width: 18%; }  /* Email */
.users-table th:nth-child(7) { width: 7%; }   /* Type */
.users-table th:nth-child(8) { width: 11%; }  /* Created At */
.users-table th:nth-child(9) { width: 7%; }  /* Actions */

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

.task-table td {
    padding: 8px 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Title column - prevent wrapping and add fade effect */
.task-table td:nth-child(2) {
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    text-overflow: clip; /* Override ellipsis to allow fade effect */
    max-width: 0; /* This will be overridden by table-layout: fixed, but helps with the fade */
}

/* Users table - Full Name column with fade effect */
.users-table td:nth-child(3) {
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    text-overflow: clip;
    max-width: 0;
}

/* Fade effect for long titles */
.task-table td:nth-child(2)::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
    z-index: 1;
}

/* Fade effect for hovered rows - matches the gradient background */
.task-table tbody tr:hover td:nth-child(2)::after {
    background: linear-gradient(to right, rgba(248, 249, 255, 0), rgba(248, 249, 255, 0.5), rgba(255, 255, 255, 1));
}

/* Fade effect for users table Full Name column */
.users-table td:nth-child(3)::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
    z-index: 1;
}

/* Fade effect for hovered rows in users table */
.users-table tbody tr:hover td:nth-child(3)::after {
    background: linear-gradient(to right, rgba(248, 249, 255, 0), rgba(248, 249, 255, 0.5), rgba(255, 255, 255, 1));
}

/* Created By, Assigned To, Client, and Project columns - fade effect */
.task-table td:nth-child(4),
.task-table td:nth-child(5),
.task-table td:nth-child(6),
.task-table td:nth-child(7) {
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    text-overflow: clip; /* Override ellipsis to allow fade effect */
    max-width: 0; /* This will be overridden by table-layout: fixed, but helps with the fade */
}

/* Fade effect for Created By, Assigned To, Client, and Project columns */
.task-table td:nth-child(4)::after,
.task-table td:nth-child(5)::after,
.task-table td:nth-child(6)::after,
.task-table td:nth-child(7)::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
    z-index: 1;
}

/* Fade effect for hovered rows - matches the gradient background */
.task-table tbody tr:hover td:nth-child(4)::after,
.task-table tbody tr:hover td:nth-child(5)::after,
.task-table tbody tr:hover td:nth-child(6)::after,
.task-table tbody tr:hover td:nth-child(7)::after {
    background: linear-gradient(to right, rgba(248, 249, 255, 0), rgba(248, 249, 255, 0.5), rgba(255, 255, 255, 1));
}

.task-table td:first-child {
    padding-left: 16px;
    font-weight: 600;
    color: #667eea;
}

.task-table td:last-child {
    padding-right: 16px;
}

/* Ensure badge displays properly in table cells */
.task-table td strong {
    display: inline-block;
}

/* Ensure badge and text work together in title column */
.task-table td:nth-child(2) .warning-badge {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ============================================
   TABLE ROWS
   ============================================ */

.task-table tbody tr {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.task-table tbody tr:hover {
    background: linear-gradient(90deg, #f8f9ff 0%, #ffffff 100%);
    border-left-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
    transform: translateX(2px);
}

.task-table tbody tr:not(:last-child) {
    border-bottom: 1px solid #f5f5f5;
}

/* ============================================
   SORTABLE COLUMNS
   ============================================ */

.task-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.task-table th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.task-table th.sortable .sort-indicator {
    display: inline-block;
    margin-left: 6px;
    width: 0;
    height: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.task-table th.sortable:hover .sort-indicator {
    opacity: 1;
}

.task-table th.sortable.sort-asc .sort-indicator::after {
    content: '▲';
    font-size: 10px;
    opacity: 1;
}

.task-table th.sortable.sort-desc .sort-indicator::after {
    content: '▼';
    font-size: 10px;
    opacity: 1;
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    width: 100px;
    text-align: center;
    box-sizing: border-box;
}

.status-badge.backlog {
    background: #e9ecef;
    color: #495057;
}

.status-badge.todo {
    background: #cfe2ff;
    color: #084298;
}

.status-badge.inprogress {
    background: #fff3cd;
    color: #856404;
}

.status-badge.completed {
    background: #d1e7dd;
    color: #0f5132;
}

.status-badge.dropped {
    background: #f8d7da;
    color: #842029;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-edit {
    background: #0d6efd;
    color: white;
    padding: 6px 12px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-edit:hover {
    background: #0b5ed7;
}

.btn-view-icon {
    background: transparent;
    border: none;
    color: #0d6efd;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-view-icon:hover {
    background: #e7f1ff;
    color: #0b5ed7;
}

.btn-delete-icon {
    background: transparent;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-delete-icon:hover {
    background: #fee;
    color: #c82333;
}

.btn-edit-icon {
    background: transparent;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.btn-edit-icon:hover {
    background: #e7f3ff;
    color: #0056b3;
}

/* ============================================
   TABLE CONTROLS
   ============================================ */

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 5px 0;
    margin-top: 0;
    gap: 15px;
}

.rows-per-page {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 15px;
}

.rows-per-page label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.rows-per-page select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.rows-per-page select:focus {
    outline: none;
    border-color: #667eea;
}

/* ============================================
   TABLE SEARCH
   ============================================ */

.table-search-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.table-search {
    position: relative;
    width: 250px;
}

/* ID Search - smaller width for 13 characters (accounting for icons) */
.table-search-id {
    width: 180px;
}

.search-input {
    width: 100%;
    padding: 10px 80px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: #999;
}

.clear-icon {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: auto;
    cursor: pointer;
    transition: color 0.3s;
    font-size: 14px;
}

.clear-icon:hover {
    color: #dc3545;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: auto;
    cursor: pointer;
    transition: color 0.3s;
}

.search-icon:hover {
    color: #667eea;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 0;
    flex-wrap: wrap;
    gap: 15px;
}

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

.pagination-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    color: #999;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #666;
    font-size: 14px;
}

/* ============================================
   DATE FILTER CONTROLS
   ============================================ */

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

.date-filter-group {
    display: flex;
    gap: 5px;
}

.date-filter-btn {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.2s;
    background: #f8f9fa;
    border: 1px solid #ddd;
    color: #333;
    cursor: pointer;
}

.date-filter-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.date-filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.date-filter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
    border-color: #ddd;
    color: #999;
}

.date-filter-btn:disabled:hover {
    background: #f8f9fa;
    border-color: #ddd;
    color: #999;
}

.date-filter-btn-spacer {
    width: 40px;
    height: 32px;
    flex-shrink: 0;
}

.date-filter-separator {
    color: #ddd;
    font-size: 18px;
    padding: 0 5px;
}

.date-filter-nav {
    display: flex;
    gap: 5px;
    margin-left: 20px;
}

.date-filter-nav-btn {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.2s;
    background: #764ba2;
    color: white;
    border: none;
    cursor: pointer;
}

.date-filter-nav-btn:hover {
    background: #5a3a7a;
}

.date-filter-label {
    font-size: 14px;
    color: white;
    font-weight: 500;
    padding: 6px 12px;
    width: 280px;
    text-align: center;
    border-radius: 4px;
    background: #764ba2;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

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

@media (max-width: 768px) {
    .task-table {
        font-size: 13px;
    }
    
    .task-table th {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .task-table td {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-buttons {
        justify-content: center;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

