﻿/* ===================== Landing ===================== */

.ai-bubble.typing{
  display:inline-flex;
  gap:6px;
}

.typing-dots{
  display:inline-flex;
  gap:4px;
  align-items:center;
}

.typing-dots span{
  width:6px;
  height:6px;
  border-radius:999px;
  background: currentColor;
  opacity:.35;
  animation: dotPulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2){ animation-delay:.15s; }
.typing-dots span:nth-child(3){ animation-delay:.30s; }

@keyframes dotPulse{
  0%,80%,100%{ transform:translateY(0); opacity:.35; }
  40%{ transform:translateY(-3px); opacity:1; }
}


.landing-center {
    width: 900px;
    max-width: 95%;
    text-align: center;
    margin-top: 30px;
}

.landing-h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 18px;
}

.landing-search {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.landing-input {
    width: 560px;
    max-width: calc(100vw - 220px);
}

.send-icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
}

    .send-icon-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.send-icon {
    width: 0;
    height: 0;
    border-left: 18px solid #e07a16;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    transform: translateX(2px);
}

.help-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid #111;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.help-icon {
    font-weight: 900;
}

.landing-suggest-title {
    margin-top: 18px;
    color: #777;
    font-size: 18px;
}

.suggest-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.chip {
    width: 860px;
    max-width: 95%;
    text-align: center;
    border: 1px solid #d8d8d8;
    background: #fff;
    border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
    color: #555;
}

/* ===================== Chat + Result ===================== */

.chat-wrap {
    background: #fff;
    padding: 22px 22px 30px;
    min-height: calc(100vh - 200px);

    /* เดิม width:60% -> เปลี่ยนเป็น responsive */
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 14px 0;
}

.user-row {
    justify-content: flex-end;
}

.ai-row {
    justify-content: flex-start;
}

.avatar {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    flex: 0 0 52px;
}

.user-avatar {
    background: #2f6df6;
}

.ai-avatar {
    background: #111;
}

.bubble {
    padding: 16px 18px;
    border-radius: 6px;
    line-height: 1.55;
    font-size: 16px;

    /* เดิม: white-space: pre-line; -> เปลี่ยนเป็น pre-wrap จะรักษาขึ้นบรรทัด + เว้นวรรค และ wrap ได้ดีขึ้น */
    white-space: pre-wrap;

    /* กันข้อความยาวๆ (เช่น JSON/stacktrace) ไม่ให้ทะลุกรอบ */
    overflow-wrap: anywhere;
    word-break: break-word;

    /* ทำให้ bubble ปรับตามจอ: ไม่เกินพื้นที่ที่เหลือจาก avatar+gap */
    max-width: calc(75% - 52px - 14px);
}

.user-bubble {
    background: #2f6df6;
    color: #fff;
}

.ai-bubble {
    background: #fff;
    color: #222;
    border: 1px solid #d7d7d7;
}

.typing {
    color: #666;
}

/* chat input row */
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    margin-bottom: 10px;
}

.chat-input {
    flex: 1;
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 999px;
}

/* orange panel */
.orange-panel {
    max-width: 980px;
    margin: 22px auto 0;
    background: #f5dcc7;
    border: 2px solid #f08a2b;
    border-radius: 6px;
    padding: 16px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 18px;
}

.count-card {
    background: #fff;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 10px;
}

.count-label {
    color: #111;
    font-size: 15px;
    margin-bottom: 10px;
}

.count-number {
    font-size: 52px;
    font-weight: 800;
    color: #111;
    line-height: 1;
}

.count-unit {
    margin-top: 8px;
    color: #111;
    font-size: 16px;
}

/* right side */
.panel-right {
    display: flex;
    flex-direction: column;
}

.panel-topline {
    text-align: center;
    font-size: 18px;
    margin-top: 2px;
}

.download-link {
    color: #1f64ff;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.panel-muted {
    color: #111;
    margin-left: 6px;
}

.panel-or {
    text-align: center;
    margin: 12px 0 10px;
    font-size: 18px;
    color: #111;
    font-weight: 600;
}

.panel-instruction {
    text-align: center;
    font-size: 18px;
    color: #111;
    margin-bottom: 12px;
}

/* inner white form card */
.form-card {
    background: #fff;
    border-radius: 6px;
    padding: 14px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 26px;
}

.field .label {
    font-size: 15px;
    color: #111;
    margin-bottom: 6px;
}

/* underline inputs to mimic screenshot */
.ctrl .rz-dropdown,
.ctrl .rz-datepicker {
    border: none;
    border-bottom: 2px solid #a9a9a9;
    border-radius: 0;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
}

    .ctrl .rz-dropdown:hover,
    .ctrl .rz-datepicker:hover {
        box-shadow: none;
    }

/* create button */
.create-btn {
    margin-top: 14px;
    width: 100%;
    height: 44px;
    border-radius: 6px;
    background: #d87400 !important;
    border-color: #d87400 !important;
    font-size: 18px;
    font-weight: 700;
}

/* bottom back button */
.bottom-bar {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.back-button {
    background: #2d2d2d !important;
    border-color: #2d2d2d !important;
    color: #fff !important;
    border-radius: 6px;
    height: 38px;
    padding: 0 18px;
}

/* responsive */
@media (max-width: 980px) {
    .orange-panel {
        grid-template-columns: 1fr;
    }

    .landing-input {
        width: 100%;
    }
}

/* กัน flex overflow แปลกๆ (สำคัญเวลาอยู่ใน flex row) */
.user-row .bubble, .ai-row .bubble {
    min-width: 0;
}