:root {
  --gold: #d8b76a;
  --gold-2: #f2d994;
  --black: #020202;
  --glass: rgba(20, 20, 20, .78);
  --line: rgba(216, 183, 106, .22);
  --white: #f7f2e7;
  --muted: rgba(247, 242, 231, .56);
  --header-h: 92px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #000; color: var(--white); }
body { overflow: hidden; }

html[dir="rtl"], html[dir="rtl"] body {
  font-family: "Noto Naskh Arabic", Inter, system-ui, sans-serif;
}

html[dir="rtl"] .message-text,
html[dir="rtl"] .brand-name,
html[dir="rtl"] .brand-status,
html[dir="rtl"] .privacy,
html[dir="rtl"] input {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .hero-brand,
html[dir="rtl"] .tagline,
html[dir="rtl"] .atelier { text-align: center; direction: rtl; }

.itri-chat-page {
  min-height: 100dvh;
  width: 100%;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 75%, rgba(185, 128, 36, .35), transparent 22%),
    radial-gradient(circle at 52% 42%, rgba(255, 226, 146, .09), transparent 18%),
    linear-gradient(180deg, #020202 0%, #070502 58%, #000 100%);
}

.stars, .stars::before, .stars::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background-repeat: repeat;
}

.stars-a {
  opacity: .72;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.95) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(216,183,106,.9) 0 1px, transparent 1.8px);
  background-size: 87px 87px, 137px 137px;
  animation: drift 20s linear infinite;
}

.stars-b {
  opacity: .48;
  background-image:
    radial-gradient(circle, rgba(255,224,153,.9) 0 1.5px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.75) 0 1px, transparent 2px);
  background-size: 223px 223px, 311px 311px;
  animation: drift 34s linear infinite reverse;
}

.gold-nebula {
  position: absolute;
  right: -20vw;
  bottom: 2vh;
  width: 72vw;
  height: 46vh;
  background: radial-gradient(ellipse at center, rgba(216,183,106,.32), rgba(216,183,106,.08) 36%, transparent 70%);
  filter: blur(22px);
  transform: rotate(-18deg);
  opacity: .85;
}

@keyframes drift { to { transform: translate3d(-60px, 80px, 0); } }

.phone-chat {
  position: relative;
  z-index: 2;
  height: 100dvh;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(0,0,0,.14);
}

.chat-header {
  height: var(--header-h);
  padding: max(18px, env(safe-area-inset-top)) 18px 14px;
  display: grid;
  grid-template-columns: 42px 60px 1fr 52px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid rgba(216,183,106,.1);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(18px);
}

.icon-btn, .menu-btn, .plus-btn, .send-btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--gold-2);
  cursor: pointer;
}

.icon-btn { font-size: 62px; line-height: 0; transform: translateY(-3px); }
.menu-btn {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.menu-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-2);
  display: block;
}

.brand-avatar {
  width: 60px;
  height: 60px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  color: var(--gold-2);
  letter-spacing: 2px;
  box-shadow: 0 0 34px rgba(216,183,106,.18);
}

.brand-name { font-weight: 600; font-size: 18px; }
.verified { color: var(--gold-2); font-size: 14px; margin-left: 3px; }
.brand-status {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.brand-status .online-dot {
  flex: 0 0 auto;
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55d980;
}

.hero-brand {
  text-align: center;
  padding: 3.5vh 18px 2vh;
  flex: 0 0 auto;
}

.itri-symbol { color: var(--gold); font-size: 28px; margin-bottom: 4px; }
.hero-brand h1 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(72px, 15vw, 122px);
  letter-spacing: .08em;
  line-height: .82;
  color: var(--gold-2);
  text-shadow: 0 0 30px rgba(216,183,106,.23);
}
.hero-brand .atelier { margin: 10px 0 8px; color: var(--gold); letter-spacing: .42em; font-size: 15px; }
html[dir="rtl"] .hero-brand .atelier { letter-spacing: .18em; }
.hero-brand span { display: block; width: 78px; height: 1px; background: var(--gold); margin: 0 auto 12px; opacity: .85; }
.tagline { margin: 0; color: var(--gold-2); letter-spacing: .16em; font-size: 13px; }

.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 18px 16px;
  scrollbar-width: none;
}
.messages::-webkit-scrollbar { display: none; }

.bubble {
  max-width: min(640px, 86%);
  border-radius: 28px;
  padding: 18px 20px 14px;
  margin: 0 0 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.28);
  backdrop-filter: blur(16px);
  line-height: 1.5;
}
.bot {
  background: linear-gradient(135deg, rgba(35,35,35,.86), rgba(14,14,14,.82));
  border: 1px solid rgba(255,255,255,.06);
  border-bottom-left-radius: 10px;
}
.user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(216,183,106,.96), rgba(149,106,35,.96));
  color: #100b03;
  border-bottom-right-radius: 10px;
}
.sender { color: var(--gold); font-size: 14px; margin-bottom: 7px; }
.message-text { font-size: clamp(18px, 4.6vw, 25px); }
time { display: block; color: rgba(247,242,231,.42); font-size: 13px; margin-top: 12px; }
.user time { color: rgba(16,11,3,.55); }

.typing-cursor::after {
  content: "";
  display: inline-block;
  width: .55em;
  height: 1em;
  background: var(--white);
  margin-left: 6px;
  transform: translateY(3px);
  animation: blink .75s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.bubble-in { animation: bubbleIn .45s ease both; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-input {
  flex: 0 0 auto;
  margin: 0 18px 12px;
  min-height: 72px;
  padding: 8px 8px;
  display: grid;
  grid-template-columns: 46px 1fr 54px;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(216,183,106,.21);
  border-radius: 999px;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 40px rgba(0,0,0,.42);
}
.plus-btn { font-size: 38px; line-height: 1; }
.chat-input input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  background: rgba(255,255,255,.035);
  color: var(--white);
  padding: 17px 20px;
  font-size: 16px;
  outline: none;
}
.chat-input input::placeholder { color: rgba(247,242,231,.45); }
.send-btn {
  width: 50px;
  height: 50px;
  border: 1px solid var(--gold-2);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.send-btn svg { width: 24px; fill: var(--gold-2); transform: translateX(1px); }
.send-btn:disabled, input:disabled { opacity: .55; cursor: not-allowed; }

.privacy {
  flex: 0 0 auto;
  margin: 0 18px max(14px, env(safe-area-inset-bottom));
  text-align: center;
  color: rgba(216,183,106,.78);
  font-size: 13px;
}

@media (min-width: 760px) {
  .phone-chat {
    border-left: 1px solid rgba(216,183,106,.08);
    border-right: 1px solid rgba(216,183,106,.08);
  }
  .message-text { font-size: 22px; }
}

@media (max-height: 740px) {
  .hero-brand { padding-top: 2.5vh; }
  .hero-brand h1 { font-size: 64px; }
  .message-text { font-size: 17px; }
  .bubble { padding: 14px 16px 12px; }
}


html[dir="rtl"] .chat-header {
  grid-template-columns: 52px 1fr 60px 42px;
}
html[dir="rtl"] .menu-btn { grid-column: 1; }
html[dir="rtl"] .brand-meta { grid-column: 2; }
html[dir="rtl"] .brand-avatar { grid-column: 3; }
html[dir="rtl"] .icon-btn { grid-column: 4; transform: translateY(-3px) rotate(180deg); }
html[dir="rtl"] .brand-status { justify-content: flex-end; }
html[dir="rtl"] .bot { border-bottom-left-radius: 28px; border-bottom-right-radius: 10px; }
html[dir="rtl"] .user { margin-left: 0; margin-right: auto; border-bottom-right-radius: 28px; border-bottom-left-radius: 10px; }
html[dir="rtl"] .send-btn svg { transform: rotate(180deg) translateX(1px); }
