﻿/* DispatchCalendar.css - Professional HVAC Dispatch Calendar */
.calendar-container {
    background: #f8f9fa;
    min-height: 100vh;
    padding: 1rem;
}

/* Compact Header - Professional Style */
.calendar-header-compact {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.date-display {
    font-weight: 600;
    color: #2c3e50;
    min-width: 180px;
    text-align: center;
}

/* Filter Panels - Professional */
.filter-panel-compact {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.active-filters {
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
}

/* Task Filter Panel */
.task-filter-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out;
}

.task-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.task-pill {
    background: #e9ecef;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

    .task-pill:hover {
        background: #dee2e6;
        transform: translateY(-1px);
    }

    .task-pill.active {
        background: #0d6efd;
        color: white;
    }

/* Navigation Tabs - Professional */
.nav-tabs {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.5rem;
    border-bottom: none;
}

    .nav-tabs .nav-link {
        border: none;
        border-radius: 6px;
        padding: 0.75rem 1.5rem;
        color: #6c757d;
        font-weight: 500;
        transition: all 0.2s ease;
    }

        .nav-tabs .nav-link:hover {
            background: #f8f9fa;
            color: #495057;
        }

        .nav-tabs .nav-link.active {
            background: #0d6efd;
            color: white;
        }

/* Tab Content Container */
.tab-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1.5rem;
    margin-top: 1rem;
    min-height: 600px;
}

/* Zone View - Professional Layout */
.zone-view-container {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 320px);
}

.zones-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
}

    .zones-content::-webkit-scrollbar {
        width: 8px;
    }

    .zones-content::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    .zones-content::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

        .zones-content::-webkit-scrollbar-thumb:hover {
            background: #555;
        }

.zone-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-left: 4px solid var(--zone-color, #0d6efd);
}

.zone-header {
    background: linear-gradient(to right, rgba(13, 110, 253, 0.05), transparent);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .zone-header h5 {
        margin: 0;
        color: #2c3e50;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

.zone-stats {
    display: flex;
    gap: 0.75rem;
}

.stat-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

/* Timeline Grid - Professional */
.timeline-view {
    padding: 1rem;
    position: relative;
}

.timeline-grid,
.timeline-grid-full {
    display: grid;
    grid-template-columns: 140px repeat(14, 65px);
    gap: 2px;
    background: #e9ecef;
    padding: 2px;
    border-radius: 8px;
    overflow-x: auto;
    min-width: fit-content;
}

.hour-marker {
    background: #f8f9fa;
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6c757d;
    border-right: 1px solid #dee2e6;
}

    .hour-marker:first-child {
        background: transparent;
        border: none;
    }

.tech-timeline {
    display: contents;
}

.tech-name-cell {
    background: white;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    border-right: 1px solid #dee2e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

    .status-dot.status-available {
        background: #28a745;
    }

    .status-dot.status-working {
        background: #ffc107;
    }

    .status-dot.status-traveling {
        background: #17a2b8;
    }

.timeline-cell {
    background: white;
    min-height: 50px;
    padding: 2px;
    position: relative;
    border-right: 1px solid #f1f1f1;
}

    .timeline-cell.current-hour {
        background: #fff8e1;
    }

.job-timeline-block {
    background: #e3f2fd;
    border-left: 3px solid var(--zone-color, #0d6efd);
    padding: 2px 4px;
    margin: 1px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .job-timeline-block:hover {
        transform: scale(1.05);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        z-index: 10;
    }

    .job-timeline-block.overdue {
        background: #ffebee;
        border-left-color: #dc3545;
    }

    .job-timeline-block.working {
        background: #fff8e1;
        border-left-color: #ffc107;
    }

    .job-timeline-block.traveling {
        background: #e0f2f1;
        border-left-color: #17a2b8;
    }

    .job-timeline-block.complete {
        background: #e8f5e9;
        border-left-color: #28a745;
    }

/* Current Time Indicator */
.current-time-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dc3545;
    z-index: 20;
    pointer-events: none;
}

    .current-time-indicator::before {
        content: '';
        position: absolute;
        top: -5px;
        left: -4px;
        width: 10px;
        height: 10px;
        background: #dc3545;
        border-radius: 50%;
    }

/* Floating Details Panel - Professional */
.floating-details {
    position: sticky;
    top: 1rem;
    width: 420px;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    flex-shrink: 0;
}

.dispatch-details-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.dispatch-details-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .dispatch-details-header h5 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }

    .dispatch-details-header .btn-close {
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        opacity: 0.8;
        transition: opacity 0.2s ease;
        padding: 0;
        line-height: 1;
    }

        .dispatch-details-header .btn-close:hover {
            opacity: 1;
        }

.dispatch-details-body {
    padding: 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item,
.detail-item-full {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.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;
    font-size: 0.975rem;
}

.detail-divider {
    height: 1px;
    background: #e9ecef;
    margin: 1.25rem 0;
}

.location-info {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #0d6efd;
}

    .location-info strong {
        display: block;
        margin-bottom: 0.25rem;
        color: #2c3e50;
    }

    .location-info small {
        color: #6c757d;
        font-size: 0.875rem;
    }

.status-pill {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

    .status-pill.status-pending {
        background: #e3f2fd;
        color: #1976d2;
    }

    .status-pill.status-working {
        background: #fff8e1;
        color: #f57c00;
    }

    .status-pill.status-traveling,
    .status-pill.status-dispatched {
        background: #e0f2f1;
        color: #00838f;
    }

    .status-pill.status-complete,
    .status-pill.status-completed {
        background: #e8f5e9;
        color: #388e3c;
    }

.priority-pill {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

    .priority-pill.priority-high {
        background: #ffebee;
        color: #d32f2f;
    }

    .priority-pill.priority-normal {
        background: #fff8e1;
        color: #f57c00;
    }

    .priority-pill.priority-anytime {
        background: #e8f5e9;
        color: #388e3c;
    }

.task-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.25rem;
}

    .task-pills .task-pill {
        background: #e3f2fd;
        color: #1565c0;
        padding: 0.25rem 0.625rem;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 500;
    }

.detail-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 0.75rem;
}

    .detail-actions .btn {
        flex: 1;
        padding: 0.625rem 1rem;
        font-weight: 500;
        border-radius: 6px;
        transition: all 0.2s ease;
    }

/* Notes Modal - Professional */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 1050;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-dialog-custom {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1055;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header .btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    padding: 0;
    line-height: 1;
}

    .modal-header .btn-close:hover {
        opacity: 1;
    }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.notes-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin: 0;
    white-space: pre-wrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #2c3e50;
    max-height: 400px;
    overflow-y: auto;
}

    .notes-content::-webkit-scrollbar {
        width: 8px;
    }

    .notes-content::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    .notes-content::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

.modal-footer {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

/* Dispatch Modal for Tech View */
.dispatch-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1055;
    width: 90%;
    max-width: 500px;
    animation: modalSlideIn 0.3s ease-out;
}

/* Tech Calendar - Professional */
.tech-calendar {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 400px);
}

.tech-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1.5rem;
    overflow-y: auto;
}

    .tech-list h5 {
        margin: 0 0 1rem 0;
        color: #2c3e50;
        font-weight: 600;
    }

.tech-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

    .tech-item:hover {
        background: #e9ecef;
        transform: translateX(4px);
    }

    .tech-item.selected {
        background: #e3f2fd;
        border-color: #0d6efd;
    }

    .tech-item.available {
        border-left: 4px solid #28a745;
    }

    .tech-item.busy {
        border-left: 4px solid #ffc107;
    }

.calendar-grid {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1.5rem;
    overflow-y: auto;
}

.job-list {
    margin-top: 1rem;
}

.date-header-tech {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    margin: 1rem 0 0.5rem 0;
    border-radius: 6px;
    color: #495057;
    font-weight: 600;
}

.job-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

    .job-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        transform: translateY(-2px);
    }

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.job-priority {
    width: 4px;
    height: 30px;
    border-radius: 2px;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
}

    .job-priority.priority-high {
        background: #dc3545;
    }

    .job-priority.priority-normal {
        background: #ffc107;
    }

    .job-priority.priority-anytime {
        background: #28a745;
    }

.job-zone {
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #495057;
}

/* Week View - Professional */
.week-view {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
    padding: 1px;
    border-radius: 8px;
    overflow-x: auto;
}

.day-header {
    background: white;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
}

    .day-header.today {
        background: #e3f2fd;
        color: #0d6efd;
    }

.time-label {
    background: #f8f9fa;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-slot {
    background: white;
    min-height: 60px;
    padding: 4px;
    position: relative;
    border-right: 1px solid #f1f1f1;
    border-bottom: 1px solid #f1f1f1;
}

.job-block-small {
    background: #e3f2fd;
    border-left: 3px solid var(--zone-color, #0d6efd);
    padding: 4px 6px;
    margin-bottom: 2px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .job-block-small:hover {
        transform: scale(1.05);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        z-index: 10;
    }

/* Empty States */
.empty-slot {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    font-style: italic;
}

/* Legend - Professional */
.legend-compact {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #495057;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .zone-view-container,
    .timeline-view-container {
        flex-direction: column;
    }

    .floating-details {
        position: relative;
        width: 100%;
        margin-top: 1rem;
    }

    .tech-calendar {
        grid-template-columns: 1fr;
        height: auto;
    }

    .tech-list {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .calendar-header-compact {
        padding: 1rem;
    }

    .date-navigation {
        flex-wrap: wrap;
    }

    .filter-row {
        flex-direction: column;
    }

        .filter-row .form-group {
            width: 100%;
        }

    .timeline-grid,
    .timeline-grid-full {
        grid-template-columns: 100px repeat(14, 60px);
    }

    .week-view {
        grid-template-columns: 60px repeat(7, 100px);
    }

    .modal-dialog-custom {
        width: 95%;
        margin: 1rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Print styles */
@media print {
    .calendar-header-compact,
    .filter-panel-compact,
    .task-filter-panel,
    .nav-tabs,
    .legend-compact {
        display: none;
    }

    .tab-content {
        box-shadow: none;
        padding: 0;
    }

    .dispatch-details-card {
        page-break-inside: avoid;
    }
}
