/* ==========================================================================
   CSS VARIABLES & GLOBAL RESET
   ========================================================================== */
:root {
    --bg-main: #f4f8fb;
    --card-bg: #ffffff;
    --text-navy: #152c4a;
    --text-teal: #0d8a8a;
    --text-muted: #6b7280;
    --border-light: #e5e7eb;
}

body {
    background-color: var(--bg-main);
    color: var(--text-navy);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* ==========================================================================
   TYPOGRAPHY & UTILITIES
   ========================================================================== */
.text-navy { color: var(--text-navy) !important; }
.text-teal { color: var(--text-teal) !important; }
.tracking-tight { letter-spacing: -0.02em; }

.main-title {
    font-size: clamp(2rem, 3.5vw, 2.8rem);
    line-height: 1.25;
}

/* ==========================================================================
   HEADER & FOOTER (REASSURANCE)
   ========================================================================== */
.main-header {
    background: var(--card-bg);
}

.logo-icon {
    color: var(--header-logo-color);
}

.benefit-card {
    padding: 10px;
}

.benefit-icon {
    font-size: 1.6rem;
    color: var(--text-muted);
}

/* ==========================================================================
   SWIPER CAROUSEL ENGINE
   ========================================================================== */
.swiper {
    width: 100%;
    padding-top: 20px;
    padding-bottom: 40px;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    
    /* Hardware-accelerated CSS mask creates a smooth alpha gradient on X-axis edges */
    -webkit-mask-image: linear-gradient(to right, transparent, black 50px, black calc(100% - 50px), transparent);
    mask-image: linear-gradient(to right, transparent, black 50px, black calc(100% - 50px), transparent);
}

.swiper.is-visible {
    opacity: 1;
}

.swiper-slide {
    width: 290px;
    height: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Static Flat Card (All CSS animations/transitions disabled for mobile performance) --- */
.agent-card {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 15px rgba(21, 44, 74, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 24px;
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.swiper-slide-active .agent-card {
    border-color: hsl(var(--agent-hue), 60%, 75%);
    box-shadow: 0 25px 40px rgba(21, 44, 74, 0.08);
}

/* ==========================================================================
   AGENT CARD INTERNALS
   ========================================================================== */
.agent-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    background-color: hsl(var(--agent-hue), 30%, 90%);
    margin-bottom: 0px;
    width: 125px;
    height: 125px;
    border:5px solid transparent;
}

.swiper-slide-active .agent-avatar {
    border-color: hsl(var(--agent-hue), 60%, 75%);
}

.agent-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    color: hsl(var(--agent-hue), 70%, 40%);
    font-size: 0.9rem;
    transform: translateY(-12px);
    z-index: 2;
}

.swiper-slide-active .agent-icon-wrapper {
    border-color: hsl(var(--agent-hue), 60%, 75%);
}

.agent-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-navy);
    margin-bottom: 4px;
    margin-top: -5px;
}

.agent-role {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: hsl(var(--agent-hue), 60%, 45%);
    margin-bottom: 15px;
}

.agent-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Dynamic Buttons --- */
.chat-btn {
    width: 100%;
    background: hsl(var(--agent-hue), 50%, 97%);
    border: 1px solid hsl(var(--agent-hue), 50%, 90%);
    color: hsl(var(--agent-hue), 70%, 40%);
    border-radius: 30px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: auto;
}

.swiper-slide-active .chat-btn {
    background: hsl(var(--agent-hue), 70%, 40%);
    border: none;
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

/* ==========================================================================
   SWIPER CONTROLS OVERRIDES
   ========================================================================== */
.custom-nav-arrow {
    color: var(--text-navy) !important;
    background: #ffffff;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    margin-top: -22px;
}

.custom-nav-arrow:after {
    font-size: 1.2rem !important;
    font-weight: bold;
}

.swiper-button-prev { 
    left: 20px !important; 
}
.swiper-button-next { 
    right: 20px !important; 
}

.swiper-pagination {
    position: relative !important;
    bottom: 0 !important;
}

.swiper-pagination-bullet {
    background: #cbd5e1 !important;
    opacity: 1 !important;
    width: 8px !important;
    height: 8px !important;
    transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
    background: var(--text-teal) !important;
    width: 24px !important;
    border-radius: 4px !important;
}

/* ==========================================================================
   MOBILE VIEWPORT OPTIMIZATIONS (Pulls content above the fold)
   ========================================================================== */
@media (max-width: 767.98px) {
    header {
        padding: 10px 15px !important;
        background:white;
        box-shadow:0 0 15px rgba(0,0,0,0.2);
        margin-bottom:10px;
    }
    header .fs-2 {
        font-size: 1.5rem !important;
    }
    header .fs-5 {
        font-size: 1rem !important;
    }
    
    .main-title {
        font-size: clamp(1.05rem, 5vw, 1.4rem); 
        margin-top: 8px !important;
        margin-bottom: 4px !important;
        padding: 0 5px;
    }

    .secondary-title { 
        display: none;
    }

    .swiper {
        padding-top: 10px;
        padding-bottom: 25px;
    }
    .swiper-slide {
        width: 260px; /* Slimmer cards on mobile */
        height: 410px;
    }
    .agent-card {
        padding: 20px 16px;
    }
    .agent-name {
        font-size: 1.2rem;
    }
    .agent-desc {
        font-size: 0.8rem;
        margin-bottom: 10px;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
    .custom-nav-arrow {
        display: none !important; /* Hide arrows on small screens, swipe is native */
    }
}

/* ==========================================================================
   MODAL LAYOUT (Strict Viewport Constraint)
   ========================================================================== */
@media (min-width: 576px) {
    .custom-fullscreen-dialog {
        max-width: 95vw !important;
        width: 95vw;
        height: 96dvh !important;
        margin: 2dvh auto !important;
        display: flex;
        flex-direction: column;
    }
    
    .custom-fullscreen-dialog .medical-modal {
        height: 100% !important;
        max-height: 100% !important;
        display: flex;
        flex-direction: column;
        overflow: hidden !important;
        border-radius: 24px;
        border: none;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    }

    .custom-fullscreen-dialog .modal-body {
        flex: 1 1 auto;
        overflow-y: auto !important;
        min-height: 0;
    }
}

@media (max-width: 575.98px) {
    .custom-fullscreen-dialog {
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        display: flex;
        flex-direction: column;
    }
    
    .custom-fullscreen-dialog .medical-modal {
        height: 100% !important;
        border-radius: 0 !important;
        border: none;
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
    }
    
    .custom-fullscreen-dialog .modal-body {
        flex: 1 1 auto;
        overflow-y: auto !important;
        min-height: 0;
    }
}

/* ==========================================================================
   CHAT SYSTEM & BUBBLES
   ========================================================================== */
.chat-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid hsl(var(--agent-hue), 70%, 50%);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    display: inline-block;
}

.bg-slate {
    background-color: #f8fafc;
}

.chat-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.chat-bubble {
    width: fit-content;
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 4px;
    word-wrap: break-word;
    animation: bubbleEnter 0.25s ease-out forwards;
}

.user-bubble {
    align-self: flex-end;
    background: hsl(var(--agent-hue), 70%, 48%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.bot-bubble {
    align-self: flex-start;
    background: #ffffff;
    color: var(--text-navy);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-light);
}

/* ==========================================================================
   INTERACTIVE CHOICES
   ========================================================================== */
.choices-container {
    align-self: flex-start;
    width: 100%;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.choice-btn-item {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 12px 16px;
    text-align: left;
    width: 100%;
}

.choice-btn-item:hover:not(:disabled) {
    border-color: hsl(var(--agent-hue), 70%, 50%);
    background: hsl(var(--agent-hue), 60%, 98%);
}

.choice-title {
    font-weight: 600;
    color: hsl(var(--agent-hue), 75%, 35%);
    display: block;
    font-size: 0.9rem;
}

.choice-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* ==========================================================================
   INPUTS & ANIMATIONS (Optimized GPU stack)
   ========================================================================== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    align-self: flex-start;
    background: #ffffff;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-light);
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: hsl(var(--agent-hue), 70%, 50%);
    border-radius: 50%;
    will-change: transform;
    transform: translateZ(0);
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

.medical-input {
    background-color: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    color: var(--text-navy) !important;
    border-radius: 30px;
    padding: 12px 55px 12px 20px;
}

.medical-input:focus {
    border-color: hsl(var(--agent-hue), 70%, 50%) !important;
    box-shadow: 0 0 0 3px hsl(var(--agent-hue), 70%, 93%) !important;
}

.send-medical-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
}

@keyframes bubbleEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale3d(0, 0, 1); }
    40% { transform: scale3d(1, 1, 1); }
}