/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 *
 * NOTE (epic #137 — Calm-Clinical redesign):
 * Calm-Clinical design system is the canonical surface; DaisyUI removed.
 * TomSelect overrides use the new ink/blue tokens.
 */

/* TomSelect / Combobox — calm-clinical tinting */

.ts-wrapper {
  background-color: #fff;
  border-radius: var(--radius-md);
}

.ts-wrapper.multi .ts-control {
  background-color: #fff;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: 0.5rem;
  gap: 0.25rem;
}

.ts-wrapper.multi .ts-control:focus-within {
  border-color: var(--color-ink);
  outline: 2px solid rgba(14, 22, 38, 0.1);
  outline-offset: 2px;
}

.ts-wrapper .ts-control > input {
  color: var(--color-ink);
}

.ts-wrapper .ts-control > input::placeholder {
  color: var(--color-ink-4);
}

/* Dropdown - must have solid background and high z-index */
.ts-dropdown {
  background-color: #fff !important;
  border: 1px solid var(--color-rule) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 8px 24px rgba(14, 22, 38, 0.12) !important;
  margin-top: 0.25rem;
  z-index: 9999 !important;
}

.ts-dropdown .ts-dropdown-content {
  max-height: 15rem;
  overflow-y: auto;
  padding: 0.25rem 0;
  background-color: white !important;
}

.ts-dropdown .option {
  padding: 0.5rem 0.75rem;
  color: var(--color-ink);
  background-color: white !important;
  cursor: pointer;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background-color: var(--color-paper-2) !important;
}

.ts-dropdown .option.selected {
  background-color: var(--color-blue-50) !important;
}

/* Selected items (chips) — design-system tag style */
.ts-wrapper.multi .ts-control > .item {
  background-color: var(--color-ink);
  color: var(--color-paper);
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.ts-wrapper.multi .ts-control > .item .remove {
  border-left: none;
  color: rgba(255, 255, 255, 0.7);
  margin-left: 0.25rem;
}

.ts-wrapper.multi .ts-control > .item .remove:hover {
  color: white;
}

/* Checkbox options plugin styling */
.ts-dropdown .option input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: var(--color-ink);
}

/* Phosphor Icons - make icons respect w-* h-* Tailwind classes */
[class*="ph-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Map Tailwind width classes to font-size for icon scaling */
.ph.w-3, .ph-bold.w-3 { font-size: 0.75rem; }   /* 12px */
.ph.w-4, .ph-bold.w-4 { font-size: 1rem; }      /* 16px */
.ph.w-5, .ph-bold.w-5 { font-size: 1.25rem; }   /* 20px */
.ph.w-6, .ph-bold.w-6 { font-size: 1.5rem; }    /* 24px */
.ph.w-8, .ph-bold.w-8 { font-size: 2rem; }      /* 32px */
.ph.w-12, .ph-bold.w-12 { font-size: 3rem; }    /* 48px */

/* Base sticky form actions — works in both native modals and web modals */
.form-actions {
  position: sticky;
  bottom: 0;
  background-color: #fff;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-rule);
  z-index: 10;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
}

/* Web modal override: lighter background, extra bottom padding for dialog chrome */
[data-controller="page-modal"] .form-actions {
  background-color: #fff;
  padding-bottom: 1.5rem;
}

/* Prevent form content from hiding behind sticky/fixed actions */
[data-controller="page-modal"] form {
  padding-bottom: 1rem;
}

/* Sidebar menu: softer active highlight instead of bold neutral (DaisyUI fallback) */
aside .menu {
  --menu-active-bg: color-mix(in oklab, var(--color-base-content) 10%, transparent);
  --menu-active-fg: var(--color-base-content);
}

/* Turbo Drive progress bar — uses design ink token */
.turbo-progress-bar {
  height: 3px;
  background-color: var(--color-ink);
}

/* Turbo Frame loading state */
turbo-frame[busy] {
  opacity: 0.6;
  transition: opacity 0.15s ease-in;
}

/* Instant layout changes — used by sticky_header_controller to prevent rubber-banding */
.no-transition,
.no-transition * {
  transition: none !important;
}

/* Native iOS: remove focus styling on message composer textarea */
[data-hotwire-native] #message-composer textarea:focus {
  outline: none;
  box-shadow: none;
  border-color: transparent;
}

/* Timeline card with left-pointing pointer arrow (legacy DaisyUI care-log layout) */
:root {
  --timeline-card-bg: var(--color-paper-2);
}

.timeline-card {
  position: relative;
  background-color: var(--timeline-card-bg);
}

.timeline-card::before,
.timeline-card::after {
  content: '';
  position: absolute;
  top: 12px;
  width: 0;
  height: 0;
}

.timeline-card::before {
  left: -8px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid var(--color-rule);
}

.timeline-card::after {
  left: -6px;
  top: 13px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 7px solid var(--timeline-card-bg);
}

.group:hover .timeline-card::before {
  border-right-color: var(--color-blue-500);
}

