/* ============================================================
   SUPPORT BOT — SHARED DESIGN TOKENS
   Palette: deep purple + amber, calm/trustworthy support console
   Type: Space Grotesk (display) / Inter (body) / IBM Plex Mono (IDs, data)
   Signature: tickets render as a perforated boarding-pass stub
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  /* --- color --- */
  --ink:        #16233A;   /* primary text */
  --ink-soft:   #4B5A6E;   /* secondary text */
  --paper:      #F3F5F7;   /* page background */
  --surface:    #FFFFFF;   /* card/bubble background */
  --primary:    #670574;   /* purple — actions, bot identity */
  --primary-dk: #4C2E8F;
  --accent:     #e78fff;   /* amber — stars, highlights, stub edge */
  --success:    #3C8562;
  --danger:     #C0503D;
  --line:       #DDE3E6;

  /* --- type --- */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  /* --- shape --- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ------------------------------------------------------------
   App shell — centers a phone-width chat column, like the
   WhatsApp-shared link it's built for
   ------------------------------------------------------------ */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(22, 35, 58, 0.06);
}

.app-header {
  padding: 18px 20px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.app-header .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid #000;
}

.app-header .avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.app-header .title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}

.app-header .subtitle {
  font-size: 12px;
  opacity: 0.8;
}

/* ------------------------------------------------------------
   App header — back button + profile trigger
   ------------------------------------------------------------ */
.app-header .icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.app-header .icon-btn:hover { background: rgba(255, 255, 255, 0.24); }
.app-header .icon-btn svg { width: 18px; height: 18px; }

.app-header .profile-trigger { margin-left: auto; }
.app-header .profile-trigger .avatar {
  width: 32px; height: 32px; font-size: 13px;
}
.app-header .profile-trigger i.fa-circle-user {
  font-size: 26px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ------------------------------------------------------------
   Profile panel — reuses .auth-overlay / .auth-panel
   ------------------------------------------------------------ */
.profile-panel-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
}
.profile-panel-head .avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink);
  flex-shrink: 0;
}
.profile-panel-head .name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.profile-panel-head .email { color: var(--ink-soft); font-size: 13px; }

.profile-field-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 20px; }
.profile-field-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.profile-field-row:last-child { border-bottom: none; }
.profile-field-row .k { color: var(--ink-soft); }
.profile-field-row .v { font-weight: 600; text-align: right; }

.profile-panel .btn-ghost.danger { color: var(--danger); }
.profile-panel .btn-ghost.danger:hover { background: rgba(192, 80, 61, 0.08); }

/* ------------------------------------------------------------
   Chat log
   ------------------------------------------------------------ */
.chat-log {
  flex: 1;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.bubble {
  max-width: 84%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.5;
  animation: rise 0.25s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble.bot {
  align-self: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top-left-radius: 4px;
  color: var(--ink);
}

.bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-top-right-radius: 4px;
}

.bubble .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.bubble.user .label { color: rgba(255,255,255,0.7); }

/* ------------------------------------------------------------
   Option grid — the buttons a user "replies" with
   ------------------------------------------------------------ */
.option-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  max-width: 84%;
}

.option-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary);
  background: var(--surface);
  color: var(--primary-dk);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.option-btn:hover { background: var(--primary); color: #fff; }
.option-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.option-btn.disabled { opacity: 0.45; pointer-events: none; }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.field {
  align-self: flex-start;
  max-width: 90%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field select, .field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="tel"], .field textarea {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.field select:focus, .field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.field .char-count {
  font-size: 11px;
  color: var(--ink-soft);
  text-align: right;
}

.field-file {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.field-file:hover { border-color: var(--primary); }

.btn-primary {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  align-self: flex-start;
}
.btn-primary:hover { background: var(--primary-dk); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

/* ------------------------------------------------------------
   Signature element — ticket stub (boarding-pass style)
   ------------------------------------------------------------ */
.ticket-stub {
  align-self: flex-start;
  max-width: 92%;
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(22,35,58,0.08);
}

.ticket-stub-head {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-stub-head .ticket-no {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.ticket-stub-head .ticket-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.ticket-stub-tear {
  position: relative;
  height: 0;
  border-top: 2px dashed var(--line);
  margin: 0 16px;
}
.ticket-stub-tear::before, .ticket-stub-tear::after {
  content: '';
  position: absolute;
  top: -9px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--paper);
}
.ticket-stub-tear::before { left: -25px; }
.ticket-stub-tear::after { right: -25px; }

.ticket-stub-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-stub-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.ticket-stub-row .k { color: var(--ink-soft); }
.ticket-stub-row .v { font-weight: 600; text-align: right; }

/* ------------------------------------------------------------
   Status rail (Raised -> Assigned -> Testing -> Done -> Waiting Feedback)
   ------------------------------------------------------------ */
.status-rail {
  align-self: flex-start;
  max-width: 92%;
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 16px 14px;
}

.status-rail-track {
  display: flex;
  align-items: flex-start;
  position: relative;
}

.status-step {
  flex: 1;
  text-align: center;
  position: relative;
  font-size: 10.5px;
  color: var(--ink-soft);
}

.status-step .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--line);
  border: 2px solid var(--line);
  margin: 0 auto 6px;
  position: relative;
  z-index: 2;
}

.status-step .bar {
  position: absolute;
  top: 5px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 1;
}
.status-step:first-child .bar { display: none; }

.status-step.done .dot { background: var(--primary); border-color: var(--primary); }
.status-step.done .bar { background: var(--primary); }
.status-step.current .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(232,163,61,0.25); }
.status-step.current { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------
   Star rating (1-10)
   ------------------------------------------------------------ */
.star-rating {
  align-self: flex-start;
  max-width: 92%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.star-row {
  display: flex;
  gap: 4px;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--line);
  padding: 2px;
  transition: color 0.1s, transform 0.1s;
}
.star-btn.filled { color: var(--accent); }
.star-btn:hover { transform: scale(1.15); }

.star-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------
   Loader (fetching ticket status etc.)
   ------------------------------------------------------------ */
.typing-dots {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  border-top-left-radius: 4px;
}
.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: blink 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ------------------------------------------------------------
   Utility
   ------------------------------------------------------------ */
.footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 10px 16px 18px;
}

@media (prefers-reduced-motion: reduce) {
  .bubble, .option-btn, .star-btn { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------
   Landing page — nav bar + hero
   ------------------------------------------------------------ */
.landing-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.landing-nav .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink);
}
.landing-nav .brand .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
  overflow: hidden;
  border: 2px solid #000;
}
.landing-nav .brand .avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.landing-nav .nav-actions { display: flex; gap: 10px; }
.landing-nav .nav-actions button.btn-ghost { padding: 9px 16px; }
.landing-nav .nav-actions button.btn-primary { padding: 9px 18px; }

.landing-hero {
  max-width: 720px; margin: 0 auto;
  padding: 72px 24px 90px;
  text-align: center;
}
.landing-hero h1 {
  font-size: 36px; line-height: 1.2; margin-bottom: 14px;
}
.landing-hero p {
  color: var(--ink-soft); font-size: 15.5px; line-height: 1.6;
  max-width: 480px; margin: 0 auto 30px;
}
.landing-hero .hero-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.landing-hero .hero-actions button.btn-primary { padding: 13px 26px; font-size: 14.5px; }
.landing-hero .hero-actions button.btn-ghost { padding: 13px 26px; font-size: 14.5px; }

/* ------------------------------------------------------------
   Auth modal
   ------------------------------------------------------------ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(22, 35, 58, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
.auth-overlay.open { opacity: 1; pointer-events: auto; }

.auth-panel {
  position: relative;
  width: 100%; max-width: 380px;
  max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(22, 35, 58, 0.25);
  padding: 28px 24px 24px;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s ease;
}
.auth-overlay.open .auth-panel { transform: translateY(0) scale(1); }

.auth-panel-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--paper); color: var(--ink-soft);
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.auth-panel-close:hover { background: var(--line); }

.auth-view { display: none; }
.auth-view.active { display: block; }

.auth-view .avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: var(--ink);
  margin-bottom: 12px;
}

/* ------------------------------------------------------------
   Auth brand block — logo + "SolworxS Support Bot" wordmark,
   shown centered above the heading on every auth view.
   ------------------------------------------------------------ */
.auth-brand,
.auth-shell .auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0 auto 16px;
}
.auth-brand .auth-logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 2px solid #000;
  display: block;
}
.auth-brand .auth-brand-name {
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  letter-spacing: 0.01em;
}
.auth-view h2.display,
.auth-shell h1.display {
  text-align: center;
}
.auth-view p.sub,
.auth-shell p.sub {
  text-align: center;
}
.auth-view h2 { font-size: 20px; margin-bottom: 4px; }
.auth-view p.sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 16px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field-row { display: flex; gap: 10px; }
.auth-field-row .field { flex: 1; min-width: 0; }

.auth-phone-row { display: flex; gap: 8px; }
.auth-country-select {
  flex: 0 0 auto; max-width: 128px;
  font-family: var(--font-body); font-size: 13px;
  padding: 10px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.auth-phone-row input { flex: 1; min-width: 0; }

.field-hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }

.auth-address-block {
  border-top: 1px dashed var(--line);
  padding-top: 14px; margin-top: 2px;
  display: flex; flex-direction: column; gap: 12px;
}
.auth-address-title {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.04em;
}

.auth-forgot-row { text-align: right; margin-top: -6px; }
.auth-forgot-row a { font-size: 12.5px; color: var(--primary); text-decoration: none; font-weight: 600; }

.auth-error {
  background: #FBEAE6; border: 1px solid var(--danger); color: var(--danger);
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm);
  display: none; margin-bottom: 12px;
}
.auth-success {
  background: #E9F3ED; border: 1px solid var(--success); color: var(--success);
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm);
  display: none; margin-bottom: 12px;
}
.auth-switch { font-size: 13px; color: var(--ink-soft); text-align: center; margin-top: 16px; }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }