/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  --green-dark:    #0d3010;
  --green-primary: #1e6b20;
  --green-mid:     #2d7a2f;
  --green-light:   #f0f7f0;
  --green-bg:      #f8faf8;
  --gold:          #c9a84c;
  --gold-dark:     #a07c2a;
  --white:         #ffffff;
  --cream:         #fafcfa;
  --text-dark:     #1a1a1a;
  --text-mid:      #4a4a4a;
  --text-light:    #8a9a8a;
  --border:        rgba(30, 107, 32, 0.12);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 20px rgba(0,0,0,0.10);
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --font-display:  'Outfit', sans-serif;
  --font-body:     'Inter', sans-serif;
  --urgency-h:     40px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--green-bg);
  color: var(--text-dark);
  overflow: hidden;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }
input { font-family: var(--font-body); }

/* ============================================
   URGENCY BAR
   ============================================ */
.urgency-bar {
  height: var(--urgency-h);
  background: linear-gradient(90deg, var(--green-dark) 0%, #163518 50%, var(--green-dark) 100%);
  color: #d1fae5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 16px;
  font-size: 0.8rem;
  flex-shrink: 0;
  z-index: 100;
}

.urgency-bar strong { color: #fff; }

.urgency-dot {
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(74,222,128,0); }
}

.urgency-stock {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.urgency-stock strong { color: #fbbf24; }

/* ============================================
   APP SHELL — DESKTOP 2 columnas
   ============================================ */
.app-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 38% 62%;
  overflow: hidden;
  min-height: 0;
}

/* ============================================
   PRODUCT PANEL
   ============================================ */
.product-panel {
  background: linear-gradient(160deg, #e8f5e8 0%, var(--green-light) 60%, #d4eed4 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-panel-inner {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 340px;
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: 3px;
}

.brand-accent { color: var(--green-primary); }

.brand-badge {
  font-size: 0.72rem;
  color: var(--green-mid);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.product-image-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  filter: drop-shadow(0 20px 40px rgba(13,48,16,0.25));
}

.product-img {
  max-height: 280px;
  width: auto;
  object-fit: contain;
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

.product-img:hover { transform: scale(1.08); }

.product-info { text-align: center; }

.product-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.2;
  margin-bottom: 12px;
}

.product-name-accent {
  color: var(--green-primary);
  font-weight: 800;
}

.product-price {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 14px;
}

.product-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-item {
  font-size: 0.85rem;
  color: var(--green-dark);
  font-weight: 500;
}

.trust-seals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  backdrop-filter: blur(4px);
}

.seal {
  display: flex;
  align-items: center;
  gap: 10px;
}

.seal-icon { font-size: 1rem; }

.seal-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-dark);
}

/* ============================================
   AGENT PANEL
   ============================================ */
.agent-panel {
  display: flex;
  flex-direction: column;
  background: var(--white);
  overflow: hidden;
  min-height: 0;
}

/* Agent header */
.agent-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.agent-avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--green-primary), var(--green-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(30,107,32,0.3);
  position: relative;
}

.agent-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
}

.agent-info { flex: 1; }

.agent-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.agent-status {
  font-size: 0.75rem;
  color: var(--green-mid);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px; height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

.agent-verified {
  font-size: 0.75rem;
  color: var(--green-primary);
  font-weight: 700;
  background: var(--green-light);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* Chat body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--cream);
  scroll-behavior: smooth;
  min-height: 0;
}

.chat-body::-webkit-scrollbar { width: 4px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Chat footer */
.chat-footer {
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--green-bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 6px 6px 6px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-bar:focus-within {
  border-color: var(--green-primary);
  box-shadow: 0 0 0 3px rgba(30,107,32,0.08);
}

.user-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--text-dark);
  padding: 6px 0;
}

.user-input::placeholder { color: var(--text-light); }

.btn-send {
  width: 38px; height: 38px;
  background: var(--green-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.btn-send:hover { background: var(--green-dark); transform: scale(1.05); }
.btn-send:active { transform: scale(0.95); }
.btn-send:disabled { background: var(--text-light); cursor: not-allowed; transform: none; }

/* ============================================
   CHAT MESSAGES
   ============================================ */
.chat-msg {
  display: flex;
  max-width: 88%;
}

.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.55;
}

.msg-bot .msg-bubble {
  background: var(--white);
  color: var(--text-dark);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.msg-user .msg-bubble {
  background: var(--green-primary);
  color: #fff;
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
}

/* Typing indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}

.dot {
  width: 7px; height: 7px;
  background: var(--text-light);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Inline quick replies */
.inline-replies {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-self: stretch;
  margin: 0 0 4px;
}

.btn-quick {
  background: var(--white);
  color: var(--green-primary);
  border: 1.5px solid var(--green-primary);
  border-radius: 30px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  transition: all 0.18s ease;
  display: block;
  width: 100%;
}

.btn-quick:hover {
  background: var(--green-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30,107,32,0.2);
}

.btn-quick:active { transform: translateY(0); }

/* Inline input step */
.inline-input-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
  margin: 0 0 4px;
}

.step-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-dark);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}

.step-input:focus { border-color: var(--green-primary); }

.btn-step-send {
  background: var(--green-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 0.2s;
  align-self: flex-end;
}

.btn-step-send:hover { background: var(--green-dark); }

/* Order summary card */
.order-summary-card {
  background: var(--white);
  border: 2px solid var(--green-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  align-self: stretch;
}

.order-summary-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.order-product-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.order-product-name { font-weight: 700; font-size: 0.88rem; color: var(--green-dark); }
.order-product-price { font-weight: 800; font-size: 1.05rem; color: var(--gold); }

.order-row {
  display: flex;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-mid);
  padding: 3px 0;
}

.order-label {
  font-weight: 600;
  color: var(--text-dark);
  min-width: 90px;
  flex-shrink: 0;
}

/* WhatsApp CTA */
.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #25d366, #128c4a);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  padding: 15px 20px;
  text-decoration: none;
  width: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(37,211,102,0.3);
  align-self: stretch;
  cursor: pointer;
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,211,102,0.4);
}

.btn-whatsapp svg { flex-shrink: 0; }

/* ============================================
   MOBILE (< 1024px) — App Shell vertical
   ============================================ */
@media (max-width: 1023px) {
  body { overflow: hidden; }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .product-panel {
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--green-dark), #163518);
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    overflow: visible;
    align-items: stretch;
    justify-content: stretch;
  }

  .product-panel-inner {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    max-width: 100%;
  }

  .brand-header { display: none; }
  .trust-seals  { display: none; }

  .product-image-wrap {
    width: 48px;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  }

  .product-img {
    max-height: 58px;
    transform: none;
  }

  .product-img:hover { transform: none; }

  .product-info { flex: 1; text-align: left; }

  .product-name {
    font-size: 0.82rem;
    color: #fff;
    margin-bottom: 2px;
  }

  .product-name-accent { color: #a8d5a9; }

  .product-price {
    font-size: 1.25rem;
    color: var(--gold);
    margin-bottom: 2px;
  }

  .product-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .meta-item {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.65);
  }

  .agent-panel { flex: 1; min-height: 0; }

  .agent-header { padding: 12px 16px; }

  .agent-avatar { width: 36px; height: 36px; font-size: 0.9rem; }

  .agent-name { font-size: 0.88rem; }

  .chat-body { padding: 14px 14px 10px; }

  .urgency-stock { display: none; }
}

@media (max-width: 480px) {
  .urgency-bar { font-size: 0.7rem; gap: 8px; }
  .agent-verified { display: none; }
}
