/**
 * Praigen Hero Live Chat & Lead Capture Simulation Stylesheet
 * High-conversion 24/7 AI employee front-desk chat box mockup
 */

/* 1. Global Shield */
html, body {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  position: relative !important;
}

*, *::before, *::after {
  box-sizing: border-box !important;
}

/* 2. Hero Typography & Flex Containers */
.hero-section, .hero-container, main {
  max-width: 100% !important;
  overflow-x: clip !important;
}

.hero-section * {
  min-width: 0 !important; /* Overrides flex min-width: auto */
}

.hero-section h1 {
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  font-size: clamp(1.75rem, 5vw, 2.5rem) !important;
  line-height: 1.2 !important;
}

:root {
    --hcm-surface: rgba(255, 255, 255, 0.94);
    --hcm-surface-subtle: rgba(248, 250, 252, 0.95);
    --hcm-border: rgba(226, 232, 240, 0.85);
    --hcm-border-strong: rgba(203, 213, 225, 0.9);
    --hcm-text: #0f172a;
    --hcm-text-muted: #64748b;
    --hcm-text-subtle: #94a3b8;
    --hcm-accent: #2563eb;
    --hcm-accent-light: rgba(37, 99, 235, 0.08);
    --hcm-accent-border: rgba(37, 99, 235, 0.22);
    --hcm-agent-bubble: #ffffff;
    --hcm-agent-border: rgba(226, 232, 240, 0.9);
    --hcm-visitor-bubble: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --hcm-visitor-text: #ffffff;
    --hcm-success: #10b981;
    --hcm-success-light: rgba(16, 185, 129, 0.1);
    --hcm-success-border: rgba(16, 185, 129, 0.3);
    --hcm-shadow: 0 24px 56px -12px rgba(15, 23, 42, 0.14), 0 8px 24px -6px rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] {
    --hcm-surface: rgba(15, 23, 42, 0.92);
    --hcm-surface-subtle: rgba(30, 41, 59, 0.85);
    --hcm-border: rgba(51, 65, 85, 0.7);
    --hcm-border-strong: rgba(71, 85, 105, 0.8);
    --hcm-text: #f8fafc;
    --hcm-text-muted: #94a3b8;
    --hcm-text-subtle: #64748b;
    --hcm-accent: #3b82f6;
    --hcm-accent-light: rgba(59, 130, 246, 0.15);
    --hcm-accent-border: rgba(59, 130, 246, 0.3);
    --hcm-agent-bubble: rgba(30, 41, 59, 0.95);
    --hcm-agent-border: rgba(51, 65, 85, 0.85);
    --hcm-visitor-bubble: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --hcm-visitor-text: #ffffff;
    --hcm-success: #34d399;
    --hcm-success-light: rgba(52, 211, 153, 0.14);
    --hcm-success-border: rgba(52, 211, 153, 0.35);
    --hcm-shadow: 0 28px 64px -12px rgba(0, 0, 0, 0.45), 0 8px 24px -4px rgba(0, 0, 0, 0.3);
}

/* Simulation Container */
.hero-chat-simulation,
.hero-preview-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: clamp(480px, 52vw, 560px);
    box-sizing: border-box;
}

.hero-chat-orbit {
    position: absolute;
    inset: -4% -5% -4% -5%;
    border-radius: 36%;
    background:
        radial-gradient(circle at 75% 25%, rgba(37, 99, 235, 0.18), transparent 50%),
        radial-gradient(circle at 25% 75%, rgba(16, 185, 129, 0.14), transparent 55%),
        radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.08), transparent 60%);
    filter: blur(14px);
    pointer-events: none;
    z-index: 0;
}

/* Chat Card Window */
.hero-chat-card,
.chat-mockup-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    background: var(--hcm-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--hcm-border);
    border-radius: 22px;
    box-shadow: var(--hcm-shadow);
    overflow: hidden;
    box-sizing: border-box;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-chat-card:hover {
    box-shadow: 0 32px 68px -12px rgba(15, 23, 42, 0.18), 0 12px 30px -6px rgba(15, 23, 42, 0.08);
}

/* Header */
.hero-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.95rem 1.15rem;
    background: var(--hcm-surface-subtle);
    border-bottom: 1px solid var(--hcm-border);
}

.hero-chat-header__profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hero-chat-avatar-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.hero-chat-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hero-chat-avatar--badge {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #6366f1 0%, #8b5cf6 50%, #7c3aed 100%);
    color: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

html[data-theme="dark"] .hero-chat-avatar {
    border-color: rgba(51, 65, 85, 0.9);
}

.hero-chat-avatar__pulse {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #ffffff;
}

html[data-theme="dark"] .hero-chat-avatar__pulse {
    border-color: #0f172a;
}

.hero-chat-avatar__pulse::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid #10b981;
    opacity: 0.75;
    animation: hcm-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes hcm-ping {
    0% { transform: scale(0.9); opacity: 0.8; }
    80%, 100% { transform: scale(2.2); opacity: 0; }
}

.hero-chat-header__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hero-chat-header__title-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.hero-chat-header__name {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--hcm-text);
    margin: 0;
    line-height: 1.2;
}

.hero-chat-verified {
    display: inline-flex;
    color: #2563eb;
    margin-top: 1px;
}

html[data-theme="dark"] .hero-chat-verified {
    color: #60a5fa;
}

.hero-chat-header__role {
    font-size: 0.76rem;
    color: var(--hcm-text-muted);
    margin: 0;
    line-height: 1.25;
}

.hero-chat-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: var(--hcm-accent-light);
    border: 1px solid var(--hcm-accent-border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hcm-accent);
    white-space: nowrap;
}

.hero-chat-status-pill__moon {
    font-size: 0.78rem;
}

/* Chat Body */
.hero-chat-body {
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: 380px;
    overflow-y: auto;
}

.hero-chat-timestamp {
    display: flex;
    justify-content: center;
    margin: 0.15rem 0 0.4rem;
}

.hero-chat-timestamp span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--hcm-text-subtle);
    background: var(--hcm-surface-subtle);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--hcm-border);
}

/* Chat Rows & Bubbles */
.hero-chat-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    width: 100%;
}

.hero-chat-bubble-row--visitor {
    justify-content: flex-end;
}

.hero-chat-bubble-row--agent {
    justify-content: flex-start;
}

.hero-chat-mini-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.hero-chat-mini-avatar--badge {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #6366f1 0%, #7c3aed 100%);
    color: #ffffff;
}

.hero-chat-mini-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-chat-bubble {
    max-width: 82%;
    padding: 0.65rem 0.9rem;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.hero-chat-bubble--visitor {
    background: var(--hcm-visitor-bubble);
    color: var(--hcm-visitor-text);
    border-bottom-right-radius: 4px;
}

.hero-chat-bubble--visitor .hero-chat-bubble__text {
    color: #ffffff;
    margin: 0;
}

.hero-chat-bubble--agent {
    background: var(--hcm-agent-bubble);
    color: var(--hcm-text);
    border: 1px solid var(--hcm-agent-border);
    border-bottom-left-radius: 4px;
}

.hero-chat-bubble--agent .hero-chat-bubble__text {
    margin: 0 0 0.5rem 0;
    color: var(--hcm-text);
}

.hero-chat-bubble__meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    font-size: 0.68rem;
    margin-top: 0.35rem;
    opacity: 0.85;
}

.hero-chat-bubble--visitor .hero-chat-bubble__meta {
    color: rgba(255, 255, 255, 0.9);
}

.hero-chat-bubble--agent .hero-chat-bubble__meta {
    color: var(--hcm-text-muted);
}

.hero-chat-check-icon {
    display: inline-block;
}

/* Embedded Appointment Confirmation Card */
.hero-chat-appt-card {
    background: var(--hcm-surface-subtle);
    border: 1px solid var(--hcm-success-border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    margin-top: 0.45rem;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08);
}

.hero-chat-appt-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed var(--hcm-border-strong);
}

.hero-chat-appt-card__title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--hcm-text);
}

.hero-chat-appt-card__badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--hcm-success);
    background: var(--hcm-success-light);
    border: 1px solid var(--hcm-success-border);
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.hero-chat-appt-card__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.65rem;
}

.hero-chat-appt-card__item {
    display: flex;
    flex-direction: column;
    font-size: 0.74rem;
    line-height: 1.25;
}

.hero-chat-appt-card__label {
    color: var(--hcm-text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.hero-chat-appt-card__val {
    color: var(--hcm-text);
    font-weight: 500;
}

/* Interactive Footer & Industry Chips */
.hero-chat-footer {
    padding: 0.75rem 1.15rem 1rem;
    background: var(--hcm-surface-subtle);
    border-top: 1px solid var(--hcm-border);
}

.hero-chat-chips {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
    overflow-x: auto;
    padding-bottom: 2px;
}

.hero-chat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    border: 1px solid var(--hcm-border);
    background: var(--hcm-surface);
    color: var(--hcm-text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.hero-chat-chip:hover {
    border-color: var(--hcm-accent);
    color: var(--hcm-accent);
    transform: translateY(-1px);
}

.hero-chat-chip--active {
    background: var(--hcm-accent-light);
    border-color: var(--hcm-accent-border);
    color: var(--hcm-accent);
}

.hero-chat-input-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    background: var(--hcm-surface);
    border: 1px solid var(--hcm-border);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-chat-input-bar:hover {
    border-color: var(--hcm-accent);
    box-shadow: 0 0 0 3px var(--hcm-accent-light);
}

.hero-chat-input-placeholder {
    font-size: 0.78rem;
    color: var(--hcm-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-chat-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hcm-accent);
    color: #ffffff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.hero-chat-send-btn:hover {
    transform: scale(1.08);
}

/* Floating Lead Capture Confirmation Toast */
.hero-chat-toast,
.lead-captured-toast,
.floating-metric-card {
    position: absolute;
    bottom: -18px;
    right: 4%;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    max-width: 92%;
    padding: 0.75rem 1rem;
    background: var(--hcm-surface);
    border: 1px solid var(--hcm-success-border);
    border-radius: 14px;
    box-shadow: 0 16px 36px -6px rgba(16, 185, 129, 0.22), 0 6px 16px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: hcm-toast-float 4.5s ease-in-out infinite;
    pointer-events: auto;
    box-sizing: border-box;
}

@keyframes hcm-toast-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.hero-chat-toast__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #10b981;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.hero-chat-toast__content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hero-chat-toast__title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--hcm-text);
    line-height: 1.25;
}

.hero-chat-toast__sub {
    font-size: 0.7rem;
    color: var(--hcm-text-muted);
    line-height: 1.2;
    margin-top: 2px;
}

.hero-chat-toast__pulse {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #10b981;
    opacity: 0.5;
    animation: hcm-ping 2.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    pointer-events: none;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 968px) {
    .hero-chat-simulation,
    .hero-preview-wrapper {
        min-height: auto;
        padding-bottom: 2rem;
    }

    .hero-chat-card,
    .chat-mockup-card {
        max-width: 440px;
    }

    .hero-chat-toast,
    .lead-captured-toast,
    .floating-metric-card {
        position: relative;
        bottom: auto;
        right: auto;
        left: auto;
        margin-top: -12px;
        width: 90%;
        max-width: 420px;
    }
}

/* 3. Neutralize absolute overflow elements on mobile */
@media (max-width: 768px) {
  .hero-preview-wrapper {
    width: 100% !important;
    padding: 0 12px !important;
    margin: 0 auto !important;
  }
  .chat-mockup-card,
  .hero-chat-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  /* Neutralize floating badge/toast popping outside screen */
  .floating-metric-card,
  .lead-captured-toast,
  .hero-chat-toast {
    left: 0 !important;
    right: 0 !important;
    margin: 10px auto 0 auto !important;
    max-width: calc(100% - 24px) !important;
    position: relative !important;
    transform: none !important;
  }
  .hero-chat-orbit {
    inset: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    filter: blur(18px);
  }
}

@media (max-width: 640px) {
    /* 1. Chat Mockup Outer Container */
    .hero-preview-wrapper,
    .hero-chat-simulation,
    .home-hero-visual {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 8px !important;
        box-sizing: border-box !important;
        margin: 0 auto !important;
    }

    .hero-chat-card,
    .chat-mockup-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        border-radius: 18px;
    }

    .chat-header,
    .hero-chat-header,
    .chat-body,
    .hero-chat-body,
    .chat-input-bar,
    .hero-chat-input-bar,
    .hero-chat-footer {
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    /* 2. Suggestion Pills Row (Enable clean flex-wrap or touch scroll) */
    .chat-suggestion-pills,
    .hero-chat-chips,
    .chat-mockup-card .suggestion-row,
    .chat-mockup-card [class*="pills"],
    .chat-mockup-card [class*="tags"],
    .chat-mockup-card [class*="chips"] {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .chat-mockup-card [class*="pills"] button,
    .chat-mockup-card [class*="tags"] span,
    .chat-mockup-card .pill-btn,
    .hero-chat-chip,
    .chat-mockup-card [class*="chip"] {
        font-size: 11px !important;
        padding: 4px 8px !important;
        white-space: nowrap !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 3. Appointment Confirmation Box Inside Bubble */
    .appointment-card-preview,
    .hero-chat-appt-card,
    .chat-mockup-card [class*="appointment"],
    .chat-mockup-card [class*="appt"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Ensure the header row inside the appointment box stacks cleanly */
    .chat-mockup-card [class*="appointment"] > div:first-child,
    .chat-mockup-card [class*="appt"] > div:first-child,
    .hero-chat-appt-card__header {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        justify-content: space-between !important;
    }

    .chat-mockup-card [class*="badge"],
    .chat-mockup-card [class*="status"],
    .hero-chat-appt-card__badge {
        font-size: 10px !important;
        max-width: 100% !important;
        white-space: normal !important;
        text-align: right !important;
        line-height: 1.25 !important;
    }

    .hero-chat-appt-card__grid {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    /* 4. Chat Input Bar */
    .chat-input-bar input,
    .chat-input-bar span,
    .hero-chat-input-bar input,
    .hero-chat-input-bar span,
    .hero-chat-input-placeholder {
        min-width: 0 !important;
        font-size: 11px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .hero-chat-body {
        padding: 0.85rem 0.85rem;
        max-height: 340px;
    }

    .hero-chat-bubble {
        max-width: 88%;
        font-size: 0.8125rem;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* 5. Floating Toast Notification at bottom */
    .lead-captured-toast,
    .floating-metric-card,
    .hero-chat-toast {
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        margin: 12px auto 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 0.65rem 0.85rem;
        transform: none !important;
    }

    .hero-chat-toast__title {
        font-size: 0.77rem;
    }

    .hero-chat-toast__sub {
        font-size: 0.66rem;
    }
}

@media (max-width: 480px) {
    .hero-preview-wrapper,
    .hero-chat-simulation {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 10px !important;
        margin: 0 auto !important;
    }

    .hero-chat-card,
    .chat-mockup-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .hero-chat-toast,
    .lead-captured-toast,
    .floating-metric-card {
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        margin: 12px auto 0 auto !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        transform: none !important;
    }
}

@media (max-width: 400px) {
    .hero-chat-header {
        padding: 0.75rem 0.75rem;
        gap: 0.5rem;
    }

    .hero-chat-header__name {
        font-size: 0.9rem;
    }

    .hero-chat-status-pill {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    .hero-chat-footer {
        padding: 0.65rem 0.75rem 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-chat-toast {
        animation: none !important;
    }
    .hero-chat-avatar__pulse::after,
    .hero-chat-toast__pulse {
        animation: none !important;
    }
}
