/**
 * TicketListPlugin CSS - Complete Styling System
 * File: css/plugins/ticket-list-plugin.css
 * Version: 1.0.0 - Modular Plugin Styling
 * Created: Friday, August 8, 2025, 4:45 PM UTC+10
 * Purpose: Self-contained CSS for TicketListPlugin component
 */

/* ========================================
   PLUGIN CONTAINER & CORE STRUCTURE
   ======================================== */

.ticket-list-plugin {
    width: 100%;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.ticket-list-plugin * {
    box-sizing: border-box;
}

/* ========================================
   STATISTICS ROW SECTION
   ======================================== */

.plugin-stats-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1px;
    background: #e9ecef;
    padding: 0;
    margin: 0;
}

.plugin-stat-btn {
    background: #ffffff;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 65px;
}

.plugin-stat-btn:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
}

.plugin-stat-btn:active {
    transform: translateY(0);
}

.stat-number {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
    color: #495057;
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    line-height: 1.2;
}

/* Stat Button Color Themes */
.total-stat:hover { background: #e3f2fd; }
.total-stat:hover .stat-number { color: #1976d2; }

.urgent-stat:hover { background: #ffebee; }
.urgent-stat:hover .stat-number { color: #d32f2f; }

.medium-stat:hover { background: #fff3e0; }
.medium-stat:hover .stat-number { color: #f57c00; }

.low-stat:hover { background: #e8f5e8; }
.low-stat:hover .stat-number { color: #388e3c; }

.new-stat:hover { background: #f3e5f5; }
.new-stat:hover .stat-number { color: #7b1fa2; }

.cleared-stat:hover { background: #e0f2f1; }
.cleared-stat:hover .stat-number { color: #00796b; }

/* ========================================
   SEARCH SECTION
   ======================================== */

.plugin-search-section {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.plugin-search-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.plugin-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.plugin-search-input::placeholder {
    color: #6c757d;
}

.plugin-refresh-btn {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.plugin-refresh-btn:hover {
    background: #0056b3;
}

.plugin-refresh-btn:active {
    transform: translateY(1px);
}

.plugin-ticket-info {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* ========================================
   TABLE SECTION
   ======================================== */

.plugin-table-container {
    background: #ffffff;
}

.plugin-table {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.plugin-table-header {
    display: grid;
    background: #f1f3f4;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

.plugin-header-cell {
    padding: 12px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-right: 1px solid #dee2e6;
    transition: background-color 0.2s ease;
}

.plugin-header-cell:last-child {
    border-right: none;
}

.plugin-header-cell.sortable {
    cursor: pointer;
    user-select: none;
}

.plugin-header-cell.sortable:hover {
    background: #e9ecef;
}

.plugin-header-cell.sorted-asc,
.plugin-header-cell.sorted-desc {
    background: #e3f2fd;
    color: #1976d2;
}

/* Header Alignment */
.plugin-header-cell.left-align { justify-content: flex-start; }
.plugin-header-cell.center-align { justify-content: center; }
.plugin-header-cell.right-align { justify-content: flex-end; }

/* ========================================
   TABLE BODY & ROWS
   ======================================== */

.plugin-table-body {
    overflow-y: auto;
    min-height: 200px;
}

.plugin-ticket-row {
    display: grid;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.plugin-ticket-row:hover {
    background: #f8f9fa;
}

.plugin-ticket-row:active {
    background: #e9ecef;
}

/* Priority Row Styling */
.plugin-ticket-row.priority-urgent {
    border-left: 4px solid #dc3545;
}

.plugin-ticket-row.priority-high {
    border-left: 4px solid #fd7e14;
}

.plugin-ticket-row.priority-medium {
    border-left: 4px solid #ffc107;
}

.plugin-ticket-row.priority-low {
    border-left: 4px solid #28a745;
}

.plugin-ticket-cell {
    padding: 12px 8px;
    display: flex;
    align-items: center;
    border-right: 1px solid #f1f3f4;
    min-height: 50px;
    word-break: break-word;
    overflow: hidden;
}

.plugin-ticket-cell:last-child {
    border-right: none;
}

/* Cell Alignment */
.plugin-ticket-cell.left-align { justify-content: flex-start; }
.plugin-ticket-cell.center-align { justify-content: center; }
.plugin-ticket-cell.right-align { justify-content: flex-end; }

/* ========================================
   CELL CONTENT STYLING
   ======================================== */

/* Ticket Number */
.plugin-ticket-number {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

.plugin-ticket-number.type-CM {
    background: #ffe6e6;
    color: #721c24;
    border-color: #f5c6cb;
}

.plugin-ticket-number.type-IR {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.plugin-ticket-number.type-SR {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.plugin-ticket-number.type-SI {
    background: #cce5ff;
    color: #004085;
    border-color: #b0d4f1;
}

/* Lot Number */
.plugin-lot-number {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

/* Priority */
.plugin-priority {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.3px;
}

.plugin-priority.urgent {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.plugin-priority.high {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc02;
}

.plugin-priority.medium {
    background: #fffde7;
    color: #f57f17;
    border: 1px solid #fff59d;
}

.plugin-priority.low {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* Status */
.plugin-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.3px;
}

.plugin-status.open {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.plugin-status.in-progress {
    background: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc02;
}

.plugin-status.resolved {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.plugin-status.closed {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

/* Title */
.plugin-title {
    font-weight: 500;
    color: #212529;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Category */
.plugin-category {
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

/* ========================================
   SPECIAL STATES
   ======================================== */

/* Loading State */
.plugin-loading-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6c757d;
    gap: 12px;
}

.plugin-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: plugin-spin 1s linear infinite;
}

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

/* No Tickets State */
.plugin-no-tickets {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

/* Error State */
.plugin-error-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px;
}

/* ========================================
   THEME VARIATIONS
   ======================================== */

/* Default Theme (already defined above) */

/* Manager Theme */
.ticket-list-plugin.theme-manager {
    border: 2px solid #007bff;
}

.ticket-list-plugin.theme-manager .plugin-search-section {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.ticket-list-plugin.theme-manager .plugin-search-input {
    background: rgba(255, 255, 255, 0.9);
}

.ticket-list-plugin.theme-manager .plugin-table-header {
    background: #e3f2fd;
}

/* Security Theme */
.ticket-list-plugin.theme-security {
    border: 2px solid #dc3545;
}

.ticket-list-plugin.theme-security .plugin-search-section {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.ticket-list-plugin.theme-security .plugin-search-input {
    background: rgba(255, 255, 255, 0.9);
}

.ticket-list-plugin.theme-security .plugin-table-header {
    background: #ffebee;
}

/* Resident Theme */
.ticket-list-plugin.theme-resident {
    border: 2px solid #28a745;
}

.ticket-list-plugin.theme-resident .plugin-search-section {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.ticket-list-plugin.theme-resident .plugin-search-input {
    background: rgba(255, 255, 255, 0.9);
}

.ticket-list-plugin.theme-resident .plugin-table-header {
    background: #e8f5e8;
}

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

/* Tablet Breakpoint */
@media (max-width: 1024px) {
    .plugin-stats-row {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .plugin-stat-btn {
        padding: 10px 6px;
        min-height: 60px;
    }
    
    .stat-number {
        font-size: 16px;
    }
    
    .stat-label {
        font-size: 9px;
    }
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
    .plugin-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .plugin-search-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .plugin-refresh-btn {
        width: 100%;
        padding: 10px;
    }
    
    .plugin-table-header {
        font-size: 10px;
    }
    
    .plugin-header-cell,
    .plugin-ticket-cell {
        padding: 8px 6px;
    }
    
    .plugin-ticket-cell {
        min-height: 45px;
    }
    
    .plugin-ticket-number {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .plugin-title {
        font-size: 13px;
        -webkit-line-clamp: 1;
    }
}

/* Small Mobile Breakpoint */
@media (max-width: 480px) {
    .plugin-stats-row {
        grid-template-columns: 1fr;
    }
    
    .ticket-list-plugin {
        border-radius: 4px;
        margin: 0 -10px;
    }
    
    .plugin-search-section {
        padding: 12px 15px;
    }
    
    .plugin-header-cell,
    .plugin-ticket-cell {
        padding: 6px 4px;
    }
    
    .plugin-ticket-cell {
        min-height: 40px;
    }
    
    .stat-number {
        font-size: 14px;
    }
    
    .stat-label {
        font-size: 8px;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Hide elements */
.plugin-hidden {
    display: none !important;
}

/* Fade animations */
.plugin-fade-in {
    animation: plugin-fade-in 0.3s ease-in-out;
}

@keyframes plugin-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pulse effect for new items */
.plugin-pulse {
    animation: plugin-pulse 2s infinite;
}

@keyframes plugin-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Focus states for accessibility */
.plugin-stat-btn:focus,
.plugin-search-input:focus,
.plugin-refresh-btn:focus,
.plugin-header-cell:focus,
.plugin-ticket-row:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .ticket-list-plugin {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .plugin-search-section,
    .plugin-refresh-btn {
        display: none;
    }
    
    .plugin-stats-row {
        border-bottom: 2px solid #000;
    }
    
    .plugin-ticket-row {
        break-inside: avoid;
    }
}