﻿/* Dispatcher.css - Modern HVAC Dispatch Management */
.dispatcher-page {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    padding: 1rem 0;
}

.page-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    margin: 0 auto;
    max-width: 1400px;
    overflow: hidden;
}

/* Collapsible Header */
.page-header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

    .page-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
        opacity: 0.3;
    }

    .page-header.expanded {
        padding: 2rem;
    }

    .page-header.compact {
        padding: 0.75rem 1.5rem;
    }

.header-content {
    position: relative;
    z-index: 2;
}

.header-title h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title .dispatch-icon {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.header-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Compact Header Bar */
.compact-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.compact-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.compact-icon {
    font-size: 1.5rem;
    background: rgba(255,255,255,0.2);
    padding: 0.5rem;
    border-radius: 8px;
}

.compact-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.compact-right {
    display: flex;
    gap: 0.5rem;
}

/* Statistics Section */
.stats-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 2rem;
    border-bottom: 1px solid #dee2e6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

    .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: var(--card-color, #667eea);
    }

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    }

    .stat-card.priority {
        --card-color: #dc3545;
    }

    .stat-card.active {
        --card-color: #28a745;
    }

    .stat-card.pending {
        --card-color: #ffc107;
    }

    .stat-card.total {
        --card-color: #007bff;
    }

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--card-color, #667eea);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: #2c3e50;
}

.stat-label {
    color: white;
    font-size: 0.875rem;
    margin: 0.5rem 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 2rem;
    border-bottom: 1px solid #dee2e6;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 500;
    color: #495057;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

    .filter-input:focus {
        outline: none;
        border-color: #ff6b35;
        box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
    }

.filter-select {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .filter-select:focus {
        outline: none;
        border-color: #ff6b35;
        box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
    }

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-filter {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
}

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    }

.btn-secondary {
    background: #6c757d;
    color: white;
}

    .btn-secondary:hover {
        background: #545b62;
        transform: translateY(-1px);
    }

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

    .pagination-controls.bottom {
        justify-content: center;
    }

.pagination-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.page-size-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    font-size: 0.875rem;
}

.pagination-buttons {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-page {
    padding: 0.375rem 0.75rem;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    min-width: 2.5rem;
}

    .btn-page:hover:not(:disabled) {
        background: #e9ecef;
        border-color: #adb5bd;
    }

    .btn-page.active {
        background: #0d6efd;
        color: white;
        border-color: #0d6efd;
    }

    .btn-page:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Dispatch Table */
.dispatch-table-container {
    background: white;
    border-radius: 0 0 15px 15px;
    overflow: hidden;
}

.table-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.table-count {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.dispatch-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .dispatch-table thead {
        background: #f8f9fa;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .dispatch-table th {
        padding: 1rem;
        text-align: left;
        font-weight: 600;
        color: #495057;
        border-bottom: 2px solid #dee2e6;
        white-space: nowrap;
    }

    .dispatch-table td {
        padding: 1rem;
        border-bottom: 1px solid #f1f3f4;
        vertical-align: top;
    }

.dispatch-row {
    transition: all 0.2s ease;
    cursor: pointer;
}

    .dispatch-row:hover {
        background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
        transform: scale(1.01);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .dispatch-row.priority-high {
        border-left: 4px solid #dc3545;
    }

    .dispatch-row.priority-medium {
        border-left: 4px solid #ffc107;
    }

    .dispatch-row.priority-low {
        border-left: 4px solid #28a745;
    }

/* Dispatch Card (Mobile) */
.dispatch-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

    .dispatch-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    }

.dispatch-card-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dispatch-id {
    font-size: 1.25rem;
    font-weight: 700;
}

.dispatch-card-body {
    padding: 1rem;
}

.dispatch-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dispatch-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-weight: 500;
    color: #2c3e50;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-new {
    background: #e3f2fd;
    color: #1976d2;
}

.status-assigned {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-inprogress {
    background: #fff3e0;
    color: #f57c00;
}

.status-complete {
    background: #e8f5e8;
    color: #388e3c;
}

.status-cancelled {
    background: #ffebee;
    color: #d32f2f;
}

.priority-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-high {
    background: #ffebee;
    color: #d32f2f;
}

.priority-medium {
    background: #fff8e1;
    color: #f57c00;
}

.priority-low {
    background: #e8f5e8;
    color: #388e3c;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .action-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

.btn-check {
    background: #28a745;
    color: white;
}

.btn-create {
    background: #dc3545;
    color: white;
}

.btn-view {
    background: #007bff;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-map {
    background: #6f42c1;
    color: white;
}

/* Task Pills */
.task-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.task-pill {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Address Info */
.address-info {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.4;
}

.address-detail {
    margin-top: 0.25rem;
}

/* Promise Date Styling */
.promise-date {
    color: #28a745;
    font-weight: 500;
}

    .promise-date.overdue {
        color: #dc3545;
    }

    .promise-date.today {
        color: #ffc107;
    }

/* Called In By */
.called-in-by {
    font-style: italic;
    color: #6c757d;
    font-size: 0.875rem;
}

/* Clickable Elements */
.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

    .clickable:hover {
        background: rgba(255, 107, 53, 0.1);
        border-radius: 4px;
        padding: 0.25rem;
        margin: -0.25rem;
    }

/* Coordinate Display */
.coordinates {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-top: 0.25rem;
}

/* Detail Modal */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.detail-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.detail-modal-header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-modal-body {
    padding: 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.detail-value {
    font-weight: 500;
    color: #2c3e50;
}

.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .close-btn:hover {
        background: rgba(255,255,255,0.3);
        transform: scale(1.1);
    }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .dispatcher-page {
        padding: 0;
    }

    .page-container {
        border-radius: 0;
        margin: 0;
    }

    .page-header.expanded {
        padding: 1.5rem;
    }

    .header-title h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .filter-section {
        padding: 1rem;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filter-actions {
        flex-direction: column;
    }

    .dispatch-table-container {
        display: none;
    }

    .dispatch-cards {
        display: block;
        padding: 1rem;
    }

    .compact-title {
        display: none;
    }

    .table-header {
        padding: 1rem;
    }

    .detail-modal-content {
        width: 95%;
        margin: 1rem;
    }

    .detail-modal-header {
        padding: 1rem;
    }

    .detail-modal-body {
        padding: 1rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .task-pills {
        gap: 0.25rem;
    }

    .task-pill {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-btn {
        justify-content: center;
    }

    .coordinates {
        font-size: 0.7rem;
        word-break: break-all;
    }

    /* Pagination Mobile */
    .pagination-controls {
        flex-direction: column;
    }

    .pagination-info {
        width: 100%;
        justify-content: space-between;
    }

    .pagination-buttons {
        justify-content: center;
    }
}

@media (min-width: 769px) {
    .dispatch-cards {
        display: none;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: slideIn 0.3s ease-out;
}

/* Filter Status */
.filter-active {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ff6b35;
}

.filter-status {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: inline-block;
}

/* Sorting indicators */
.sort-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}

    .sort-header:hover {
        background: rgba(255, 107, 53, 0.1);
    }

.sort-indicator {
    margin-left: 0.5rem;
    opacity: 0.5;
}

    .sort-indicator.active {
        opacity: 1;
        color: #ff6b35;
    }
