/* ============================================================
   TVK Makkal Connect — Chat page styles
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────────── */
.chat-body {
  height: 100dvh; min-height: 100vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
  background-image: radial-gradient(var(--outline-var) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* ── Header ─────────────────────────────────────────────────── */
.chat-header {
  background: rgba(252,249,248,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 8px rgba(0,0,0,.04);
  padding: 0 20px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 200; flex-shrink: 0;
}

.header-brand { display: flex; align-items: center; gap: 12px; }
.header-logo {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-red), var(--primary));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.header-logo .material-symbols-outlined { color: white; font-size: 20px; font-variation-settings:'FILL' 1; }
.header-title-group h1 {
  font-family: var(--font-noto); font-size: 16px; font-weight: 700; color: var(--primary); line-height: 1.2;
}
.header-title-group p {
  font-family: var(--font-inter); font-size: 11px; color: var(--on-surface-var); line-height: 1;
}

.header-actions { display: flex; align-items: center; gap: 6px; }
.header-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--r-full);
  background: transparent; border: 1px solid var(--outline-var);
  color: var(--on-surface-var); font-family: var(--font-inter); font-size: 12px; font-weight: 600;
  transition: all .15s; cursor: pointer;
}
.header-btn:hover { background: var(--surface-container); color: var(--primary); border-color: var(--primary); }
.header-btn--primary { background: var(--primary); color: white; border-color: var(--primary); }
.header-btn--primary:hover { background: var(--primary-dark); }
.header-btn .material-symbols-outlined { font-size: 16px; }

.header-badge {
  padding: 3px 8px; border-radius: var(--r-full);
  font-family: var(--font-inter); font-size: 10px; font-weight: 700; letter-spacing: .05em;
}
.header-badge--on  { background: rgba(97,0,0,.1); color: var(--primary); }
.header-badge--off { background: var(--surface-high); color: var(--on-surface-var); }

.header-sidebar-toggle {
  display: none; background: transparent; border: none;
  color: var(--on-surface-var); padding: 4px;
}

/* ── Main area ──────────────────────────────────────────────── */
.chat-main {
  flex: 1; display: flex; overflow: hidden;
  max-width: 1200px; width: 100%; margin: 0 auto;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.chat-sidebar {
  width: 260px; flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,.06);
  background: var(--surface); overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-profile {
  padding: 20px 16px 12px; border-bottom: 1px solid rgba(0,0,0,.06);
}
.sidebar-profile__avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-red));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-noto); font-size: 18px; font-weight: 700; color: white;
  margin-bottom: 8px;
}
.sidebar-profile__name { font-family: var(--font-noto); font-size: 14px; font-weight: 700; color: var(--primary); }
.sidebar-profile__sub  { font-family: var(--font-inter); font-size: 11px; color: var(--on-surface-var); }

.sidebar-section { padding: 12px 8px; }
.sidebar-section-title {
  font-family: var(--font-inter); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--on-surface-var);
  padding: 4px 8px; margin-bottom: 4px;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-lg);
  font-family: var(--font-inter); font-size: 13px; font-weight: 600;
  color: var(--on-surface-var); background: transparent;
  transition: all .15s; width: 100%; text-align: left; border: none; cursor: pointer;
}
.sidebar-nav-item:hover { background: var(--surface-container); color: var(--on-surface); }
.sidebar-nav-item--active {
  background: var(--secondary-container); color: var(--on-secondary-container);
  border-radius: var(--r-full);
}
.sidebar-nav-item .material-symbols-outlined { font-size: 18px; }

.sidebar-conv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-lg);
  font-family: var(--font-inter); font-size: 12px; font-weight: 500;
  color: var(--on-surface-var); background: transparent;
  transition: all .15s; width: 100%; text-align: left; border: none; cursor: pointer;
}
.sidebar-conv-item:hover { background: var(--surface-container); }
.sidebar-conv-item--active { background: rgba(97,0,0,.08); color: var(--primary); }

/* ── Chat section ───────────────────────────────────────────── */
.chat-section {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative; background: var(--surface-low);
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 16px 120px;
  display: flex; flex-direction: column; gap: 4px;
}

/* ── Welcome ────────────────────────────────────────────────── */
.chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; max-width: 480px; margin: 24px auto;
}
.chat-welcome__icon {
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--primary-container); color: white;
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.chat-welcome__title { font-family: var(--font-noto); font-size: 22px; font-weight: 600; color: var(--on-surface); margin-bottom: 8px; }
.chat-welcome__sub   { font-family: var(--font-manrope); font-size: 15px; color: var(--on-surface-var); margin-bottom: 20px; }

.quick-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  padding: 8px 16px; border-radius: var(--r-full);
  background: var(--surface); border: 1.5px solid var(--outline-var);
  font-family: var(--font-inter); font-size: 13px; font-weight: 600; color: var(--on-surface);
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.chip:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-1px); }

/* ── Bubbles ────────────────────────────────────────────────── */
.bubble-row { display: flex; margin-bottom: 6px; }
.bubble-row--user      { justify-content: flex-end; }
.bubble-row--assistant { justify-content: flex-start; }

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bubble--in { animation: bubbleIn .25s ease forwards; }

.bubble {
  max-width: 72%; padding: 12px 16px; line-height: 1.6;
  font-family: var(--font-manrope); font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.bubble--user {
  background: linear-gradient(135deg, var(--primary-red), var(--primary));
  color: white; border-radius: 18px 18px 4px 18px;
}
.bubble--assistant {
  background: var(--surface); color: var(--on-surface);
  border-left: 3px solid var(--primary); border-radius: 4px 18px 18px 18px;
}
.bubble--typing { padding: 14px 18px; }

.bubble-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bubble-action-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--r-lg);
  background: var(--surface-high); border: 1px solid var(--outline-var);
  font-family: var(--font-inter); font-size: 12px; font-weight: 600; color: var(--on-surface);
  transition: all .15s;
}
.bubble-action-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.bubble-action-btn:disabled { opacity: .45; cursor: default; }

/* ── Ticket draft card ──────────────────────────────────────── */
.ticket-draft-card {
  background: var(--cream); border: 1.5px solid var(--secondary-container);
  border-radius: var(--r-2xl); padding: 16px; max-width: 360px; box-shadow: var(--shadow-md);
}
.ticket-draft-card__header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.ticket-draft-card__label  { font-family: var(--font-inter); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--on-surface-var); }
.ticket-draft-card__type   { font-family: var(--font-noto); font-size: 14px; font-weight: 700; color: var(--on-surface); }
.ticket-draft-card__body   { font-family: var(--font-manrope); font-size: 13px; color: var(--on-surface-var); line-height: 1.7; margin-bottom: 12px; }
.ticket-draft-card__actions{ display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Chat input bar ─────────────────────────────────────────── */
.chat-input-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 16px 14px;
  background: linear-gradient(to top, var(--surface) 80%, transparent);
}
.chat-input-inner {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--outline-var);
  border-radius: var(--r-full); padding: 6px 6px 6px 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  max-width: 760px; margin: 0 auto;
}
.chat-input-bar__textarea {
  flex: 1; background: transparent; border: none;
  font-family: var(--font-manrope); font-size: 15px; color: var(--on-surface);
  resize: none; min-height: 36px; max-height: 120px; padding: 4px 0; line-height: 1.5;
  scrollbar-width: none;
}
.chat-input-bar__textarea::placeholder { color: var(--on-surface-var); opacity: .7; }
.chat-input-bar__textarea::-webkit-scrollbar { display: none; }
.chat-input-icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: transparent; color: var(--on-surface-var);
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.chat-input-icon-btn:hover { background: var(--surface-container); color: var(--primary); }
.chat-input-icon-btn .material-symbols-outlined { font-size: 20px; }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--primary); color: white; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
  box-shadow: 0 2px 8px rgba(97,0,0,.3);
}
.chat-send-btn:hover { background: var(--primary-dark); transform: scale(1.04); }
.chat-send-btn .material-symbols-outlined { font-size: 20px; font-variation-settings:'FILL' 1; }
.input-hint { text-align: center; margin-top: 5px; font-family: var(--font-inter); font-size: 10px; color: var(--on-surface-var); opacity: .6; }

/* ── Right panel ────────────────────────────────────────────── */
.chat-panel {
  width: 260px; flex-shrink: 0;
  border-left: 1px solid rgba(0,0,0,.06);
  background: var(--surface); overflow-y: auto;
  padding: 16px;
}
.chat-panel h3 {
  font-family: var(--font-noto); font-size: 14px; font-weight: 700; color: var(--on-surface);
  display: flex; align-items: center; gap: 6px; margin-bottom: 12px;
}

/* AI Panel */
.ai-panel__title { font-family: var(--font-noto); font-size: 14px; font-weight: 700; color: var(--on-surface); display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.ai-panel__title .material-symbols-outlined { color: var(--primary); }
.ai-panel__items { display: flex; flex-direction: column; gap: 10px; }
.ai-panel__item  { display: flex; flex-direction: column; gap: 3px; }
.ai-panel__lbl   { font-family: var(--font-inter); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--on-surface-var); }
.ai-panel__val   { font-family: var(--font-manrope); font-size: 13px; color: var(--on-surface); }

.rp-ticket {
  background: var(--surface-low); border: 1px solid var(--outline-var);
  border-radius: var(--r-lg); padding: 10px; margin-bottom: 8px; cursor: pointer;
  transition: box-shadow .15s;
}
.rp-ticket:hover { box-shadow: var(--shadow-md); }

/* ── Mobile bottom nav ──────────────────────────────────────── */
.chat-bottom-nav {
  display: none; background: rgba(252,249,248,.95);
  backdrop-filter: blur(12px); border-top: 1px solid rgba(0,0,0,.06);
  padding: 8px 0 16px; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  justify-content: space-around;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 12px; background: transparent; border: none;
  color: var(--on-surface-var); font-family: var(--font-inter); font-size: 10px; font-weight: 600;
  transition: color .15s;
}
.bottom-nav-item:hover, .bottom-nav-item--active { color: var(--primary); }
.bottom-nav-item--active .material-symbols-outlined { color: inherit; }
.bottom-nav-item--pill {
  background: var(--secondary-container); color: var(--on-secondary-container);
  border-radius: 16px; padding: 4px 16px;
}
.bottom-nav-item .material-symbols-outlined { font-size: 22px; }

/* ── Sidebar overlay (mobile) ───────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 290;
  background: rgba(0,0,0,.4);
}

/* ── Photo bubble ───────────────────────────────────────────── */
.bubble--photo { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
