/**
 * ============================================================================
 * SHARED LIST SCREEN STYLES
 * ============================================================================
 *
 * File Path:        public/css/list-screen.css
 * Version:          1.0.0
 * Created:          Monday, March 03, 2026, 10:00 AM AEST
 *
 * Purpose:
 *   Standardised CSS classes for all info/list screens. Provides reusable
 *   controls bar, search input, filter chips, stat strip, table rows,
 *   badges, and empty state styling. Designed to replace 200-500 lines
 *   of duplicated embedded CSS per screen.
 *
 * Used by:
 *   - ticket-list.html (My Tickets)
 *   - Future: work-orders, pet-applications, directories, etc.
 */

/* ==========================================================================
   CONTROLS BAR — search + filter chips + refresh
   ========================================================================== */

.list-controls-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.list-search-input {
    flex: 0 1 300px;
    min-width: 200px;
    padding: 8px 12px 8px 34px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
    transition: border-color 0.2s;
}

.list-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.list-filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.list-filter-chip {
    padding: 5px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    background: white;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.list-filter-chip:hover {
    border-color: #3b82f6;
    color: #1d4ed8;
    background: #eff6ff;
}

.list-filter-chip.active {
    background: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
}

.list-refresh-btn {
    margin-left: auto;
    padding: 6px 10px;
    border: 1.5px solid #86efac;
    border-radius: 8px;
    background: #f0fdf4;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s;
    color: #16a34a;
    line-height: 1;
}

.list-refresh-btn:hover {
    border-color: #4ade80;
    color: #15803d;
    background: #dcfce7;
}

.list-refresh-btn.spinning {
    animation: list-spin 0.6s linear;
}

@keyframes list-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   STAT STRIP — horizontal summary counts
   ========================================================================== */

.list-stat-strip {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.list-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #6b7280;
}

.list-stat-item .stat-count {
    font-weight: 700;
    font-size: 1.05rem;
    color: #111827;
}

.list-stat-item .stat-label {
    font-weight: 500;
}

/* ==========================================================================
   TABLE — header + rows
   ========================================================================== */

.list-table {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.list-row {
    display: grid;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.12s;
}

.list-row:last-child {
    border-bottom: none;
}

.list-row:hover:not(.list-row--header) {
    background: #f8fafc;
}

.list-row--header {
    background: #f9fafb;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    cursor: default;
    border-bottom: 2px solid #e5e7eb;
    padding: 8px 16px;
}

/* Column classes — grid template set by screen-specific CSS */
.list-col {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-col--title {
    white-space: normal;
    line-height: 1.3;
}

.list-col--title .list-row-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 2px;
}

/* ==========================================================================
   BADGES — status, priority (reusable colours)
   ========================================================================== */

.list-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Status colours */
.list-badge--open        { background: #dbeafe; color: #1e40af; }
.list-badge--in-progress { background: #fef3c7; color: #92400e; }
.list-badge--pending     { background: #f3e8ff; color: #6b21a8; }
.list-badge--resolved    { background: #d1fae5; color: #065f46; }
.list-badge--closed      { background: #e5e7eb; color: #374151; }

/* Priority colours */
.list-badge--urgent      { background: #fecaca; color: #991b1b; }
.list-badge--high        { background: #fed7aa; color: #92400e; }
.list-badge--medium      { background: #fef3c7; color: #92400e; }
.list-badge--low         { background: #d1fae5; color: #065f46; }

/* ==========================================================================
   EMPTY / LOADING / ERROR STATES
   ========================================================================== */

.list-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}

.list-empty-state h3 {
    color: #374151;
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.list-empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

.list-loading-state {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}

.list-loading-state .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: list-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

/* ==========================================================================
   TICKET LIST — grid template (screen-specific)
   ========================================================================== */

.ticket-list-grid .list-row {
    grid-template-columns: minmax(130px, max-content) 50px 1fr 80px 100px 50px 30px;
}

/* Never truncate ticket number */
.list-col--id {
    overflow: visible;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Attachment icon column */
.list-col--icon {
    text-align: center;
    font-size: 0.85rem;
    color: #9ca3af;
}

.list-col--icon .has-attachments {
    color: #3b82f6;
}

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

@media (max-width: 768px) {
    .list-controls-bar {
        padding: 10px 12px;
    }

    .list-search-input {
        flex: 1 1 100%;
    }

    .list-stat-strip {
        gap: 12px;
        padding: 8px 12px;
    }

    .ticket-list-grid .list-row {
        grid-template-columns: 100px 1fr 80px 30px;
    }

    /* Hide lot, priority, age on mobile */
    .ticket-list-grid .list-col--lot,
    .ticket-list-grid .list-col--priority,
    .ticket-list-grid .list-col--age {
        display: none;
    }

    .list-row {
        padding: 8px 12px;
    }

    .list-row--header {
        display: none;
    }
}

@media (max-width: 480px) {
    .ticket-list-grid .list-row {
        grid-template-columns: 90px 1fr 70px;
    }

    .ticket-list-grid .list-col--icon {
        display: none;
    }
}
