* { box-sizing: border-box; }
html { direction: rtl; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Tahoma, sans-serif;
  background: #d9dbd5;
  display: flex;
  justify-content: center;
  direction: rtl;
  text-align: right;
}
.phone {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: #efeae2;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0,0,0,.15);
  direction: rtl;
}
.phone::before {
  content: "";
  position: absolute;
  inset: 58px 0 0;
  background-image: radial-gradient(rgba(0,0,0,.05) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .45;
  pointer-events: none;
}
.chat-header {
  height: 58px;
  background: #075e54;
  color: #fff;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: sticky;
  top: 0;
  z-index: 10;
  direction: rtl;
}
.header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: rtl;
  text-align: right;
}
.header-text { text-align: right; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ddd;
  object-fit: cover;
  flex-shrink: 0;
}
h1 { font-size: 16px; margin: 0 0 3px; }
p { margin: 0; }
.chat-header p { font-size: 12px; opacity: .85; text-align: right; }
.chat-body {
  position: relative;
  z-index: 1;
  padding: 14px 10px 28px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  scroll-behavior: smooth;
  direction: rtl;
}
.date-pill {
  width: fit-content;
  margin: 0 auto 12px;
  padding: 5px 12px;
  font-size: 12px;
  background: #e1f3fb;
  color: #52636b;
  border-radius: 8px;
}
.bubble {
  position: relative;
  max-width: 88%;
  margin: 8px 0;
  padding: 9px 10px 17px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,.12);
  clear: both;
  direction: rtl;
  text-align: right;
}
.received {
  background: #fff;
  margin-right: 0;
  margin-left: auto;
  border-top-right-radius: 2px;
}
.intro-bubble { font-size: 15px; line-height: 1.6; }
.msg-time {
  font-size: 11px;
  color: #8b8b8b;
  direction: ltr;
  unicode-bidi: plaintext;
  white-space: nowrap;
}
.bubble > .msg-time {
  position: absolute;
  left: 8px;
  bottom: 4px;
}
.voice-bubble {
  width: 305px;
  padding: 8px 8px 6px;
}
.voice-note {
  display: flex;
  align-items: center;
  gap: 9px;
  direction: rtl;
}
.play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #25d366;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.wave-wrap { flex: 1; min-width: 0; }
.wave-line {
  position: relative;
  height: 28px;
  overflow: hidden;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  direction: ltr;
}
.progress-line { display: none; }
.wave-bar {
  width: 3px;
  height: 10px;
  border-radius: 6px;
  background: #b8b8b8;
  flex: 1;
  max-width: 4px;
  transition: background .15s ease, transform .15s ease, height .15s ease;
}
.wave-bar.played { background: #25d366; }
.voice-note.playing .wave-bar.active {
  animation: liveWave .65s ease-in-out infinite;
}
@keyframes liveWave {
  0%, 100% { transform: scaleY(.72); }
  50% { transform: scaleY(1.25); }
}
.audio-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -2px;
  font-size: 11px;
  color: #777;
  direction: rtl;
}
.audio-meta .duration,
.audio-meta .msg-time { direction: ltr; unicode-bidi: plaintext; }
.voice-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #ddd;
  flex-shrink: 0;
}

.recording {
  width: fit-content;
  max-width: 88%;
  margin: 8px 0 8px auto;
  background: #fff;
  padding: 9px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,.12);
  direction: rtl;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #5f6f6a;
  font-size: 13px;
}
.record-dot {
  width: 9px;
  height: 9px;
  background: #e53935;
  border-radius: 50%;
  display: inline-block;
  animation: recordPulse 1s infinite;
}
@keyframes recordPulse {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.08); }
}
.form-bubble { width: 94%; max-width: 94%; padding-bottom: 22px; }
.form-title { font-size: 14px; line-height: 1.5; margin-bottom: 12px; text-align: right; }
form { direction: rtl; text-align: right; }
.input-group { margin-top: 11px; }
form label {
  display: block;
  font-size: 13px;
  margin: 0 0 6px;
  color: #333;
  text-align: right;
  font-weight: 700;
}
.input-box {
  width: 100%;
  height: 46px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 8px;
  padding: 0 12px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
form input {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  font-size: 15px;
  outline: none;
  direction: rtl;
  text-align: right;
  background: transparent;
}
form input[type="tel"] { direction: rtl; text-align: right; }
.input-box:focus-within {
  border-color: #25d366;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, .12);
}
form button {
  width: 100%;
  margin-top: 14px;
  height: 46px;
  border: none;
  border-radius: 8px;
  background: #25d366;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}
.hidden { display: none !important; }
@media (min-width: 700px) {
  body { padding: 18px 0; }
  .phone { min-height: calc(100vh - 36px); border-radius: 18px; }
  .chat-body { height: calc(100vh - 94px); }
}
