/* WhatsApp mobile clone — dark mode. Colors from WhatsApp dark palette. */

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0b141a;
  color: #e9edef;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0;
}

/* DEMO banner — not dismissable */
.demo-banner {
  width: 100%;
  background: #f59e0b;
  color: #1a1208;
  font-weight: 700;
  text-align: center;
  padding: 10px 12px;
  font-size: 14px;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Phone frame — iPhone-ish. Only renders on wider viewports. */
.phone-frame {
  width: 100%;
  max-width: 420px;
  height: calc(100vh - 40px);
  background: #000;
  position: relative;
  margin: 0 auto;
}

.phone-notch { display: none; }

@media (min-width: 520px) {
  .phone-frame {
    margin: 24px auto;
    height: 840px;
    max-height: calc(100vh - 80px);
    border: 10px solid #1a1a1a;
    border-radius: 44px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 2px #2a2a2a;
  }
  .phone-notch {
    display: block;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 26px;
    background: #000;
    border-radius: 0 0 18px 18px;
    z-index: 10;
  }
  .wa-header { padding-top: 30px; }
}

/* WhatsApp app container */
.wa-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0b141a;
  background-image:
    radial-gradient(rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Header */
.wa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #202c33;
  padding: 10px 12px;
  border-bottom: 1px solid #2a3942;
  flex-shrink: 0;
}

.wa-back {
  background: none;
  border: none;
  color: #e9edef;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 2px;
}

.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #008069);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}

.wa-contact {
  flex: 1;
  min-width: 0;
}

.wa-name {
  font-size: 16px;
  font-weight: 500;
  color: #e9edef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-status {
  font-size: 12px;
  color: #8696a0;
}

.wa-header-icons {
  display: flex;
  gap: 14px;
  color: #aebac1;
  font-size: 18px;
}
.wa-icon { cursor: pointer; }

/* Chat area */
.wa-chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

/* Bubbles */
.bubble {
  max-width: 82%;
  padding: 7px 10px 8px;
  border-radius: 7.5px;
  font-size: 14.5px;
  line-height: 1.35;
  word-wrap: break-word;
  position: relative;
  animation: bubbleIn 0.18s ease-out;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.2);
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble.in {
  align-self: flex-start;
  background: #202c33;
  color: #e9edef;
  border-top-left-radius: 0;
  margin-left: 4px;
}

.bubble.out {
  align-self: flex-end;
  background: #005c4b;
  color: #e9edef;
  border-top-right-radius: 0;
  margin-right: 4px;
}

.bubble .time {
  font-size: 10.5px;
  color: #8696a0;
  float: right;
  margin-left: 8px;
  margin-top: 4px;
}

.bubble.out .time { color: #a8c4be; }

/* Typing indicator */
.typing {
  align-self: flex-start;
  background: #202c33;
  padding: 10px 14px;
  border-radius: 7.5px;
  border-top-left-radius: 0;
  margin-left: 4px;
  display: flex;
  gap: 4px;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8696a0;
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* Quick reply buttons — inline with bot message */
.quick-replies {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 4px 6px;
  max-width: 85%;
}

.qr-btn {
  background: #2a3942;
  color: #00d0a4;
  border: 1px solid #374248;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.qr-btn:hover, .qr-btn:active {
  background: #374248;
}
.qr-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Document card (inside bot bubble) */
.doc-card {
  background: #111b21;
  border: 1px solid #2a3942;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
  font-size: 13px;
}

.doc-card + .doc-card { margin-top: 6px; }

.doc-card .doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.doc-card .doc-type {
  font-weight: 600;
  color: #e9edef;
  font-size: 13px;
}

.doc-card .doc-amount {
  font-weight: 700;
  color: #00d0a4;
  font-size: 14px;
}

.doc-card .doc-meta {
  color: #8696a0;
  font-size: 12px;
  line-height: 1.5;
}

.doc-card .doc-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.doc-card .doc-status.vencida {
  background: rgba(234, 67, 53, 0.15);
  color: #f87171;
}

.doc-card .doc-status.vigente {
  background: rgba(0, 208, 164, 0.13);
  color: #00d0a4;
}

.doc-summary {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #2a3942;
  font-size: 13px;
  color: #aebac1;
}
.doc-summary strong { color: #e9edef; }

/* Input bar */
.wa-input-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: #0b141a;
  flex-shrink: 0;
}

.wa-input-btn {
  background: none;
  border: none;
  color: #8696a0;
  font-size: 20px;
  padding: 8px;
  cursor: pointer;
}

.wa-input {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: 22px;
  padding: 10px 14px;
  font-size: 15px;
  color: #e9edef;
  outline: none;
  font-family: inherit;
}
.wa-input::placeholder { color: #8696a0; }

.wa-send {
  background: #00a884;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wa-send:active { background: #008069; }

/* Scrollbar (webkit) */
.wa-chat::-webkit-scrollbar { width: 4px; }
.wa-chat::-webkit-scrollbar-thumb { background: #2a3942; border-radius: 2px; }
