/* ============================================================
   HomeIQ CRM — WhatsApp Integration + Google Maps CSS
   ============================================================ */

/* ── WhatsApp brand colours ─────────────────────────────── */
:root {
  --wa-green:     #25d366;
  --wa-dark:      #128c7e;
  --wa-light:     #dcfce7;
  --maps-blue:    #4285f4;
  --maps-green:   #34a853;
  --maps-red:     #ea4335;
  --maps-yellow:  #fbbc04;
}

/* ─────────────────────────────────────────────────────────
   HOW IT WORKS BANNER
───────────────────────────────────────────────────────── */
.wa-how-it-works {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8eaed;
  padding: 16px 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  overflow: hidden;
}
.wa-hiw-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 160px;
  padding: 8px 0;
}
.wa-hiw-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.wa-hiw-text {
  font-size: 12.5px;
  color: #374151;
  line-height: 1.5;
}
.wa-hiw-arrow {
  font-size: 20px;
  color: #d1d5db;
  padding: 0 8px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .wa-how-it-works { flex-direction: column; }
  .wa-hiw-arrow { transform: rotate(90deg); }
}

/* ─────────────────────────────────────────────────────────
   INBOX
───────────────────────────────────────────────────────── */
.wa-unread-chip {
  background: #fef2f2;
  color: #dc2626;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #fca5a5;
}
.wa-tab-badge {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: var(--wa-green);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  margin-left: 4px;
  vertical-align: middle;
}
.wa-inbox {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8eaed;
  overflow: hidden;
  margin-top: 12px;
}
.wa-inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}
.wa-msg-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
}
.wa-msg-card:hover { background: #f8fafc; }
.wa-msg-card:last-child { border-bottom: none; }
.wa-msg-new {
  background: #f0fdf4;
  border-left: 3px solid var(--wa-green);
}
.wa-msg-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  flex-shrink: 0;
}
.wa-msg-body { flex: 1; min-width: 0; }
.wa-msg-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 2px;
}
.wa-msg-name { font-size: 13.5px; font-weight: 700; color: #1a1d2e; }
.wa-msg-time { font-size: 11px; color: #9ca3af; white-space: nowrap; }
.wa-msg-phone { font-size: 11px; color: #6b7280; margin-bottom: 4px; }
.wa-msg-preview {
  font-size: 12.5px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-msg-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.wa-status-pill {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────
   CHAT WINDOW
───────────────────────────────────────────────────────── */
.wa-chat-window {
  background: #e5ddd5;
  border-radius: 12px;
  padding: 16px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wa-bubble-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.wa-bubble-wrap.sent { flex-direction: row-reverse; }
.wa-bubble-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.wa-bubble {
  max-width: 75%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.wa-bubble.received {
  background: #fff;
  color: #1a1d2e;
  border-bottom-left-radius: 4px;
}
.wa-bubble.sent {
  background: #dcf8c6;
  color: #1a1d2e;
  border-bottom-right-radius: 4px;
}
.wa-bubble-time {
  font-size: 10px;
  color: #9ca3af;
  text-align: right;
  margin-top: 4px;
}
.wa-chat-system-msg {
  text-align: center;
  font-size: 11.5px;
  color: #6b7280;
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  padding: 6px 12px;
}

/* ─────────────────────────────────────────────────────────
   SEND PANEL
───────────────────────────────────────────────────────── */
.wa-send-panel { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.wa-send-section {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8eaed;
  padding: 18px 20px;
}
.wa-send-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1d2e;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wa-send-cta {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.wa-project-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8eaed;
}
.wa-proj-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  gap: 12px;
  flex-wrap: wrap;
}
.wa-proj-row:last-child { border-bottom: none; }
.wa-proj-row:hover { background: #f8fafc; }
.wa-proj-info { flex: 1; min-width: 0; }

/* ─────────────────────────────────────────────────────────
   TEMPLATES
───────────────────────────────────────────────────────── */
.wa-templates { margin-top: 12px; }
.wa-tpl-category { margin-bottom: 20px; }
.wa-tpl-cat-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6b7280;
  margin-bottom: 10px;
}
.wa-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.wa-tpl-card {
  border-radius: 12px;
  border: 1px solid #e8eaed;
  padding: 14px;
  transition: box-shadow 0.2s;
}
.wa-tpl-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.wa-tpl-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.wa-tpl-title { font-size: 13.5px; font-weight: 700; color: #1a1d2e; }
.wa-tpl-category-tag {
  font-size: 10.5px;
  color: #6b7280;
  margin-top: 2px;
}
.wa-tpl-preview {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 10px;
  background: #f8f9fa;
  padding: 8px;
  border-radius: 8px;
}
.wa-tpl-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.wa-var-chip {
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-family: 'Courier New', monospace;
  font-weight: 600;
}
.wa-tpl-actions {
  display: flex;
  gap: 6px;
}

/* ─────────────────────────────────────────────────────────
   SETUP / SETTINGS
───────────────────────────────────────────────────────── */
.wa-setup { margin-top: 12px; display: flex; flex-direction: column; gap: 16px; }
.wa-setup-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8eaed;
  padding: 20px 22px;
}
.wa-setup-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1d2e;
  margin-bottom: 16px;
}
.wa-setup-steps { display: flex; flex-direction: column; gap: 14px; }
.wa-setup-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.wa-setup-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #eff6ff;
  color: #1d4ed8;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   GOOGLE MAPS MODULE
───────────────────────────────────────────────────────── */
.maps-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.maps-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .maps-layout { grid-template-columns: 1fr; }
}

/* Site list */
.maps-site-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8eaed;
  overflow: hidden;
  max-height: 70vh;
  overflow-y: auto;
}
.maps-site-card {
  padding: 12px 14px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
}
.maps-site-card:hover { background: #f8fafc; }
.maps-site-card:last-child { border-bottom: none; }
.maps-site-active {
  background: #eff6ff !important;
  border-left: 3px solid #4285f4;
}
.maps-site-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.maps-site-pin {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px;
  flex-shrink: 0;
}
.maps-site-name { font-size: 13px; font-weight: 700; color: #1a1d2e; }
.maps-site-address { font-size: 11.5px; color: #6b7280; margin-top: 2px; }
.maps-site-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
}
.maps-site-btns {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* Map panel */
.maps-map-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 80px;
}
.maps-embed-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e8eaed;
}
.maps-embed-actions {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #e8eaed;
  flex-wrap: wrap;
}

/* Info panel below map */
.maps-info-panel {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8eaed;
  padding: 14px 16px;
}
.maps-info-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1d2e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.maps-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #374151;
  margin-bottom: 6px;
}
.maps-info-row i { width: 16px; color: #9ca3af; }

/* ─────────────────────────────────────────────────────────
   MAPS EMBED IN MODALS
───────────────────────────────────────────────────────── */
#projMapEmbed iframe,
#woMapEmbed iframe {
  border-radius: 10px;
  width: 100%;
  min-height: 220px;
}

/* ─────────────────────────────────────────────────────────
   WA BUTTON (general)
───────────────────────────────────────────────────────── */
.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--wa-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.2s;
}
.wa-btn:hover { background: var(--wa-dark); }

/* ─────────────────────────────────────────────────────────
   RESPONSIVENESS
───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wa-how-it-works { padding: 12px; gap: 12px; }
  .wa-hiw-item { min-width: 100%; }
  .wa-tpl-grid { grid-template-columns: 1fr; }
  .wa-send-cta { justify-content: stretch; }
  .wa-send-cta .btn { flex: 1; justify-content: center; }
  .maps-site-list { max-height: 50vh; }
  .maps-map-panel { position: static; }
}
