/* OpsFlow Component Styles */

/* Column Filter Popover - allows popover to escape table overflow */

/* The key fix: allow vertical overflow while keeping horizontal scroll */
.kt-scrollable-x-auto {
    overflow-x: auto;
    overflow-y: visible !important;
}

/* Ensure the card content also allows overflow */
.kt-card-content:has(.kt-scrollable-x-auto) {
    overflow: visible !important;
}

/* Table and thead need to allow overflow */
.kt-table {
    overflow: visible !important;
}

.kt-table thead,
.kt-table thead tr,
.kt-table thead th {
    overflow: visible !important;
}

/* Ensure table header cells can position popovers */
.kt-table thead th {
    position: relative;
}

/* The flex container inside th needs relative positioning too */
.kt-table thead th > .flex {
    position: relative;
}

/* =====================================================
   FullCalendar Glass Morphism Styles
   ===================================================== */

/* Calendar container with glass effect */
.fc {
    --fc-border-color: var(--color-gray-200);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: rgba(255, 255, 255, 0.3);
    --fc-today-bg-color: rgba(59, 130, 246, 0.1);
    font-family: inherit;
}

/* Dark mode calendar variables */
[data-theme="dark"] .fc,
.dark .fc {
    --fc-border-color: var(--color-gray-700);
    --fc-neutral-bg-color: rgba(31, 41, 55, 0.3);
    --fc-today-bg-color: rgba(59, 130, 246, 0.15);
}

/* Calendar header toolbar */
.fc .fc-toolbar {
    padding: 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 0 !important;
}

[data-theme="dark"] .fc .fc-toolbar,
.dark .fc .fc-toolbar {
    background: rgba(31, 41, 55, 0.6);
}

/* Toolbar title */
.fc .fc-toolbar-title {
    font-size: 1.25rem !important;
    font-weight: 600;
    color: inherit;
}

/* Toolbar buttons */
.fc .fc-button {
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-weight: 500 !important;
    transition: all 0.15s ease !important;
    border: 1px solid var(--fc-border-color) !important;
    background: rgba(255, 255, 255, 0.5) !important;
    color: inherit !important;
}

[data-theme="dark"] .fc .fc-button,
.dark .fc .fc-button {
    background: rgba(55, 65, 81, 0.5) !important;
    border-color: var(--color-gray-600) !important;
}

.fc .fc-button:hover {
    background: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="dark"] .fc .fc-button:hover,
.dark .fc .fc-button:hover {
    background: rgba(75, 85, 99, 0.8) !important;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--color-blue-500) !important;
    border-color: var(--color-blue-500) !important;
    color: white !important;
}

/* Calendar view container */
.fc .fc-view-harness {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 0 0 0.5rem 0.5rem;
    overflow: hidden;
}

[data-theme="dark"] .fc .fc-view-harness,
.dark .fc .fc-view-harness {
    background: rgba(31, 41, 55, 0.4);
}

/* Day grid header (day names) */
.fc .fc-col-header {
    background: rgba(249, 250, 251, 0.8);
}

[data-theme="dark"] .fc .fc-col-header,
.dark .fc .fc-col-header {
    background: rgba(55, 65, 81, 0.8);
}

.fc .fc-col-header-cell {
    padding: 0.75rem 0 !important;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Day cells */
.fc .fc-daygrid-day {
    transition: background-color 0.15s ease;
}

.fc .fc-daygrid-day:hover {
    background: rgba(59, 130, 246, 0.05);
}

.fc .fc-daygrid-day-number {
    padding: 0.5rem !important;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Today highlight */
.fc .fc-day-today {
    background: var(--fc-today-bg-color) !important;
}

/* Calendar events */
.fc-event {
    border-radius: 0.375rem !important;
    border: none !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    overflow: hidden;
}

.fc-event:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Event title */
.fc-event-title {
    font-weight: 500;
}

/* Time grid (week/day view) */
.fc .fc-timegrid-slot {
    height: 3rem !important;
}

.fc .fc-timegrid-slot-label {
    font-size: 0.75rem;
    color: var(--color-gray-500);
}

.fc .fc-timegrid-axis {
    font-size: 0.75rem;
    color: var(--color-gray-500);
}

/* Time grid events */
.fc .fc-timegrid-event {
    border-radius: 0.375rem !important;
    border-left: 3px solid !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fc .fc-timegrid-event .fc-event-main {
    padding: 0.25rem 0.5rem;
}

.fc .fc-timegrid-event .fc-event-time {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Now indicator (current time line) */
.fc .fc-timegrid-now-indicator-line {
    border-color: var(--color-red-500) !important;
    border-width: 2px !important;
}

.fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--color-red-500) !important;
}

/* More events popover */
.fc .fc-popover {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--fc-border-color) !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="dark"] .fc .fc-popover,
.dark .fc .fc-popover {
    background: rgba(31, 41, 55, 0.95) !important;
}

.fc .fc-popover-header {
    background: rgba(249, 250, 251, 0.8) !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

[data-theme="dark"] .fc .fc-popover-header,
.dark .fc .fc-popover-header {
    background: rgba(55, 65, 81, 0.8) !important;
}

/* Draggable work orders */
.fc-draggable {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fc-draggable:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.fc-draggable.dragging {
    opacity: 0.7;
}

/* Background events (technician availability) */
.fc-bg-event {
    opacity: 0.3;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(107, 114, 128, 0.2) 5px,
        rgba(107, 114, 128, 0.2) 10px
    ) !important;
}

/* List view */
.fc .fc-list {
    border-radius: 0.5rem !important;
}

.fc .fc-list-sticky .fc-list-day > * {
    background: rgba(249, 250, 251, 0.9) !important;
}

[data-theme="dark"] .fc .fc-list-sticky .fc-list-day > *,
.dark .fc .fc-list-sticky .fc-list-day > * {
    background: rgba(55, 65, 81, 0.9) !important;
}

.fc .fc-list-event:hover td {
    background: rgba(59, 130, 246, 0.1) !important;
}

/* Empty state */
.fc .fc-list-empty {
    background: transparent !important;
}

/* Calendar loading state */
.fc .fc-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}
