/**
 * Smart Support Tickets List Dashboard Styles
 * Dedicated styling for the tickets list table and dashboard
 */

/* =======================
   BASIC TICKETS LIST STYLES
   ======================= */

.tickets-list-table {
    margin-top: 20px;
}

.ticket-row {
    transition: background-color 0.2s;
}

.ticket-row:hover {
    background-color: #f6f7f7;
}

.ticket-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.ticket-actions .button {
    font-size: 11px;
    padding: 2px 8px;
    height: auto;
    line-height: 1.4;
}

/* =======================
   WORDPRESS LIST TABLE COLUMN WIDTHS
   ======================= */

.wp-list-table .column-ticket {
    width: 80px;
    min-width: 80px;
    white-space: normal;
    line-height: 1.4;
}

.wp-list-table .column-customer {
    width: 12%;
    min-width: 120px;
}

.wp-list-table .column-subject {
    width: auto;
    min-width: 200px;
}

/* State column removed - state is now shown as a tag under ticket number */
.wp-list-table .column-state {
    display: none !important;
}

.wp-list-table .column-status {
    width: 80px;
    min-width: 80px;
}

.wp-list-table .column-priority {
    width: 80px;
    min-width: 80px;
}

.wp-list-table .column-agent {
    width: 10%;
    min-width: 100px;
}

.wp-list-table .column-department {
    width: 8%;
    min-width: 100px;
}

.wp-list-table .column-rating {
    width: 80px;
    min-width: 80px;
}

.wp-list-table .column-activity {
    width: 12%;
    min-width: 140px;
}

.wp-list-table .column-created {
    width: 8%;
    min-width: 100px;
}

/* Actions column removed - actions now appear under subject */

/* =======================
   TABLE LAYOUT IMPROVEMENTS
   ======================= */

/* Table layout improvements for fixed-width columns */
.wp-list-table {
    table-layout: fixed;
    width: 100%;
}

.wp-list-table th,
.wp-list-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wp-list-table .column-subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    width: 200px;
}

/* Override any other subject column width definitions */
.wp-list-table .column-subject {
    width: 200px !important;
    max-width: 200px !important;
    min-width: 200px !important;
}

/* Created column styling for two-line format */
.wp-list-table .column-created strong {
    display: block;
    line-height: 1;
    margin-bottom: 0;
}

.wp-list-table .column-created small {
    display: block;
    line-height: 1;
    margin-top: 0;
    margin-bottom: 0;
}

/* Activity column styling for two-line format */
.wp-list-table .column-activity strong {
    color: #1d2327;
    font-weight: 600;
}

.wp-list-table .column-activity .status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wp-list-table .column-activity small {
    color: #646970;
    font-size: 11px;
    line-height: 1.3;
    display: block;
    margin-top: 3px;
}

.wp-list-table .column-activity .waiting-support {
    background: #e6fffa;
    color: #0f766e;
    border: 1px solid #a7f3d0;
}

.wp-list-table .column-activity .waiting-customer {
    background: #fff4e5;
    color: #8a6d3b;
    border: 1px solid #fad7a0;
}

/* =======================
   BADGE STYLES (compact pills, shared sizing)
   ======================= */

.wp-list-table .department-badge,
.wp-list-table .priority-badge,
.wp-list-table .status-badge,
.wp-list-table .state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-sizing: border-box;
    vertical-align: middle;
}

.wp-list-table .department-badge {
    color: #fff;
}

.wp-list-table .priority-badge.priority-low {
    background-color: #28a745;
    color: #fff;
}

.wp-list-table .priority-badge.priority-medium {
    background-color: #ffc107;
    color: #212529;
}

.wp-list-table .priority-badge.priority-high {
    background-color: #fd7e14;
    color: #fff;
}

.wp-list-table .priority-badge.priority-urgent {
    background-color: #dc3545;
    color: #fff;
}

/* Waiting badges (admin list) */
.wp-list-table .status-badge.waiting-support {
    background-color: #fff4e5;
    color: #8a6d3b;
    border: 1px solid #fad7a0;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
}

.wp-list-table .status-badge.waiting-customer {
    background-color: #e6fffa;
    color: #0f766e;
    border: 1px solid #a7f3d0;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
}

.wp-list-table .status-badge.status-new {
    background-color: #e3f2fd;
    color: #0d47a1;
}

.wp-list-table .status-badge.status-working_on {
    background-color: #fff3e0;
    color: #e65100;
}

.wp-list-table .status-badge.status-on_hold {
    background-color: #fce4ec;
    color: #880e4f;
}

.wp-list-table .state-badge.state-opened {
    background-color: #28a745;
    color: #fff;
}

.wp-list-table .state-badge.state-closed {
    background-color: #6c757d;
    color: #fff;
}

.wp-list-table .state-badge.state-delayed {
    background-color: #ffc107;
    color: #212529;
}

/* =======================
   ENHANCED LIST TABLE STYLING
   ======================= */

.wp-list-table .column-ticket {
    font-weight: 600;
}

/* State badge under ticket number */
.wp-list-table .column-ticket .state-badge {
    margin-top: 4px;
}

/* Ensure state badge colors in ticket column match standard state colors */
.wp-list-table .column-ticket .state-badge.state-opened {
    background-color: #28a745;
    color: #fff;
}

.wp-list-table .column-ticket .state-badge.state-closed {
    background-color: #6c757d;
    color: #fff;
}

.wp-list-table .column-ticket .state-badge.state-delayed {
    background-color: #ffc107;
    color: #212529;
}

.wp-list-table .column-subject {
    max-width: 300px;
}

.wp-list-table .column-customer {
    max-width: 200px;
}

.wp-list-table .column-department,
.wp-list-table .column-priority,
.wp-list-table .column-status,
.wp-list-table .column-rating,
.wp-list-table .column-activity {
    text-align: center;
}

/* Status and State Badges - Enhanced */
.wp-list-table .status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-list-table .status-new {
    background: #e3f2fd;
    color: #0d47a1;
}

.wp-list-table .status-working_on {
    background: #fff3e0;
    color: #e65100;
}

.wp-list-table .status-on_hold {
    background: #fce4ec;
    color: #880e4f;
}

.wp-list-table .state-opened {
    background: #e8f5e8;
    color: #2e7d32;
}

.wp-list-table .state-closed {
    background: #f5f5f5;
    color: #616161;
}

.wp-list-table .state-delayed {
    background: #fff8e1;
    color: #f57f17;
}

/* =======================
   SEARCH AND FILTERING
   ======================= */

/* Search Results Highlighting */
.wp-list-table .ticket-row.highlighted {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.wp-list-table .ticket-subject .search-highlight {
    background-color: #fff3cd;
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 600;
}

/* Column visibility states */
.wp-list-table .column-hidden {
    display: none !important;
}

/* =======================
   WAITING ICONS AND INDICATORS
   ======================= */

/* Ensure proper alignment in ticket list */
.wp-list-table .column-subject .waiting-icon {
    margin-right: 8px;
    font-size: 16px;
    color: #ffc107;
}

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

/* Responsive adjustments for list table */
@media screen and (max-width: 782px) {
    .wp-list-table .column-department,
    .wp-list-table .column-priority,
    .wp-list-table .column-status,
    .wp-list-table .column-rating,
    .wp-list-table .column-activity {
        display: none;
    }
    
    .wp-list-table .column-subject {
        width: 40%;
    }
    
    .wp-list-table .column-customer {
        width: 30%;
    }
    
    .wp-list-table .column-agent {
        width: 20%;
    }
    
    .wp-list-table .column-created {
        width: 10%;
    }
}

/* Mobile responsive for waiting icon */
@media (max-width: 768px) {
    .wp-list-table .column-subject .waiting-icon {
        font-size: 14px;
        margin-right: 6px;
    }
}

/* =======================
   ADDITIONAL ENHANCEMENTS
   ======================= */

/* Enhanced hover effects */
.wp-list-table tbody tr:hover {
    background-color: #f6f7f7;
    transition: background-color 0.2s ease;
}

/* =======================
   ROW ACTIONS (HOVER ACTIONS)
   ======================= */

/* Hide row actions by default */
.wp-list-table .row-actions {
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s ease;
}

/* Show row actions on hover */
.wp-list-table tbody tr:hover .row-actions {
    visibility: visible;
    opacity: 1;
}

/* Row actions styling */
.wp-list-table .row-actions {
    position: relative;
    font-size: 11px;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.wp-list-table .row-actions a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.wp-list-table .row-actions a:hover {
    color: #005a87;
    background-color: #f0f8ff;
    text-decoration: none;
}

/* Specific action colors */
.wp-list-table .row-actions .edit-ticket:hover {
    color: #00a32a;
    background-color: #f0fff4;
}

.wp-list-table .row-actions .close-ticket:hover {
    color: #d63638;
    background-color: #fff5f5;
}

.wp-list-table .row-actions .reopen-ticket:hover {
    color: #00a32a;
    background-color: #f0fff4;
}

.wp-list-table .row-actions .delete-ticket:hover {
    color: #d63638;
    background-color: #fff5f5;
}

.wp-list-table .row-actions .view-ticket:hover {
    color: #0073aa;
    background-color: #f0f8ff;
}

/* Subject column with row actions */
.wp-list-table .column-subject {
    position: relative;
}

.wp-list-table .column-subject .row-actions {
    margin-top: 4px;
    line-height: 1.4;
}

/* Row actions now appear under subject - no separate column needed */

/* Ensure actions are visible on mobile */
@media (max-width: 782px) {
    .wp-list-table .row-actions {
        visibility: visible;
        opacity: 1;
    }
}

/* Better spacing for action buttons */
.wp-list-table .ticket-actions .button {
    margin: 0 2px;
}

/* Improved text alignment */
.wp-list-table .column-ticket {
    text-align: left;
}

.wp-list-table .column-created {
    text-align: center;
}

/* Better visual hierarchy */
.wp-list-table .column-subject .ticket-link {
    font-weight: 500;
    color: #0073aa;
    text-decoration: none;
}

.wp-list-table .column-subject .ticket-link:hover {
    text-decoration: underline;
}

