*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --wa-green: #25d366;
  --wa-dark: #075e54;
  --wa-teal: #128c7e;
  --wa-user: #dcf8c6;
  --wa-header: #075e54;
  --wa-text: #111b21;
  --wa-sub: #667781;
  --wa-tick: #53bdeb;
}

body {
  font-family: 'Nunito', sans-serif;
  background:
    radial-gradient(circle at 20% -15%, rgba(37, 211, 102, 0.2), transparent 35%),
    radial-gradient(circle at 85% 0%, rgba(83, 189, 235, 0.2), transparent 30%),
    #101c24;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.wrapper {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 16px;
  max-width: 1120px;
  width: 100%;
  align-items: start;
}

.phone {
  width: 100%;
  background: #fff;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 2px #22323d;
  display: flex;
  flex-direction: column;
  height: min(780px, 85vh);
}

.phone-header {
  background: var(--wa-header);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.phone-header .back { color: #fff; font-size: 20px; opacity: 0.85; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.header-info { flex: 1; }
.header-info .name { color: #fff; font-weight: 700; font-size: 15px; }
.header-info .status { color: #b2dfdb; font-size: 12px; }
.header-icons { display: flex; gap: 14px; }
.header-icons span { color: #fff; font-size: 18px; opacity: 0.9; }

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Crect width='60' height='60' fill='%23e5ddd5'/%3E%3Ccircle cx='30' cy='30' r='1' fill='%23ccc' opacity='0.4'/%3E%3C/svg%3E");
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-thumb { background: #aab; border-radius: 2px; }

.date-label { text-align: center; margin: 8px 0; }
.date-label span {
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 8px;
}

.bubble-row { display: flex; margin: 1px 0; }
.bubble-row.bot { justify-content: flex-start; }
.bubble-row.user { justify-content: flex-end; }

.bubble {
  max-width: 80%;
  padding: 8px 10px 6px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.bubble.bot { background: #fff; color: var(--wa-text); border-top-left-radius: 0; }
.bubble.user { background: var(--wa-user); color: var(--wa-text); border-top-right-radius: 0; }

.bubble .time { font-size: 10px; color: var(--wa-sub); float: right; margin-left: 8px; margin-top: 2px; }
.bubble.user .time::after { content: " ✓✓"; color: var(--wa-tick); }

.typing-row { display: flex; align-items: flex-end; margin: 4px 0; }
.typing-bubble {
  background: #fff;
  border-radius: 8px;
  border-top-left-radius: 0;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  display: flex;
  gap: 4px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #90a4ae;
  animation: bounce 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.input-area {
  background: #f0f0f0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #ddd;
}

.input-wrap {
  flex: 1;
  background: #fff;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 6px 14px;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-wrap span { color: #aaa; font-size: 18px; }

.msg-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: #111;
  background: transparent;
}

.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--wa-teal);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
}
.send-btn:hover { background: var(--wa-dark); }

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-card {
  background: #1c2f3a;
  border: 1px solid #2c4554;
  border-radius: 14px;
  padding: 16px;
  color: #fff;
}

.panel-card h3 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #56d693;
  margin-bottom: 12px;
}

.phone-input-row { display: flex; align-items: center; gap: 10px; }
.phone-input-row label { font-size: 13px; color: #a9bac4; white-space: nowrap; }
.phone-input-row input {
  flex: 1;
  background: #0d1b22;
  border: 1px solid #2c3e50;
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.phone-input-row input:focus { border-color: #25d366; }

.quick-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-btn {
  background: #0d1b22;
  border: 1px solid #2c3e50;
  color: #d0dde4;
  padding: 6px 11px;
  border-radius: 18px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.quick-btn:hover { background: #25d366; border-color: #25d366; color: #fff; }

.info-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.info-row span:first-child { color: #a9bac4; font-size: 13px; }
.info-row span:last-child { color: #fff; font-size: 13px; font-weight: 700; }

.admin-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #075e54, #128c7e);
  color: #fff;
  text-decoration: none;
  padding: 11px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
}

.reset-btn {
  width: 100%;
  background: transparent;
  border: 1px solid #c0392b;
  color: #e74c3c;
  padding: 9px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.reset-btn:hover { background: #c0392b; color: #fff; }

@media (max-width: 980px) {
  .wrapper {
    grid-template-columns: 1fr;
    max-width: 420px;
  }

  .phone {
    height: 72vh;
  }
}
