/* ============================================
   Punjab Roots Realty — WhatsApp Leads Styles
   ============================================ */

/* ======== CONNECTION BANNER ======== */
.wa-connection-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius-lg, 16px);
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

.wa-connection-banner.connected {
  background: linear-gradient(135deg, rgba(37,211,102,0.08), rgba(37,211,102,0.03));
  border: 1px solid rgba(37,211,102,0.2);
}

.wa-connection-banner.disconnected {
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.03));
  border: 1px solid rgba(245,158,11,0.2);
}

.wa-banner-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wa-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wa-connection-banner.connected .wa-banner-icon {
  background: rgba(37,211,102,0.12);
  color: #25D366;
}

.wa-connection-banner.disconnected .wa-banner-icon {
  background: rgba(245,158,11,0.12);
  color: #F59E0B;
}

.wa-banner-left h3 {
  font-size: var(--text-base, 16px);
  font-weight: var(--fw-semibold, 600);
  margin-bottom: 4px;
}

.wa-banner-left p {
  font-size: var(--text-xs, 12px);
  color: var(--clr-text-muted);
  margin: 0;
}

.wa-banner-right {
  flex-shrink: 0;
}

/* ======== AUTO-IMPORT TOGGLE ======== */
.wa-auto-import {
  display: flex;
  align-items: center;
}

.wa-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm, 14px);
  font-weight: var(--fw-medium, 500);
  cursor: pointer;
}

.wa-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--clr-bg-tertiary, #e2e8f0);
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
}

.wa-toggle.active {
  background: #25D366;
}

.wa-toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.wa-toggle.active .wa-toggle-thumb {
  transform: translateX(20px);
}

/* ======== TABS ======== */
.wa-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--clr-bg-tertiary, #f1f5f9);
  padding: 4px;
  border-radius: 12px;
  width: fit-content;
}

.wa-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--clr-text-muted);
  font-size: var(--text-sm, 14px);
  font-weight: var(--fw-medium, 500);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.wa-tab:hover {
  color: var(--clr-text-primary);
  background: rgba(0,0,0,0.03);
}

.wa-tab.active {
  background: var(--clr-bg-card, #fff);
  color: #25D366;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.wa-tab .material-icons-round {
  font-size: 18px;
}

.wa-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #25D366;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
}

/* ======== INCOMING MESSAGES ======== */
.wa-incoming-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.wa-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--clr-bg-card, #fff);
  border: 1px solid var(--glass-border, rgba(0,0,0,0.08));
  border-radius: 10px;
  min-width: 250px;
}

.wa-search-box .material-icons-round {
  font-size: 18px;
  color: var(--clr-text-muted);
}

.wa-search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: var(--text-sm, 14px);
  color: var(--clr-text-primary);
  width: 100%;
  font-family: inherit;
}

/* ======== MESSAGE CARDS ======== */
.wa-messages-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-msg-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--clr-bg-card, #fff);
  border: 1px solid var(--glass-border, rgba(0,0,0,0.06));
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.wa-msg-card:hover {
  border-color: rgba(37,211,102,0.3);
  box-shadow: 0 4px 12px rgba(37,211,102,0.08);
  transform: translateY(-1px);
}

.wa-msg-card.selected {
  border-color: #25D366;
  background: rgba(37,211,102,0.04);
  box-shadow: 0 0 0 2px rgba(37,211,102,0.15);
}

.wa-msg-card.converted {
  opacity: 0.6;
  pointer-events: none;
}

.wa-msg-select {
  padding-top: 2px;
  flex-shrink: 0;
}

.wa-msg-select input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #25D366;
  cursor: pointer;
}

.wa-msg-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

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

.wa-msg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.wa-msg-sender {
  font-weight: var(--fw-semibold, 600);
  font-size: var(--text-sm, 14px);
  color: var(--clr-text-primary);
}

.wa-msg-time {
  font-size: 11px;
  color: var(--clr-text-muted);
  flex-shrink: 0;
}

.wa-msg-phone {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--clr-text-muted);
  margin-bottom: 6px;
}

.wa-msg-text {
  font-size: var(--text-sm, 14px);
  color: var(--clr-text-secondary, #64748b);
  line-height: 1.5;
  margin-bottom: 10px;
  white-space: pre-line;
  word-break: break-word;
}

.wa-msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-converted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--clr-success, #16a34a);
  font-weight: 500;
}

/* ======== EMPTY STATE ======== */
.wa-empty-state {
  text-align: center;
  padding: 60px 40px;
  background: var(--clr-bg-card, #fff);
  border: 2px dashed var(--glass-border, rgba(0,0,0,0.08));
  border-radius: 16px;
}

.wa-empty-icon {
  margin-bottom: 16px;
}

.wa-empty-state h3 {
  font-size: var(--text-lg, 18px);
  margin-bottom: 8px;
  color: var(--clr-text-primary);
}

.wa-empty-state p {
  color: var(--clr-text-muted);
  font-size: var(--text-sm, 14px);
  margin: 0;
}

/* ======== MANUAL IMPORT ======== */
.wa-import-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wa-import-hero {
  text-align: center;
  padding: 40px 24px 20px;
}

.wa-import-hero-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: rgba(37,211,102,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.wa-import-hero h3 {
  font-size: var(--text-xl, 20px);
  margin-bottom: 8px;
}

.wa-import-hero p {
  color: var(--clr-text-muted);
  font-size: var(--text-sm, 14px);
}

/* How-To Steps */
.wa-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px;
}

.wa-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.wa-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.wa-step strong {
  display: block;
  font-size: var(--text-sm, 14px);
  margin-bottom: 2px;
}

.wa-step p {
  font-size: 12px;
  color: var(--clr-text-muted);
  margin: 0;
  line-height: 1.4;
}

/* Paste Area */
.wa-paste-textarea {
  font-family: 'Courier New', monospace;
  font-size: 13px !important;
  line-height: 1.6 !important;
  resize: vertical;
  min-height: 200px;
  border: 2px dashed rgba(37,211,102,0.2) !important;
  border-radius: 12px !important;
  background: var(--clr-bg-tertiary, #f8fafc) !important;
  transition: border-color 0.3s ease;
}

.wa-paste-textarea:focus {
  border-color: #25D366 !important;
  background: var(--clr-bg-card, #fff) !important;
}

.wa-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm, 14px);
  color: var(--clr-text-secondary, #64748b);
  cursor: pointer;
}

/* ======== PARSED RESULTS ======== */
.wa-parsed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.wa-parsed-header h3 {
  font-size: var(--text-base, 16px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-parsed-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-parsed-contact {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--clr-bg-card, #fff);
  border: 1px solid var(--glass-border, rgba(0,0,0,0.06));
  border-radius: 12px;
  transition: all 0.2s ease;
}

.wa-parsed-contact:hover {
  border-color: rgba(37,211,102,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.wa-parsed-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.wa-parsed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

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

.wa-parsed-name {
  margin-bottom: 4px;
}

.wa-parsed-phone-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.wa-inline-input {
  border: none;
  border-bottom: 1px solid transparent;
  background: none;
  font-size: var(--text-sm, 14px);
  font-weight: var(--fw-semibold, 600);
  color: var(--clr-text-primary);
  padding: 2px 4px;
  font-family: inherit;
  outline: none;
  width: 100%;
  max-width: 300px;
  transition: border-color 0.2s ease;
}

.wa-inline-input:focus {
  border-bottom-color: #25D366;
}

.wa-inline-input.small {
  font-size: 12px;
  font-weight: 400;
  color: var(--clr-text-muted);
  max-width: 200px;
}

.wa-parsed-msgs-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-msg-preview-text {
  font-size: 12px;
  color: var(--clr-text-muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

/* ======== RESPONSIVE ======== */
@media (max-width: 768px) {
  .wa-connection-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .wa-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .wa-tab {
    white-space: nowrap;
    font-size: 13px;
    padding: 8px 14px;
  }

  .wa-incoming-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .wa-search-box {
    min-width: unset;
    width: 100%;
  }

  .wa-steps {
    grid-template-columns: 1fr;
  }

  .wa-parsed-contact {
    flex-wrap: wrap;
  }

  .wa-msg-preview-text {
    max-width: 200px;
  }
}
