/* ----------------------------------------------------------------
   CircularCups design tokens
   ----------------------------------------------------------------
   These CSS custom properties are the source of truth for visual
   design. The Tailwind utilities below this block reference them
   so that the brand can be re-skinned by adjusting only this file
   — and the same tokens map directly to a WordPress theme.json
   when this code is ported into the production build.
*/

:root {
  /* ---- brand palette ---- */
  --cc-color-bg:            #f6f7f3;   /* page background — warm off-white */
  --cc-color-surface:       #ffffff;   /* card surface */
  --cc-color-surface-2:     #ecf0e5;   /* subtle inset / alt row */
  --cc-color-border:        #d8ddd1;   /* hairline borders */
  --cc-color-border-strong: #b6bca8;

  --cc-color-ink:           #1d2817;   /* primary text */
  --cc-color-ink-muted:     #5a6552;   /* secondary text */
  --cc-color-ink-faint:     #8a917e;   /* tertiary / placeholder */

  --cc-color-brand:         #2f6b3a;   /* primary green */
  --cc-color-brand-strong:  #21502c;
  --cc-color-brand-soft:    #d6e7d8;
  --cc-color-brand-tint:    #ebf4ec;

  --cc-color-accent:        #c97d2c;   /* warm amber for delivery / lead-in */
  --cc-color-accent-soft:   #f5e3cc;

  --cc-color-return:        #6b8aa8;   /* return period — muted blue-grey */
  --cc-color-return-soft:   #d8e2eb;

  --cc-color-cleaning:      #7a55a3;   /* cleaning — purple */
  --cc-color-cleaning-soft: #e3d6ef;

  --cc-color-success:       #2f6b3a;
  --cc-color-warning:       #b8730d;
  --cc-color-error:         #b3392c;
  --cc-color-error-soft:    #f5dad6;

  --cc-color-blocked-band:  #1d2817;   /* the dark unavailability bar */

  --cc-color-non-working:   #b6bca8;

  /* ---- spacing scale ---- */
  --cc-space-1: 4px;
  --cc-space-2: 8px;
  --cc-space-3: 12px;
  --cc-space-4: 16px;
  --cc-space-5: 24px;
  --cc-space-6: 32px;
  --cc-space-7: 48px;
  --cc-space-8: 64px;

  /* ---- radii ---- */
  --cc-radius-sm: 4px;
  --cc-radius-md: 8px;
  --cc-radius-lg: 14px;
  --cc-radius-xl: 22px;

  /* ---- typography ---- */
  --cc-font-sans:
    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --cc-font-display:
    "Fraunces", "Source Serif Pro", Georgia, "Times New Roman", serif;

  /* ---- shadows ---- */
  --cc-shadow-sm: 0 1px 2px rgba(29, 40, 23, 0.06);
  --cc-shadow-md: 0 6px 24px -8px rgba(29, 40, 23, 0.12),
                  0 2px 6px rgba(29, 40, 23, 0.05);

  /* ---- timeline ---- */
  --cc-timeline-cell-w: 64px;
  --cc-timeline-cell-w-mobile: 52px;
  --cc-timeline-row-h: 44px;
  --cc-timeline-band-h: 32px;
  --cc-timeline-gap: 2px;
}

/* ----------------------------------------------------------------
   Base
   ---------------------------------------------------------------- */

html, body {
  background: var(--cc-color-bg);
  color: var(--cc-color-ink);
  font-family: var(--cc-font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.cc-display {
  font-family: var(--cc-font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ----------------------------------------------------------------
   Form controls — clean, accessible, branded
   ---------------------------------------------------------------- */

.cc-input,
.cc-select {
  appearance: none;
  width: 100%;
  background: var(--cc-color-surface);
  border: 1px solid var(--cc-color-border-strong);
  border-radius: var(--cc-radius-md);
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--cc-color-ink);
  line-height: 1.4;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.cc-input:focus,
.cc-select:focus {
  outline: none;
  border-color: var(--cc-color-brand);
  box-shadow: 0 0 0 3px var(--cc-color-brand-soft);
}
.cc-input[aria-invalid="true"] {
  border-color: var(--cc-color-error);
}
.cc-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--cc-color-error-soft);
}
.cc-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%231d2817' stroke-width='1.5' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.cc-checkbox {
  appearance: none;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1.5px solid var(--cc-color-border-strong);
  border-radius: 5px;
  background: var(--cc-color-surface);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.cc-checkbox::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 100ms ease;
  background: var(--cc-color-surface);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.cc-checkbox:checked {
  background: var(--cc-color-brand);
  border-color: var(--cc-color-brand);
}
.cc-checkbox:checked::before {
  transform: scale(1);
}
.cc-checkbox:focus-visible {
  outline: 3px solid var(--cc-color-brand-soft);
  outline-offset: 2px;
}

.cc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--cc-radius-md);
  font-weight: 500;
  font-size: 14px;
  background: var(--cc-color-surface);
  border: 1px solid var(--cc-color-border-strong);
  color: var(--cc-color-ink);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.cc-btn:hover { background: var(--cc-color-surface-2); }
.cc-btn:active { transform: translateY(1px); }
.cc-btn:focus-visible {
  outline: 3px solid var(--cc-color-brand-soft);
  outline-offset: 2px;
}
.cc-btn--ghost {
  background: transparent;
  border-color: var(--cc-color-border);
  color: var(--cc-color-ink-muted);
}

.cc-card {
  background: var(--cc-color-surface);
  border: 1px solid var(--cc-color-border);
  border-radius: var(--cc-radius-lg);
  box-shadow: var(--cc-shadow-sm);
}

.cc-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cc-color-ink-muted);
}

/* ----------------------------------------------------------------
   Status pills
   ---------------------------------------------------------------- */

.cc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cc-pill--available {
  background: var(--cc-color-brand-soft);
  color: var(--cc-color-brand-strong);
}
.cc-pill--unavailable {
  background: var(--cc-color-error-soft);
  color: var(--cc-color-error);
}
.cc-pill--exceeds {
  background: #fbe6c7;
  color: #7a4a06;
}
.cc-pill--idle {
  background: var(--cc-color-surface-2);
  color: var(--cc-color-ink-muted);
}
.cc-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

/* ----------------------------------------------------------------
   Timeline
   ---------------------------------------------------------------- */

.cc-timeline {
  --cell: var(--cc-timeline-cell-w);
  position: relative;
}

@media (max-width: 640px) {
  .cc-timeline {
    --cell: var(--cc-timeline-cell-w-mobile);
  }
}

.cc-timeline-scroll {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.cc-timeline-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--cell);
  gap: var(--cc-timeline-gap);
}

.cc-timeline-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 4px;
  border-radius: var(--cc-radius-sm);
  background: var(--cc-color-surface-2);
  min-height: 56px;
  position: relative;
}

.cc-timeline-day .cc-dow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cc-color-ink-muted);
}
.cc-timeline-day .cc-dom {
  font-size: 16px;
  font-weight: 700;
  color: var(--cc-color-ink);
  line-height: 1.1;
}
.cc-timeline-day .cc-mon {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cc-color-ink-faint);
}

.cc-timeline-day.is-non-working {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(138, 145, 126, 0.18) 4px,
    rgba(138, 145, 126, 0.18) 6px
  );
}

.cc-timeline-day.is-non-working .cc-dow,
.cc-timeline-day.is-non-working .cc-dom {
  color: var(--cc-color-ink-faint);
}
.cc-timeline-day.is-bh {
  outline: 1.5px dashed var(--cc-color-warning);
  outline-offset: -3px;
}
.cc-bh-marker {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  color: var(--cc-color-warning);
  font-weight: 700;
  line-height: 1;
}

.cc-timeline-row {
  height: var(--cc-timeline-row-h);
  border-radius: var(--cc-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cc-color-ink-muted);
  background: var(--cc-color-surface-2);
}
.cc-timeline-row.is-delivery {
  background: var(--cc-color-accent-soft);
  color: #6e4108;
}
.cc-timeline-row.is-event {
  background: var(--cc-color-brand);
  color: #ffffff;
}
.cc-timeline-row.is-return {
  background: var(--cc-color-return-soft);
  color: #2f4762;
}
.cc-timeline-row.is-cleaning {
  background: var(--cc-color-cleaning-soft);
  color: #4a2f6c;
}
.cc-timeline-row.is-gap {
  background: repeating-linear-gradient(
    -45deg,
    var(--cc-color-surface-2),
    var(--cc-color-surface-2) 4px,
    rgba(138, 145, 126, 0.25) 4px,
    rgba(138, 145, 126, 0.25) 6px
  );
}

.cc-timeline-blocked-row {
  margin-top: 8px;
  height: var(--cc-timeline-band-h);
  background: var(--cc-color-blocked-band);
  color: #ffffff;
  border-radius: var(--cc-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 12px;
}

/* legend dots */
.cc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--cc-color-ink-muted);
}
.cc-legend-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cc-legend-dot::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.cc-legend-dot.cc-legend-delivery::before { background: var(--cc-color-accent-soft); border: 1px solid #c97d2c40; }
.cc-legend-dot.cc-legend-event::before    { background: var(--cc-color-brand); }
.cc-legend-dot.cc-legend-return::before   { background: var(--cc-color-return-soft); border: 1px solid #6b8aa840; }
.cc-legend-dot.cc-legend-cleaning::before { background: var(--cc-color-cleaning-soft); border: 1px solid #7a55a340; }
.cc-legend-dot.cc-legend-non-working::before {
  background-image: repeating-linear-gradient(
    -45deg, #fff, #fff 3px,
    var(--cc-color-non-working) 3px, var(--cc-color-non-working) 5px
  );
  border: 1px solid var(--cc-color-border-strong);
}

/* ----------------------------------------------------------------
   Per-item availability rows
   ---------------------------------------------------------------- */

.cc-item-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--cc-color-border);
}
.cc-item-row:last-child {
  border-bottom: none;
}
.cc-item-row .cc-item-name {
  font-weight: 600;
  color: var(--cc-color-ink);
}
.cc-item-row .cc-item-help {
  font-size: 12px;
  color: var(--cc-color-ink-muted);
  display: block;
  margin-top: 2px;
}
.cc-item-row .cc-item-detail {
  font-size: 13px;
  color: var(--cc-color-ink-muted);
}
.cc-item-row .cc-item-detail strong {
  color: var(--cc-color-ink);
  font-weight: 600;
}

@media (max-width: 640px) {
  .cc-item-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ----------------------------------------------------------------
   Scenario buttons
   ---------------------------------------------------------------- */

.cc-scenario-btn {
  text-align: left;
  background: var(--cc-color-surface);
  border: 1px solid var(--cc-color-border-strong);
  border-radius: var(--cc-radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
}
.cc-scenario-btn:hover {
  background: var(--cc-color-brand-tint);
  border-color: var(--cc-color-brand);
}
.cc-scenario-btn:active { transform: translateY(1px); }
.cc-scenario-btn:focus-visible {
  outline: 3px solid var(--cc-color-brand-soft);
  outline-offset: 2px;
}
.cc-scenario-btn.is-active {
  background: var(--cc-color-brand-tint);
  border-color: var(--cc-color-brand);
}
.cc-scenario-btn .cc-scenario-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--cc-color-ink);
}
.cc-scenario-btn .cc-scenario-caption {
  font-size: 12px;
  color: var(--cc-color-ink-muted);
  line-height: 1.4;
}

/* ----------------------------------------------------------------
   Eligibility blocked state
   ---------------------------------------------------------------- */

.cc-blocked-banner {
  background: #fff5e6;
  border: 1px solid #f0c98c;
  color: #7a4a06;
  padding: 14px 16px;
  border-radius: var(--cc-radius-md);
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.cc-error-text {
  color: var(--cc-color-error);
  font-size: 13px;
  margin-top: 6px;
}

/* small icon utility */
.cc-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-block;
  vertical-align: middle;
}

/* visually hidden but accessible to screen readers */
.cc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* fade-in for results */
.cc-fade-in {
  animation: cc-fade-in 200ms ease-out;
}
@keyframes cc-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
