/* ============================================================================
   FullCalendar 360Synk Dark Theme
   Design language matched to cinematic-table list pages:
   - Dark charcoal base (not pure black)
   - Navy gradient headers
   - Alternating rows with real colour difference
   - Names vertically centred to align with event bars
   ============================================================================ */

/* Root calendar container */
.fc {
    --fc-border-color: rgba(255, 255, 255, 0.08);
    --fc-page-bg-color: #0f1520;
    --fc-neutral-bg-color: #141a26;
    --fc-list-event-hover-bg-color: rgba(33, 150, 243, 0.1);
    --fc-today-bg-color: rgba(33, 150, 243, 0.08);
    --fc-event-bg-color: var(--ts-blue, #2196F3);
    --fc-event-border-color: var(--ts-blue-dark, #1976D2);
    --fc-event-text-color: var(--pure-white, #fff);
    --fc-small-font-size: var(--font-size-xs, 0.75rem);
    --fc-event-selected-overlay-color: rgba(33, 150, 243, 0.25);
    font-family: var(--font-stack, 'Inter', sans-serif);
    color: var(--pure-white, #fff);
    border-radius: 12px;
    overflow: hidden;
}

/* Give the calendar body a charcoal base — lifts it off the page background */
.fc .fc-scrollgrid {
    background: #0f1520;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.fc .fc-timegrid,
.fc .fc-daygrid,
.fc .fc-timeline {
    background: #0f1520;
}

.fc .fc-scrollgrid-section > td,
.fc .fc-scrollgrid-section > th {
    border-color: rgba(255, 255, 255, 0.08);
}

/* ── Resource area (left engineer column) ── */
.fc .fc-resource-area {
    background: #0f1520;
}

.fc .fc-datagrid-cell-frame {
    padding: 0 12px;
}

.fc .fc-datagrid-cell-cushion {
    color: var(--pure-white, #fff);
    font-weight: var(--font-weight-medium, 500);
    font-size: var(--font-size-sm, 0.875rem);
}

/* Engineer name rows — vertically centred to align with event bars */
.fc .fc-datagrid-body td.fc-datagrid-cell {
    vertical-align: middle !important;
}

/* ── Header row — matches cinematic-table navy gradient ── */
.fc .fc-resource-area .fc-datagrid-header {
    background: linear-gradient(135deg, #1a2744 0%, #151d2e 100%) !important;
    border-bottom: 2px solid rgba(33, 150, 243, 0.3) !important;
}

.fc .fc-resource-area .fc-datagrid-header .fc-datagrid-cell-cushion {
    color: var(--pure-white, #fff);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fc-resource-unassigned .fc-datagrid-cell-cushion {
    color: var(--electric-amber, #FFD740) !important;
    font-style: italic;
}

/* ── Timeline header — matches navy gradient ── */
.fc .fc-timeline-header {
    background: linear-gradient(135deg, #1a2744 0%, #151d2e 100%) !important;
    border-bottom: 2px solid rgba(33, 150, 243, 0.3) !important;
}

.fc .fc-timeline-slot-frame {
    border-color: rgba(255, 255, 255, 0.06);
}

.fc .fc-timeline-slot-label .fc-timeline-slot-cushion {
    color: var(--pure-white, #fff);
    font-size: 0.85rem;
    font-weight: 700;
}

/* Row height — compact so single-job rows don't waste space */
.fc .fc-timeline-lane {
    min-height: 40px;
}

/* ── Day grid column headers (month view) — same navy gradient ── */
.fc .fc-col-header-cell {
    background: linear-gradient(135deg, #1a2744 0%, #151d2e 100%) !important;
    border-color: rgba(255, 255, 255, 0.08);
    border-bottom: 2px solid rgba(33, 150, 243, 0.3) !important;
}

.fc .fc-col-header-cell-cushion {
    color: var(--pure-white, #fff);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px;
    text-decoration: none;
}

/* ── Today column highlight ── */
.fc .fc-day-today,
.fc .fc-timeline-slot.fc-day-today {
    background: rgba(33, 150, 243, 0.08) !important;
}

/* ── Alternating row backgrounds via JS classes ──
   Real colour values, not opacity tricks on transparent.
   fc-row-odd = darker base, fc-row-even = slightly lifted */
.fc-row-odd,
.fc-row-odd .fc-datagrid-cell-frame {
    background: #0f1520 !important;
}

.fc-row-even,
.fc-row-even .fc-datagrid-cell-frame {
    background: #1a2237 !important;
}

/* Row separator borders — matches list pages */
.fc .fc-timeline-lane,
.fc .fc-datagrid-body .fc-datagrid-cell {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Row hover — subtle blue tint matching list pages */
.fc .fc-timeline-lane:hover,
.fc .fc-datagrid-body tr:hover .fc-datagrid-cell-frame {
    background: rgba(33, 150, 243, 0.08) !important;
}

/* ── Weekend column shading ── */
.fc .fc-day-sat,
.fc .fc-day-sun {
    background: rgba(0, 0, 0, 0.12) !important;
}

/* Unassigned resource row */
.fc .fc-timeline-lane[data-resource-id="unassigned"] {
    background: rgba(255, 215, 64, 0.04) !important;
}

/* ── Events — job bars ── */
.fc-event {
    border-radius: 5px;
    border: none;
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: var(--font-weight-medium, 500);
    padding: 4px 8px;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    margin: 1px 0;
}

.fc-event:hover {
    box-shadow: 0 0 12px rgba(33, 150, 243, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

.fc-event .fc-event-main {
    padding: 1px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-event .fc-event-title {
    font-weight: var(--font-weight-medium, 500);
}

/* ── Job status colours ── */
.fc-status-draft {
    background: rgba(158, 158, 158, 0.8) !important;
    border-left: 3px solid #9E9E9E !important;
}

.fc-status-scheduled {
    background: rgba(33, 150, 243, 0.8) !important;
    border-left: 3px solid var(--ts-blue, #2196F3) !important;
}

.fc-status-inprogress {
    background: rgba(255, 152, 0, 0.8) !important;
    border-left: 3px solid #FF9800 !important;
}

.fc-status-completed {
    background: rgba(76, 175, 80, 0.7) !important;
    border-left: 3px solid var(--success-green, #4CAF50) !important;
    opacity: 0.7;
}

.fc-status-cancelled {
    background: rgba(244, 67, 54, 0.5) !important;
    border-left: 3px solid var(--error-red, #F44336) !important;
    opacity: 0.5;
    text-decoration: line-through;
}

.fc-status-unassigned {
    background: rgba(100, 116, 139, 0.6) !important;
    border-left: 3px solid #64748B !important;
}

/* Secondary engineer events */
.fc-event-secondary {
    opacity: 0.75;
    border-left: 3px dashed currentColor !important;
}

/* ── Overlay events ── */
.fc-overlay-leave {
    background: rgba(76, 175, 80, 0.2) !important;
    border: 1px dashed rgba(76, 175, 80, 0.5) !important;
    color: #81C784 !important;
    cursor: default;
    font-style: italic;
}

.fc-overlay-vehicle {
    background: rgba(255, 215, 64, 0.15) !important;
    border: 1px dashed rgba(255, 215, 64, 0.4) !important;
    color: var(--electric-amber, #FFD740) !important;
    cursor: default;
    font-size: 0.7rem;
}

.fc-overlay-calibration {
    background: rgba(171, 71, 188, 0.15) !important;
    border: 1px dashed rgba(171, 71, 188, 0.4) !important;
    color: #CE93D8 !important;
    cursor: default;
    font-size: 0.7rem;
}

.fc-overlay-training {
    background: rgba(41, 182, 246, 0.15) !important;
    border: 1px dashed rgba(41, 182, 246, 0.4) !important;
    color: #4FC3F7 !important;
    cursor: default;
    font-size: 0.7rem;
}

.fc-overlay-survey {
    background: rgba(255, 183, 77, 0.2) !important;
    border: 1px dashed rgba(255, 183, 77, 0.5) !important;
    color: #FFB74D !important;
    cursor: pointer;
    font-size: 0.7rem;
}

/* ── Scrollbar ── */
.fc .fc-scroller::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.fc .fc-scroller::-webkit-scrollbar-track {
    background: #0f1520;
}

.fc .fc-scroller::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.fc .fc-scroller::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Dragging state ── */
.fc-event-dragging {
    opacity: 0.85;
    box-shadow: 0 0 24px rgba(33, 150, 243, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

/* ── Month view cells ── */
.fc .fc-daygrid-day-number {
    color: var(--pure-white, #fff);
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: var(--font-weight-medium, 500);
    padding: 6px 10px;
    text-decoration: none;
}

.fc .fc-daygrid-day-frame {
    min-height: 80px;
    background: #0f1520;
}

.fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-number {
    opacity: 0.4;
}

.fc .fc-daygrid-more-link {
    color: var(--ts-blue-light, #64B5F6);
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: var(--font-weight-medium, 500);
}

/* Popover */
.fc .fc-popover {
    background: #141a26;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.fc .fc-popover-header {
    background: linear-gradient(135deg, #1a2744 0%, #151d2e 100%);
    color: var(--pure-white, #fff);
    font-weight: 600;
    border-radius: 12px 12px 0 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .fc .fc-resource-area {
        width: 120px !important;
    }

    .fc-event {
        font-size: 0.65rem;
        padding: 2px 4px;
    }
}
