/*
 * Nautiq - Availability Calendar
 * Design tokens keep the palette, spacing, and motion consistent
 * across the front-end widget and the admin scheduler.
 */

.nautiq-cal {
  /* Brand & surface - inherits booking theme tokens when present */
  --nautiq-cal-ink: var(--nautiq-primary, #0a3d62);
  --nautiq-cal-muted: #64748b;
  --nautiq-cal-faint: #94a3b8;
  --nautiq-cal-surface: #ffffff;
  --nautiq-cal-surface-soft: #f8fafc;
  --nautiq-cal-border: rgba(15, 23, 42, 0.08);
  --nautiq-cal-border-soft: rgba(15, 23, 42, 0.06);

  /* Status accents */
  --nautiq-cal-available: var(--nautiq-accent, #16a34a);
  --nautiq-cal-available-soft: #ecf7f1;
  --nautiq-cal-booked: #c0563f;
  --nautiq-cal-booked-soft: #faf0ed;
  --nautiq-cal-pending: #d97706;
  --nautiq-cal-pending-soft: #fffbeb;
  --nautiq-cal-disabled: #94a3b8;
  --nautiq-cal-disabled-soft: #f1f5f9;
  --nautiq-cal-focus: var(--nautiq-primary, #2563eb);

  /* Geometry & motion */
  --nautiq-cal-radius: 16px;
  --nautiq-cal-radius-cell: 12px;
  --nautiq-cal-gap: 10px;
  --nautiq-cal-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --nautiq-cal-speed: 0.18s;

  display: grid;
  gap: 20px;
  background: var(--nautiq-cal-surface);
  padding: 24px;
  border: 1px solid var(--nautiq-cal-border);
  border-radius: var(--nautiq-cal-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 34px rgba(15, 23, 42, 0.06);
  color: var(--nautiq-cal-ink);
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.nautiq-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nautiq-cal-header strong {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-family: var(--nautiq-font-display, "Playfair Display", Georgia, serif);
  color: var(--nautiq-cal-ink);
  text-align: center;
  flex: 1;
}

.nautiq-cal-nav {
  width: 42px;
  height: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: var(--nautiq-cal-surface);
  color: var(--nautiq-cal-ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--nautiq-cal-speed) var(--nautiq-cal-ease),
    border-color var(--nautiq-cal-speed) var(--nautiq-cal-ease),
    transform var(--nautiq-cal-speed) var(--nautiq-cal-ease),
    box-shadow var(--nautiq-cal-speed) var(--nautiq-cal-ease);
}

.nautiq-cal-nav:hover {
  background: var(--nautiq-cal-ink);
  border-color: var(--nautiq-cal-ink);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 41, 66, 0.25);
}

.nautiq-cal-nav:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(15, 41, 66, 0.2);
}

.nautiq-cal-nav:focus-visible {
  outline: 2px solid var(--nautiq-cal-focus);
  outline-offset: 2px;
}

.nautiq-cal-weekdays,
.nautiq-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--nautiq-cal-gap);
}

.nautiq-cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nautiq-cal-faint);
  padding-bottom: 2px;
}

.nautiq-cal-day {
  position: relative;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--nautiq-cal-radius-cell);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--nautiq-cal-muted);
  background: var(--nautiq-cal-surface-soft);
  border: 1px solid var(--nautiq-cal-border-soft);
  transition: transform var(--nautiq-cal-speed) var(--nautiq-cal-ease),
    box-shadow var(--nautiq-cal-speed) var(--nautiq-cal-ease),
    background-color var(--nautiq-cal-speed) var(--nautiq-cal-ease),
    border-color var(--nautiq-cal-speed) var(--nautiq-cal-ease);
}

.nautiq-cal-day::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}

.nautiq-cal-day:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.12);
}

.nautiq-cal-day:focus-visible {
  outline: 2px solid var(--nautiq-cal-focus);
  outline-offset: 2px;
  z-index: 1;
}

.nautiq-cal-day.is-available {
  background: var(--nautiq-cal-available-soft);
  color: var(--nautiq-cal-available);
  border-color: rgba(34, 197, 94, 0.25);
}

.nautiq-cal-day.is-available::before {
  background: var(--nautiq-cal-available);
}

.nautiq-cal-day.is-booked {
  background: var(--nautiq-cal-booked-soft);
  color: var(--nautiq-cal-booked);
  border-color: rgba(239, 68, 68, 0.28);
}

.nautiq-cal-day.is-booked::before {
  background: var(--nautiq-cal-booked);
}

.nautiq-cal-day.is-partial,
.nautiq-cal-day.is-maintenance {
  background: var(--nautiq-cal-pending-soft);
  color: var(--nautiq-cal-pending);
  border-color: rgba(245, 158, 11, 0.3);
}

.nautiq-cal-day.is-partial::before,
.nautiq-cal-day.is-maintenance::before {
  background: var(--nautiq-cal-pending);
}

.nautiq-cal-day.is-blocked,
.nautiq-cal-day.is-unavailable {
  background: var(--nautiq-cal-disabled-soft);
  color: var(--nautiq-cal-muted);
  border-color: rgba(148, 163, 184, 0.3);
}

.nautiq-cal-day.is-blocked::before,
.nautiq-cal-day.is-unavailable::before {
  background: var(--nautiq-cal-disabled);
}

.nautiq-cal-day.is-today {
  box-shadow: 0 0 0 2px var(--nautiq-cal-focus);
  border-color: transparent;
}

.nautiq-cal-day.is-selected,
.nautiq-cal-day.is-range-selected {
  box-shadow: inset 0 0 0 2px var(--nautiq-cal-ink);
}

.nautiq-cal-day.is-muted {
  opacity: 0.4;
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.nautiq-cal-day.is-muted:hover {
  transform: none;
  box-shadow: none;
}

.nautiq-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  padding-top: 16px;
  border-top: 1px solid var(--nautiq-cal-border-soft);
}

.nautiq-cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--nautiq-cal-surface-soft);
  border: 1px solid var(--nautiq-cal-border-soft);
  color: var(--nautiq-cal-muted);
  font-weight: 600;
}

.nautiq-cal-legend i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.nautiq-cal-legend .is-available,
.nautiq-cal-legend .is-booked,
.nautiq-cal-legend .is-partial,
.nautiq-cal-legend .is-maintenance,
.nautiq-cal-legend .is-blocked,
.nautiq-cal-legend .is-unavailable {
  border: none;
}

.nautiq-cal-legend .is-available {
  background: var(--nautiq-cal-available);
}

.nautiq-cal-legend .is-booked {
  background: var(--nautiq-cal-booked);
}

.nautiq-cal-legend .is-partial,
.nautiq-cal-legend .is-maintenance {
  background: var(--nautiq-cal-pending);
}

.nautiq-cal-legend .is-blocked,
.nautiq-cal-legend .is-unavailable {
  background: var(--nautiq-cal-disabled);
}

.nautiq-cal--admin .nautiq-cal-day:hover {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 1px;
}

.nautiq-cal--admin .nautiq-cal-day.is-dragging {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.4);
}

@media (max-width: 600px) {
  .nautiq-cal {
    padding: 16px;
    gap: 14px;
  }

  .nautiq-cal-weekdays,
  .nautiq-cal-grid {
    --nautiq-cal-gap: 6px;
  }

  .nautiq-cal-day {
    min-height: 46px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  .nautiq-cal-header strong {
    font-size: 1.05rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nautiq-cal *,
  .nautiq-cal *::before,
  .nautiq-cal *::after {
    transition-duration: 0.001ms !important;
  }

  .nautiq-cal-nav:hover,
  .nautiq-cal-day:hover {
    transform: none;
  }
}

