/* ==========================================================================
   CloudPastry Gen7 Conversational Terminal & Onboarding Styling
   Palette:
   - Chef Red: #B80000 (RGB: 184, 0, 0)
   - Slate Charcoal: #343B45
   - Dark Obsidian: #0E1420 / #161D29 / rgba(22, 29, 41, 0.96)
   ========================================================================== */

.cp-gen7-terminal {
  background: linear-gradient(180deg, rgba(22, 29, 41, 0.94) 0%, rgba(14, 20, 32, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(184, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 620px;
  max-width: 860px;
  margin: 0 auto;
  font-family: 'Cairo', system-ui, sans-serif;
  direction: rtl;
}

.cp-gen7-header {
  background: rgba(14, 20, 32, 0.92);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.cp-gen7-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.cp-gen7-avatar {
  width: 44px;
  height: 44px;
  background: #B80000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #ffffff;
  box-shadow: 0 0 18px rgba(184, 0, 0, 0.45);
}
.cp-gen7-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.cp-gen7-status {
  font-size: 13px;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cp-status-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #10B981;
}

.cp-gen7-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: rgba(10, 15, 24, 0.45);
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.cp-msg {
  display: flex;
  gap: 12px;
  max-width: 88%;
  animation: cpMsgFade 0.25s ease-out;
}
@keyframes cpMsgFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.cp-msg-bot {
  align-self: flex-start;
}
.cp-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.cp-msg-avatar {
  width: 34px;
  height: 34px;
  background: rgba(184, 0, 0, 0.15);
  border: 1px solid rgba(184, 0, 0, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.cp-msg-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.6;
}
.cp-msg-bot .cp-msg-bubble {
  background: rgba(28, 37, 52, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #F1F5F9;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.cp-msg-user .cp-msg-bubble {
  background: #B80000;
  color: #ffffff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 14px rgba(184, 0, 0, 0.35);
}
.cp-msg-bubble p {
  margin: 0;
}

/* Typing indicator */
.cp-typing .cp-msg-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
}
.cp-dot {
  width: 8px;
  height: 8px;
  background: #94A3B8;
  border-radius: 50%;
  animation: cpPulse 1s infinite alternate;
}
.cp-dot:nth-child(2) { animation-delay: 0.2s; }
.cp-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes cpPulse {
  from { opacity: 0.3; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.1); }
}

/* Quick Chips */
.cp-gen7-chips {
  padding: 12px 20px;
  background: rgba(14, 20, 32, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cp-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #E2E8F0;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.cp-chip:hover {
  background: rgba(184, 0, 0, 0.16);
  border-color: #B80000;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(184, 0, 0, 0.25);
}
.cp-chip-primary {
  background: rgba(184, 0, 0, 0.2);
  border-color: rgba(184, 0, 0, 0.55);
  color: #FFFFFF;
}

/* Chat Input Bar */
.cp-gen7-input-bar {
  padding: 14px 20px;
  background: rgba(14, 20, 32, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
}
.cp-gen7-input-bar input {
  flex: 1;
  background: rgba(22, 30, 43, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}
.cp-gen7-input-bar input::placeholder {
  color: #94A3B8;
}
.cp-gen7-input-bar input:focus {
  border-color: #B80000;
  box-shadow: 0 0 0 3px rgba(184, 0, 0, 0.2);
}
.cp-gen7-send-btn {
  background: #B80000;
  border: none;
  color: #ffffff;
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.cp-gen7-send-btn:hover {
  background: #9E0000;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(184, 0, 0, 0.4);
}

/* Onboarding & Upload Cards inside Chat */
.cp-onboarding-card {
  background: linear-gradient(180deg, rgba(28, 38, 54, 0.95) 0%, rgba(18, 24, 36, 0.98) 100%);
  border: 1.5px solid rgba(184, 0, 0, 0.35);
  border-radius: 18px;
  padding: 22px;
  margin-top: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.cp-card-header {
  margin-bottom: 16px;
}
.cp-card-header h4 {
  margin: 8px 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: #FFFFFF;
}
.cp-card-header p {
  margin: 0;
  font-size: 13px;
  color: #94A3B8;
}
.cp-plan-badge {
  display: inline-block;
  background: rgba(184, 0, 0, 0.2);
  border: 1px solid rgba(184, 0, 0, 0.4);
  color: #FF6B6B;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
}
.cp-badge-gold {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(217, 119, 6, 0.4);
  color: #FBBF24;
}

.cp-form-group {
  margin-bottom: 14px;
}
.cp-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #CBD5E1;
  margin-bottom: 6px;
}
.cp-form-group input, .cp-form-group select {
  width: 100%;
  box-sizing: border-box;
  background: rgba(14, 20, 31, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: #FFFFFF;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.cp-form-group input:focus, .cp-form-group select:focus {
  border-color: #B80000;
  box-shadow: 0 0 0 3px rgba(184, 0, 0, 0.2);
}
.cp-form-row {
  display: flex;
  gap: 12px;
}
.cp-form-row .cp-form-group {
  flex: 1;
}

.cp-btn-submit-seller {
  width: 100%;
  background: #B80000;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(184, 0, 0, 0.35);
}
.cp-btn-submit-seller:hover {
  background: #9E0000;
  box-shadow: 0 6px 20px rgba(184, 0, 0, 0.5);
  transform: translateY(-1px);
}

.cp-form-error {
  color: #F87171;
  font-size: 13px;
  margin-top: 8px;
  font-weight: 700;
}
.cp-img-preview img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
}

.cp-action-link {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #F1F5F9;
  margin-inline-end: 8px;
  margin-top: 6px;
  transition: all 0.2s ease;
}
.cp-action-link:hover {
  border-color: #B80000;
  color: #B80000;
}
.cp-action-primary {
  background: #B80000;
  color: #ffffff !important;
  border-color: #B80000;
}
.cp-action-primary:hover {
  background: #9E0000;
}

/* Suppress duplicate webchat bubble on home page to eliminate visual collision */
#wali-webchat,
.wwc-btn,
.waly-webchat-container,
#waly-chat-button {
  display: none !important;
}

/* Mobile Optimization & Responsiveness */
@media (max-width: 768px) {
  .hero__media {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .cp-gen7-terminal {
    height: clamp(480px, 65vh, 540px) !important;
    border-radius: 20px !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .cp-gen7-header {
    padding: 10px 14px !important;
    gap: 8px !important;
  }
  .cp-gen7-header-info {
    gap: 10px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }
  .cp-gen7-avatar {
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
    flex-shrink: 0 !important;
  }
  .cp-gen7-title {
    font-size: 13.5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .cp-gen7-status {
    font-size: 11px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .cp-plan-badge {
    font-size: 11px !important;
    padding: 3px 8px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  .cp-gen7-messages {
    padding: 14px 12px !important;
    gap: 12px !important;
  }
  .cp-msg {
    max-width: 95% !important;
    gap: 8px !important;
  }
  .cp-msg-avatar {
    width: 30px !important;
    height: 30px !important;
    font-size: 15px !important;
    flex-shrink: 0 !important;
  }
  .cp-msg-bubble {
    padding: 10px 13px !important;
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    border-radius: 16px !important;
    word-break: break-word !important;
  }
  .cp-gen7-chips {
    padding: 8px 10px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .cp-chip {
    font-size: 12px !important;
    padding: 6px 12px !important;
    flex-shrink: 0 !important;
  }
  .cp-gen7-input-bar {
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  .cp-gen7-input-bar input {
    font-size: 16px !important;
    padding: 8px 12px !important;
  }
  .cp-gen7-send-btn {
    padding: 8px 16px !important;
    font-size: 13px !important;
    flex-shrink: 0 !important;
  }
  .cp-onboarding-card {
    padding: 14px 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .cp-form-row {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .cp-form-group {
    width: 100% !important;
    margin-bottom: 10px !important;
  }
  .cp-form-group input,
  .cp-form-group select {
    font-size: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}
