/*
 * communication-section.css
 * Tekzow — Animated Communication Section
 * ─────────────────────────────────────────────────────────────────
 * Uses ONLY existing Tekzow CSS variables from main.css :root.
 * All class names are prefixed with "comm-" to prevent conflicts.
 * Load this AFTER assets/css/main.css and assets/css/tekzow.css
 * ─────────────────────────────────────────────────────────────────
 */


/* ══════════════════════════════════════════════════════
   SECTION WRAPPER
══════════════════════════════════════════════════════ */
.comm-section {
  padding: 100px 0 110px;
  background: var(--tg-color-gray-3);
  position: relative;
  overflow: hidden;
}

.comm-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--tg-theme-primary), var(--tg-color-blue-light-2));
}

.comm-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}


/* ══════════════════════════════════════════════════════
   SECTION HEADING
══════════════════════════════════════════════════════ */
.comm-heading {
  text-align: center;
  margin-bottom: 60px;
}

.comm-sub-title {
  display: inline-block;
  font-family: var(--tg-body-font-family);
  font-size: 13px;
  font-weight: var(--tg-fw-bold);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tg-theme-primary);
  background: var(--tg-color-gray-4);
  border-radius: 50px;
  padding: 6px 18px;
  margin-bottom: 16px;
}

.comm-title {
  font-family: var(--tg-heading-font-family);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: var(--tg-fw-bold);
  color: var(--tg-heading-color);
  line-height: var(--tg-heading-line-height);
  margin: 0 0 16px;
}

.comm-desc {
  font-family: var(--tg-body-font-family);
  font-size: 16px;
  color: var(--tg-body-color);
  max-width: 520px;
  margin: 0 auto;
  line-height: var(--tg-body-line-height);
}


/* ══════════════════════════════════════════════════════
   TWO-CARD GRID
══════════════════════════════════════════════════════ */
.comm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .comm-grid {
    grid-template-columns: 1fr;
    max-width: 540px;
    margin: 0 auto;
  }
}


/* ══════════════════════════════════════════════════════
   CARD BASE
══════════════════════════════════════════════════════ */
.comm-card {
  background: var(--tg-color-white-default);
  border-radius: 20px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 30px rgba(1, 67, 235, 0.08);
  border: 1px solid var(--tg-border-2);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  min-height: 460px;
}

.comm-card:hover {
  box-shadow: 0 8px 50px rgba(1, 67, 235, 0.14);
  transform: translateY(-2px);
}


/* ══════════════════════════════════════════════════════
   CARD HEADER
══════════════════════════════════════════════════════ */
.comm-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--tg-border-2);
  background: var(--tg-color-white-default);
}

.comm-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.comm-card:hover .comm-card-icon {
  transform: scale(1.05);
}

/* WhatsApp icon — green */
.comm-wa-icon {
  background: #25D366;
  color: #fff;
}

/* Phone icon — theme primary */
.comm-call-icon {
  background: var(--tg-theme-primary);
  color: #fff;
}

.comm-card-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comm-card-label {
  font-family: var(--tg-heading-font-family);
  font-size: 15px;
  font-weight: var(--tg-fw-bold);
  color: var(--tg-heading-color);
  line-height: 1.2;
}

.comm-card-status {
  font-size: 12px;
  font-weight: var(--tg-fw-medium);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

.comm-card-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25D366;
  animation: comm-pulse-status 2s infinite;
}

.comm-call-status::before {
  background: var(--tg-theme-primary);
}

@keyframes comm-pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.comm-wa-status { color: #25D366; }
.comm-call-status { color: var(--tg-theme-primary); }


/* ══════════════════════════════════════════════════════
   WHATSAPP — CHAT WINDOW
══════════════════════════════════════════════════════ */
.comm-chat-window {
  flex: 1;
  padding: 20px 18px;
  background: #ece5dd;  /* Classic WhatsApp chat background */
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.03) 1px, transparent 0);
  background-size: 22px 22px;
  overflow-y: auto;
}

/* ── Client typing row ── */
.comm-typing-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  animation: comm-fade-in 0.25s ease forwards;
}

.comm-typing-label {
  font-family: var(--tg-body-font-family);
  font-size: 14px;
  font-weight: var(--tg-fw-medium);
  color: #4a4a4a;
  background: #fff;
  padding: 8px 14px;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  max-width: 75%;
  word-break: break-word;
  line-height: 1.5;
}

.comm-typing-cursor {
  font-size: 16px;
  color: #4a4a4a;
  animation: comm-blink 0.7s step-end infinite;
  font-weight: 300;
  opacity: 0;
}

/* Only show cursor when parent typing row is visible */
.comm-typing-row[style*="flex"] .comm-typing-cursor,
.comm-typing-row:not([style*="none"]) .comm-typing-cursor {
  opacity: 1;
}

@keyframes comm-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Message rows ── */
.comm-message-row {
  display: flex;
  animation: comm-msg-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.comm-msg-client {
  justify-content: flex-start;
}

.comm-msg-company {
  justify-content: flex-end;
}

/* ── Bubbles ── */
.comm-bubble {
  max-width: 78%;
  padding: 10px 14px 8px;
  border-radius: 18px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  line-height: 1.5;
}

.comm-bubble-client {
  background: #fff;
  border-bottom-left-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comm-bubble-company {
  background: var(--tg-theme-primary);
  border-bottom-right-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Tail on client bubble */
.comm-bubble-client::before {
  content: '';
  position: absolute;
  left: -7px;
  bottom: 6px;
  border: 8px solid transparent;
  border-right-color: #fff;
  border-left: 0;
  margin-left: 0;
}

/* Tail on company bubble */
.comm-bubble-company::after {
  content: '';
  position: absolute;
  right: -7px;
  bottom: 6px;
  border: 8px solid transparent;
  border-left-color: var(--tg-theme-primary);
  border-right: 0;
}

.comm-bubble-text {
  font-family: var(--tg-body-font-family);
  font-size: 14px;
  font-weight: var(--tg-fw-medium);
  display: block;
  word-break: break-word;
}

.comm-bubble-client .comm-bubble-text {
  color: #111;
}

.comm-bubble-company .comm-bubble-text {
  color: #fff;
}

.comm-bubble-time {
  font-size: 10px;
  display: block;
  text-align: right;
  margin-top: 2px;
  opacity: 0.65;
}

.comm-bubble-client .comm-bubble-time { color: #555; }
.comm-bubble-company .comm-bubble-time { color: rgba(255,255,255,0.85); }

/* ── Typing indicator (dots) ── */
.comm-bubble-typing {
  padding: 12px 16px;
  border-bottom-right-radius: 4px;
  background: var(--tg-color-blue-light-2);
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 5px;
  min-width: 60px;
  justify-content: center;
}

.comm-bubble-typing::after { display: none; }

.comm-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  display: inline-block;
  animation: comm-typing-bounce 1.2s infinite ease-in-out;
}

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

@keyframes comm-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30% { transform: translateY(-5px); opacity: 1; }
}


/* ══════════════════════════════════════════════════════
   PHONE CALL — CALL AREA
══════════════════════════════════════════════════════ */
.comm-call-area {
  flex: 1;
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  position: relative;
}

.comm-call-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  gap: 10px;
  padding: 20px 0;
}

/* ── Ring animation ── */
.comm-call-ring-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.comm-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--tg-theme-primary);
  animation: comm-ring-pulse 2s infinite ease-out;
}

.comm-ring-1 {
  width: 70px;
  height: 70px;
  animation-delay: 0s;
}

.comm-ring-2 {
  width: 88px;
  height: 88px;
  animation-delay: 0.4s;
}

.comm-ring-3 {
  width: 106px;
  height: 106px;
  animation-delay: 0.8s;
}

@keyframes comm-ring-pulse {
  0% { opacity: 0.9; transform: scale(0.85); }
  70% { opacity: 0; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.1); }
}

/* ── Phone icon ── */
.comm-call-phone-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--tg-theme-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 20px rgba(1, 67, 235, 0.35);
  animation: comm-phone-ring 0.6s infinite alternate ease-in-out;
}

@keyframes comm-phone-ring {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(10deg); }
}

/* Stop ringing when connected */
.comm-phone-connected .comm-call-phone-icon {
  animation: none;
}

.comm-call-label {
  font-family: var(--tg-heading-font-family);
  font-size: 18px;
  font-weight: var(--tg-fw-bold);
  color: var(--tg-heading-color);
  margin: 0;
}

.comm-call-sub {
  font-size: 13px;
  color: var(--tg-body-color);
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

/* Ringing dots */
.comm-ring-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tg-theme-primary);
  animation: comm-ring-dot-blink 0.8s infinite;
}

.comm-ring-dot:nth-child(2) { animation-delay: 0.15s; }
.comm-ring-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes comm-ring-dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* ── Connected phase ── */
.comm-call-connected-phase {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px 0;
}

.comm-connected-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #e8f5e9;
  color: #2e7d32;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 14px rgba(46, 125, 50, 0.2);
  animation: comm-connected-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes comm-connected-pop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.comm-connected-label {
  font-family: var(--tg-heading-font-family);
  font-size: 17px;
  font-weight: var(--tg-fw-bold);
  color: #2e7d32;
  margin: 0;
}

.comm-call-timer {
  font-family: 'Courier New', monospace;
  font-size: 22px;
  font-weight: var(--tg-fw-bold);
  color: var(--tg-heading-color);
  background: var(--tg-color-gray-1);
  padding: 6px 18px;
  border-radius: 8px;
  letter-spacing: 2px;
}

/* ── Call conversation ── */
.comm-call-convo {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 0 4px;
}

.comm-call-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: comm-msg-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  background: var(--tg-color-gray-1);
  border-radius: 10px;
  padding: 10px 14px;
  border-left: 3px solid var(--tg-theme-primary);
}

.comm-call-sender {
  font-family: var(--tg-body-font-family);
  font-size: 11px;
  font-weight: var(--tg-fw-bold);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--tg-theme-primary);
}

.comm-call-text {
  font-family: var(--tg-body-font-family);
  font-size: 14px;
  color: var(--tg-heading-color);
  font-weight: var(--tg-fw-medium);
  line-height: 1.5;
}


/* ══════════════════════════════════════════════════════
   CTA WRAPPER
══════════════════════════════════════════════════════ */
.comm-cta-wrap {
  padding: 16px 20px 22px;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--tg-border-2);
  background: var(--tg-color-white-default);
  animation: comm-cta-rise 0.4s ease forwards;
}

@keyframes comm-cta-rise {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* WhatsApp CTA — green override on tg-btn */
.comm-cta-whatsapp {
  background: #25D366 !important;
  color: #fff !important;
  gap: 10px;
}

.comm-cta-whatsapp:hover,
.comm-cta-whatsapp:focus-visible {
  background: #1ebe5d !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

/* Call CTA — theme primary (default tg-btn) */
.comm-cta-call {
  gap: 10px;
}

.comm-cta-call:hover,
.comm-cta-call:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(1, 67, 235, 0.28);
}


/* ══════════════════════════════════════════════════════
   SHARED ANIMATIONS
══════════════════════════════════════════════════════ */
@keyframes comm-fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes comm-msg-pop {
  0% { opacity: 0; transform: translateY(8px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}


/* ══════════════════════════════════════════════════════
   PREFERS-REDUCED-MOTION
══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .comm-ring,
  .comm-call-phone-icon,
  .comm-dot,
  .comm-ring-dot,
  .comm-card-status::before,
  .comm-typing-cursor {
    animation: none !important;
  }

  .comm-message-row,
  .comm-call-msg,
  .comm-cta-wrap,
  .comm-connected-icon {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Ensure all content is visible without animation */
  .comm-bubble,
  .comm-call-msg,
  .comm-cta-wrap {
    opacity: 1 !important;
  }
}


/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 1199px) {
  .comm-section { padding: 80px 0 90px; }
  .comm-grid { gap: 24px; }
}

@media (max-width: 900px) {
  .comm-grid { max-width: 540px; margin: 0 auto; }
  .comm-card { min-height: 420px; }
}

@media (max-width: 600px) {
  .comm-section { padding: 60px 0 70px; }
  .comm-heading { margin-bottom: 40px; }
  .comm-title { font-size: 26px; }
  .comm-card { border-radius: 16px; min-height: 380px; }
  .comm-card-header { padding: 16px 18px 14px; }
  .comm-chat-window { padding: 16px 14px; min-height: 240px; }
  .comm-call-area { padding: 18px 18px 12px; }
  .comm-cta-wrap { padding: 14px 16px 18px; }
  .comm-cta-btn { font-size: 14px; padding: 13px 20px 15px; }
  .comm-call-ring-wrap { width: 88px; height: 88px; }
  .comm-call-phone-icon { width: 52px; height: 52px; }
}
