/* ============================================================
   Portal CSS
   ============================================================
   Complements Tailwind utility classes with a small set of tokens,
   focus styles, and animation primitives that would be verbose in
   utility-only form.
*/

:root {
  --brand-accent: #CA623F;
  --brand-accent-dark: #a94e2f;
  --brand-accent-light: #e88a68;
  --brand-bg: #FAF9F8;
  --brand-ink: #1a1a1a;
  --brand-ink-2: #2d2d2d;
  --brand-muted: #666666;
  --brand-border: #e5e5e5;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, .font-serif {
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: -0.01em;
}

/* Dark sidebar gradient — matches spec */
.sidebar-gradient {
  background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
}

/* Buttons */
.btn-primary {
  background: var(--brand-accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-accent-dark);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-secondary {
  background: #fff;
  color: var(--brand-ink);
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  border: 1px solid var(--brand-border);
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}
.btn-secondary:hover:not(:disabled) {
  background: #f4f4f4;
}

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.05);
}

/* Badge variants */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.badge-active,
.badge-in_progress { background: rgba(202, 98, 63, 0.12); color: var(--brand-accent-dark); }
.badge-paused,
.badge-cancelled,
.badge-not_started,
.badge-invited { background: #eeeeee; color: #555; }
.badge-completed,
.badge-delivered,
.badge-attended,
.badge-converted { background: rgba(34, 139, 90, 0.12); color: #1e6b45; }
.badge-churned,
.badge-no_show { background: rgba(200, 40, 40, 0.10); color: #9a1e1e; }
.badge-rescheduled,
.badge-needs_revision,
.badge-booked { background: rgba(204, 140, 30, 0.15); color: #855a10; }
.badge-scheduled { background: rgba(60, 120, 180, 0.12); color: #26548a; }

/* Inputs */
.input {
  width: 100%;
  /* max-width guards against native inputs (notably <input type="date"> on
     iOS/Safari) that ignore CSS width and default to a much wider intrinsic
     size — the calendar icon + placeholder combo used to push the input
     past the right edge of the mobile viewport. */
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--brand-border);
  border-radius: 0.5rem;
  background: #fff;
  font-size: 0.95rem;
  color: var(--brand-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  /* Kill iOS Safari's default rounded/embossed date-input chrome so our
     border-radius + border actually render. Without this, date fields
     look completely different from other .input siblings on iOS. */
  -webkit-appearance: none;
  appearance: none;
}
/* Extra iOS date-input hardening. Safari treats <input type="date"> as an
   inline-block with intrinsic sizing that ignores width:100% in some
   layouts (particularly inside CSS grid cells). Force block layout so
   the width computation stays sane. */
.input[type="date"],
.input[type="datetime-local"],
.input[type="time"] {
  display: block;
  width: 100%;
  min-height: 2.75rem; /* iOS renders these ~40px by default; align with siblings */
}
.input:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(202, 98, 63, 0.15);
}
.label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-ink);
  margin-bottom: 0.375rem;
  letter-spacing: 0.02em;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 0%, #e8e8e8 50%, #f0f0f0 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 0.375rem;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Sidebar link */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
  cursor: pointer;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.sidebar-link.active {
  background: rgba(202, 98, 63, 0.18);
  color: #fff;
  border-left: 3px solid var(--brand-accent);
  padding-left: calc(0.875rem - 3px);
}
.sidebar-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 0.95rem;
}

/* Chat bubbles */
.msg-bubble {
  max-width: 85%;
  padding: 0.625rem 0.875rem;
  border-radius: 1rem;
  font-size: 0.925rem;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
@media (min-width: 768px) {
  .msg-bubble { max-width: 78%; }
}
.msg-client {
  background: var(--brand-accent);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
  align-self: flex-end;
}
.msg-admin {
  background: var(--brand-ink-2);
  color: #fff;
  border-bottom-left-radius: 0.25rem;
  align-self: flex-start;
}
/* Links inside message bubbles: preserve readability on both bubble colors */
.msg-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.msg-bubble a:hover { opacity: 0.85; }

/* Drop zone */
.dropzone {
  border: 2px dashed var(--brand-border);
  border-radius: 0.75rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--brand-muted);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.dropzone.active {
  border-color: var(--brand-accent);
  background: rgba(202, 98, 63, 0.05);
  transform: scale(1.01);
}

/* Utility */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
