/*
 * 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.
 */

/* TomSelect / Combobox custom styles for DaisyUI integration */

/* Wrapper needs solid background */
.ts-wrapper {
  background-color: var(--color-base-100);
  border-radius: 0.5rem;
}

.ts-wrapper.multi .ts-control {
  background-color: var(--color-base-100);
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  min-height: 3rem;
  padding: 0.5rem;
  gap: 0.25rem;
}

.ts-wrapper.multi .ts-control:focus-within {
  border-color: #0d9488;
  outline: 2px solid rgba(13, 148, 136, 0.2);
  outline-offset: 2px;
}

.ts-wrapper .ts-control > input {
  color: #1f2937;
}

.ts-wrapper .ts-control > input::placeholder {
  color: #9ca3af;
}

/* Dropdown - must have solid background and high z-index */
.ts-dropdown {
  background-color: var(--color-base-100) !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.5rem !important;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !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: #1f2937;
  background-color: white !important;
  cursor: pointer;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background-color: #f3f4f6 !important;
}

.ts-dropdown .option.selected {
  background-color: #eff6ff !important;
}

/* Selected items (badges) */
.ts-wrapper.multi .ts-control > .item {
  background-color: #0d9488;
  color: white;
  border-radius: 1rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.875rem;
  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;
}

/* 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: var(--color-base-100);
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-base-300);
  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: var(--color-base-100);
  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 */
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 */
.turbo-progress-bar {
  height: 3px;
  background-color: oklch(var(--p));
}

/* 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 */
:root,
[data-theme="nord"] {
  --timeline-card-bg: oklch(96.5% 0.012 145); /* faint sage, between base-100 and base-200 */
}

.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-base-300);
}

.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: oklch(47% 0.13 172 / 40%);
}

/* Warm Sage palette — overrides nord theme tokens */
[data-theme=nord] {
  --color-base-100: oklch(99% 0.004 90);       /* warm off-white (content bg) */
  --color-base-200: oklch(93% 0.018 145);      /* soft sage (sidebar bg) */
  --color-base-300: oklch(83% 0.025 150);      /* sage-tinted borders */
  --color-base-content: oklch(28% 0.022 264);  /* slightly deeper text */
  --color-primary: oklch(47% 0.13 172);        /* richer, deeper teal */
  --color-primary-content: oklch(97% 0.01 172); /* light text on primary */
  --color-secondary: oklch(62% 0.09 165);      /* softer sage secondary */
  --color-accent: oklch(71% 0.10 150);         /* muted sage accent */
}
