@tailwind base;
@tailwind components;
@tailwind utilities;

/*

@layer components {
  .btn-primary {
    @apply py-2 px-4 bg-blue-200;
  }
}

*/

.nav-link {
  transition: color 0.3s ease;
}

.nav-link.active {
  color: rgb(3 105 161/var(--tw-text-opacity, 1));
  /* Highlight kleur */
}

.table {
  display: grid;
  grid-template-columns: repeat(5, 2fr) 1fr;
  column-gap: 2rem;
  align-items: bottom;
  padding: 1rem;
  border-bottom: 1px solid #ccc;
}

.pagy-nav.pagination {
  @apply isolate inline-flex -space-x-px rounded-md shadow-sm;
}

.page.next a {
  @apply relative inline-flex items-center rounded-r-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20;
}

.page.prev a {
  @apply relative inline-flex items-center rounded-l-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20;
}

.page.next.disabled {
  @apply relative inline-flex items-center rounded-r-md border border-gray-300 bg-gray-100 px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20;
}

.page.prev.disabled {
  @apply relative inline-flex items-center rounded-l-md border border-gray-300 bg-gray-100 px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20;
}

.page a,
.page.gap {
  @apply bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center border px-4 py-2 text-sm font-medium focus:z-20;
}

.page.active {
  @apply z-10 border-indigo-500 bg-indigo-50 text-indigo-600 relative inline-flex items-center border px-4 py-2 text-sm font-medium focus:z-20;
}

/* ── Scheduler ────────────────────────────────────────────────────────────── */
/* Only rules that can't be expressed as inline Tailwind classes:             */
/* pseudo-elements, JS-toggled state classes, and complex gradients.          */

/* Task blocks – base + interactive states (JS sets .dragging / .highlighted) */
.gantt-task-block {
  @apply absolute top-2 h-[54px] rounded overflow-hidden cursor-pointer min-w-[4px] box-border px-[5px] py-[3px] transition-[box-shadow,transform] duration-150;
  border-left-width: 3px;
  border-left-style: solid;
}

.gantt-task-block.dragging {
  @apply opacity-[.35];
}

.gantt-task-block:hover {
  @apply -translate-y-px z-[5] shadow-[0_2px_8px_rgba(0,0,0,0.18)];
}

.gantt-task-block.highlighted {
  @apply z-[6] shadow-[0_0_0_2px_#3b82f6,_0_2px_8px_rgba(0,0,0,0.15)];
}

.gantt-task-block.map-highlighted {
  @apply z-[6];
  box-shadow: 0 0 0 2px #f59e0b, 0 0 12px rgba(245,158,11,0.4);
  filter: brightness(1.08);
  transition: box-shadow 0.15s ease, filter 0.15s ease;
}

/* Task block inner labels (also created dynamically in JS) */
.gantt-task-time {
  @apply text-[10px] font-semibold text-black/60 leading-tight whitespace-nowrap;
}

.gantt-task-name {
  @apply text-[11px] font-medium text-black/[.85] leading-snug overflow-hidden text-ellipsis whitespace-nowrap mt-px;
}

.gantt-task-type {
  @apply text-[10px] text-black/50 whitespace-nowrap overflow-hidden text-ellipsis;
}

.dark .gantt-task-name {
  @apply text-white/[.85];
}

.dark .gantt-task-time {
  @apply text-white/60;
}

/* Travel blocks – created dynamically in JS, complex gradient can't use @apply */
.gantt-travel-block {
  @apply absolute top-[22px] h-[26px] box-border rounded-[3px] flex items-center justify-center overflow-hidden border border-dashed border-emerald-400/40;
  background-image: repeating-linear-gradient(-45deg, rgba(16, 185, 129, 0.12) 0px, rgba(16, 185, 129, 0.12) 3px, transparent 3px, transparent 8px);
}

.gantt-travel-block.overlap {
  @apply border-red-400/60;
  background-image: repeating-linear-gradient(-45deg, rgba(239, 68, 68, 0.18) 0px, rgba(239, 68, 68, 0.18) 3px, transparent 3px, transparent 8px);
}

.gantt-travel-label {
  @apply text-[9px] text-emerald-600 whitespace-nowrap select-none;
}

.gantt-travel-block.overlap .gantt-travel-label {
  @apply text-red-500;
}

.dark .gantt-travel-block {
  @apply border-emerald-500/30;
  background-image: repeating-linear-gradient(-45deg, rgba(16, 185, 129, 0.15) 0px, rgba(16, 185, 129, 0.15) 3px, transparent 3px, transparent 8px);
}

.dark .gantt-travel-block.overlap {
  @apply border-red-500/50;
  background-image: repeating-linear-gradient(-45deg, rgba(239, 68, 68, 0.22) 0px, rgba(239, 68, 68, 0.22) 3px, transparent 3px, transparent 8px);
}

.dark .gantt-travel-label {
  @apply text-gray-500;
}

/* Gantt task tooltip */
.gantt-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: #1e2433;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 10px 13px;
  max-width: 240px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(5px) scale(0.96);
  transition: opacity 110ms ease, transform 110ms ease;
  transform-origin: bottom left;
}
.gantt-tooltip.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.gantt-tooltip-row {
  display: flex; gap: 8px; align-items: center; line-height: 1.75;
}
.gantt-tooltip-row + .gantt-tooltip-row {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 3px; margin-top: 3px;
}
.gantt-tooltip-icon {
  font-size: 11px; width: 14px; text-align: center;
  color: rgba(255,255,255,0.4); flex-shrink: 0;
}
.gantt-tooltip-text { color: #f1f5f9; font-size: 12px; font-weight: 500; }
.gantt-tooltip-sub  { color: rgba(255,255,255,0.4); font-weight: 400; }

/* Travel block tooltip – amber accent, compact */
.gantt-travel-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: #451a03;
  border: 1px solid rgba(251,191,36,0.25);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11px; font-weight: 500;
  color: #fcd34d;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 90ms ease, transform 90ms ease;
}
.gantt-travel-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Drag placeholder – created dynamically in JS */
.drag-placeholder {
  @apply absolute top-2 h-[54px] rounded pointer-events-none z-[15] box-border border-2 border-dashed border-blue-500 bg-blue-500/10;
}

/* Unscheduled panel – JS toggles .drop-target on the header */
.unscheduled-panel-header.drop-target {
  @apply bg-blue-50 border-b-blue-500;
}

/* Unscheduled table column resize handle */
.col-resize-handle {
  position: absolute;
  top: 10%;
  right: 0;
  width: 4px;
  height: 80%;
  cursor: col-resize;
  z-index: 10;
  border-radius: 2px;
  @apply bg-gray-300/60 dark:bg-gray-600/60;
}

.col-resize-handle:hover,
.col-resize-handle.dragging {
  @apply bg-blue-400;
}

.unscheduled-th.sorted-asc .sort-arrow::after {
  content: ' ▲';
}

.unscheduled-th.sorted-desc .sort-arrow::after {
  content: ' ▼';
}

.unscheduled-empty-row td {
  @apply text-center text-gray-400 py-4 italic cursor-default;
}

tr.dragging {
  @apply opacity-[.4];
}

/* Day-off overlay + outside-hours regions – same subtle diagonal stripe */
.gantt-outside-hours {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(156, 163, 175, 0.10) 0px,
    rgba(156, 163, 175, 0.10) 4px,
    transparent 4px,
    transparent 12px
  );
}
.dark .gantt-outside-hours {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 4px,
    transparent 4px,
    transparent 12px
  );
}

/* Day-off overlay – subtle diagonal stripes when no business hours configured */
.gantt-day-off {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(156, 163, 175, 0.10) 0px,
    rgba(156, 163, 175, 0.10) 4px,
    transparent 4px,
    transparent 12px
  );
}
.dark .gantt-day-off {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 4px,
    transparent 4px,
    transparent 12px
  );
}

/* Driver column – width controlled via CSS custom property set by JS */
.gantt-driver-col {
  width: var(--driver-col-width, 180px);
  min-width: 40px;
  flex-shrink: 0;
  position: relative;
}

.driver-col-resize-handle {
  position: absolute;
  top: 10%;
  right: 0;
  width: 4px;
  height: 80%;
  cursor: col-resize;
  z-index: 10;
  border-radius: 2px;
  @apply bg-gray-300/60 dark:bg-gray-600/60;
}

.driver-col-resize-handle:hover,
.driver-col-resize-handle.dragging {
  @apply bg-blue-400;
}

/* Compact mode: only show avatar, hide name/stats */
.gantt-panel-compact .gantt-driver-info {
  display: none;
}

.gantt-panel-compact .gantt-driver-col {
  @apply px-1.5 justify-center gap-0;
}

/* Resizable dividers – pseudo-elements and JS-toggled .dragging */
.split-divider::after {
  content: '';
  @apply block w-0.5 h-10 rounded-sm bg-gray-300 transition-[background-color,height] duration-150;
}

.split-divider:hover::after,
.split-divider.dragging::after {
  @apply bg-blue-500 h-[60px];
}

.row-divider::after {
  content: '';
  @apply block h-0.5 w-10 rounded-sm bg-gray-300 transition-[background-color,width] duration-150;
}

.row-divider:hover::after,
.row-divider.dragging::after {
  @apply bg-blue-500 w-[60px];
}

/* ── Collapsible sidebar ──────────────────────────────────────── */
.sidebar-nav {
  width: 16rem;
  transition: width 300ms ease;
}

html.sidebar-collapsed .sidebar-nav {
  width: 4rem;
}

/* Smooth label fade + collapse */
.sidebar-label {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  max-width: 12rem;
  opacity: 1;
  transition: max-width 300ms ease, opacity 200ms ease, margin-left 300ms ease;
}

html.sidebar-collapsed .sidebar-label {
  max-width: 0;
  opacity: 0;
  margin-left: 0 !important;
}

/* Centre icons when collapsed */
.sidebar-link {
  transition: justify-content 0ms, padding 300ms ease;
}

html.sidebar-collapsed .sidebar-link {
  justify-content: center;
}

/* Rotate toggle chevron when collapsed */
html.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Main content margin mirrors sidebar width */
@media (min-width: 640px) {
  .site-main {
    margin-left: 16rem;
    transition: margin-left 300ms ease;
  }

  html.sidebar-collapsed .site-main {
    margin-left: 4rem;
  }
}

/* Sidebar brand link (logo + naam) klapt in met de sidebar */
.sidebar-brand-link {
  overflow: hidden;
  max-width: 12rem;
  opacity: 1;
  transition: max-width 300ms ease, opacity 200ms ease;
}

html.sidebar-collapsed .sidebar-brand-link {
  max-width: 0;
  opacity: 0;
}

html.sidebar-collapsed .sidebar-brand-header {
  justify-content: center;
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

:root {
    --map-tiles-filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}

/* Dark mode styles that work with both system preference and class toggle */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .map-tiles {
        filter: var(--map-tiles-filter, none);
    }
}

/* For when dark mode is forced via class */
.dark .map-tiles {
    filter: var(--map-tiles-filter, none);
}
