/* =========================================================
   Chat Page
   ========================================================= */
body.chatPageBody {
  background: #f3f4f6;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: 0;
}

.chatPageWrap {
  display: flex;
  width: 100%;
  max-width: 980px;
  height: calc(100dvh - 74px);
  min-height: 0;
  padding-top: 12px;
  padding-bottom: 12px;
}

.chatPageGrid {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.chatInfoCard {
  display: none;
}

.chatPanelPage {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.chatPanelHead {
  padding: 20px 28px 12px;
}

.chatPanelTitle {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #111827;
}

.chatPanelSub {
  display: none;
}

.chatPanelAuth {
  margin: 0 28px 6px;
  padding: 16px 18px;
  border: 0;
  border-radius: 20px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chatPanelAuth p {
  margin: 0;
  color: #4b5563;
  line-height: 1.5;
}

.btn--accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.btn--accent:hover {
  background: var(--accent-hover);
}

.chatPanelMessages {
  flex: 1 1 auto;
  margin: 0;
  padding: 6px 28px 10px;
  overflow: auto;
  min-height: 0;
  max-height: none;
  background: transparent;
  overscroll-behavior: contain;
}

.chatPanelEmpty {
  padding: 18px 0;
  color: #9ca3af;
  font-size: 14px;
}

.chatPanelMsg {
  max-width: min(560px, 84%);
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 0;
  border-radius: 22px;
  background: #f3f4f6;
}

.chatPanelMsg.user {
  margin-left: auto;
  background: rgb(255, 124, 30);
  color: #f9fafb;
}

.chatPanelMsg.admin {
  margin-right: auto;
  background: #f3f4f6;
}

.chatPanelMsgMeta {
  margin-bottom: 7px;
  font-size: 11px;
  color: #6b7280;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.chatPanelMsgText {
  font-size: 14px;
  line-height: 1.55;
  color: #111827;
  word-break: break-word;
}

.chatPanelMsg.user .chatPanelMsgMeta,
.chatPanelMsg.user .chatPanelMsgText {
  color: #242424;
}

.chatPanelForm {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  margin: 0 16px 12px;
  border-radius: 22px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.chatPanelForm input {
  flex: 1;
  height: 52px;
  padding: 0 18px;
  border: 0;
  outline: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
  color: #111827;
  appearance: none;
  -webkit-appearance: none;
}

.chatPanelForm input:focus {
  outline: none;
  background: #fff;
  box-shadow: none;
}

.chatPanelForm button {
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.chatPanelForm button:hover {
  background: var(--accent-hover);
}

html.dark-theme body.chatPageBody {
  background: #09090b;
  overflow: hidden;
}

html.dark-theme .chatPanelPage {
  background: rgba(15, 15, 17, 0.94);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.34);
}

html.dark-theme .chatPanelTitle {
  color: #f3f4f6;
}

html.dark-theme .chatPanelSub {
  color: #a1a1aa;
}

html.dark-theme .chatPanelAuth {
  background: #15161a;
}

html.dark-theme .chatPanelAuth p {
  color: #d4d4d8;
}

html.dark-theme .chatPanelEmpty {
  color: #71717a;
}

html.dark-theme .chatPanelMsg {
  background: #18181b;
}

html.dark-theme .chatPanelMsg.user {
  background: rgba(255, 125, 31, 0.527);
  color: #ff7b23;
}

html.dark-theme .chatPanelMsgMeta {
  color: #8f8f99;
}

html.dark-theme .chatPanelMsgText {
  color: #f3f4f6;
}

html.dark-theme .chatPanelForm input {
  background: #18181b;
  color: #f5f5f5;
}

html.dark-theme .chatPanelForm {
  background: transparent;
  box-shadow: none;
}

html.dark-theme .chatPanelForm input:focus {
  background: #1f2024;
  box-shadow: none;
}

html.dark-theme .chatPanelForm button,
html.dark-theme .btn--accent {
  background: var(--accent);
  color: #111827;
}

html.dark-theme .chatPanelForm button:hover,
html.dark-theme .btn--accent:hover {
  background: var(--accent-hover);
}

@media (max-width: 980px) {
  .chatPanelPage {
    max-height: none;
  }
}

@media (max-width: 720px) {
  body.chatPageBody {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .chatPageWrap {
    height: calc(100dvh - 64px - env(safe-area-inset-bottom));
    min-height: 0;
    padding: 8px 10px 10px;
  }

  .chatPanelPage {
    height: 100%;
    max-height: none;
    border-radius: 18px;
  }

  .chatPanelHead {
    flex: 0 0 auto;
    padding: 14px 16px 8px;
  }

  .chatPanelTitle {
    font-size: 24px;
  }

  .chatPanelAuth {
    margin: 0 18px 6px;
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .chatPanelMessages {
    flex: 1 1 auto;
    padding: 0 14px 8px;
    min-height: 0;
    max-height: none;
  }

  .chatPanelMsg {
    max-width: 92%;
    padding: 13px 14px;
  }

  .chatPanelForm {
    flex: 0 0 auto;
    flex-shrink: 0;
    gap: 8px;
    padding: 0;
    margin: 0 10px 10px;
    border-radius: 18px;
    position: sticky;
    bottom: 0;
    z-index: 2;
    box-shadow: none;
  }

  .chatPanelForm input,
  .chatPanelForm button {
    height: 48px;
  }

  .chatPanelForm input {
    min-width: 0;
    padding: 0 12px;
  }

  .chatPanelForm button {
    flex: 0 0 auto;
    padding: 0 14px;
  }
}
