/* ===========================
   Chat Flow UI
   =========================== */

.chat-wrapper {
    width: 100%;
    height: 100dvh;
    background: var(--bg);
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.chat-container {
    width: 100%;
    max-width: 470px;
    height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--container-bg);
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    flex-shrink: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 16px 20px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(232, 160, 176, 0.3);
    flex-shrink: 0;
}

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

.chat-header-info h3 {
    font-size: 15px;
    font-weight: 900;
    color: white;
    letter-spacing: -0.02em;
}

.chat-header-info p {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Message bubbles */
.message {
    display: flex;
    gap: 8px;
    max-width: 90%;
    animation: msgFadeIn 0.4s ease-out;
}

.message.ai {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-top: 2px;
    border: 1.5px solid rgba(232, 160, 176, 0.25);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.msg-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.6;
    font-weight: 500;
}

.message.ai .msg-bubble {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    border-bottom-left-radius: 6px;
}

.message.user .msg-bubble {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: white;
    border-bottom-right-radius: 6px;
}

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

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    align-self: flex-start;
    animation: msgFadeIn 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots .typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dots .typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Action Panel (slide-up) */
.action-panel {
    flex-shrink: 0;
    background: rgba(10, 10, 10, 0.85);
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.06), transparent);
    backdrop-filter: blur(40px);
    border-top: 0px solid rgba(255,255,255,0.12);
    padding: 0 20px;
    border-radius: 40px 40px 0 0;
    box-shadow: 0 -20px 50px rgba(0,0,0,0.5);
    z-index: 20;
    
    /* Animation properties */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.action-panel.visible {
    max-height: 600px;
    padding-top: 20px;
    padding-bottom: 32px;
    border-top-width: 1px;
    opacity: 1;
}

/* iOS-style handle bar */
.action-handle {
    width: 48px;
    height: 5px;
    background: rgba(255,255,255,0.15);
    border-radius: 99px;
    margin: 0 auto 24px;
}

/* Option buttons (multiple choice) */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    width: 100%;
    background: rgba(255,255,255,0.08);
    height: 56px;
    border-radius: 16px;
    text-align: left;
    padding: 0 20px;
    color: white;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
}

.option-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(192, 80, 110, 0.3);
}

.option-btn:active {
    transform: scale(0.96);
}

/* Glow Border Button Animation */
.glow-border-btn {
    position: relative;
    overflow: hidden;
    background: transparent !important;
    border: none !important;
    padding: 2px !important;
}

.glow-border-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 0%, transparent 60%, rgba(232, 160, 176, 1) 80%, rgba(192, 80, 110, 1) 100%);
    animation: rotateGlow 3s linear infinite;
    z-index: 0;
}

@keyframes rotateGlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.glow-border-btn .btn-text {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 14px;
    padding: 0 18px;
    z-index: 1;
    transition: background 0.2s ease;
}

.glow-border-btn:hover .btn-text {
    background: #1d0f14;
}

/* Text Input Bar (iMessage style) */
.input-bar {
    flex-shrink: 0;
    padding: 10px 16px 28px;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: none;
    z-index: 25;
    gap: 10px;
    align-items: center;
}

.input-bar.visible {
    display: flex;
}

.input-glow-wrapper {
    flex: 1;
    position: relative;
    border-radius: 22px;
    padding: 1px;
    overflow: hidden;
    background: transparent;
}

.input-glow-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 0%, transparent 60%, rgba(232, 160, 176, 1) 80%, rgba(192, 80, 110, 1) 100%);
    animation: rotateGlow 3s linear infinite;
    z-index: 0;
}

.input-glow-wrapper input {
    position: relative;
    width: 100%;
    height: 44px;
    border-radius: 21px;
    background: #000;
    border: none;
    padding: 0 18px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    z-index: 1;
}

.input-glow-wrapper input::placeholder {
    color: rgba(255,255,255,0.25);
}

.input-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.input-send-btn:hover {
    background: var(--accent-dark);
    transform: scale(1.05);
}

.input-send-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.input-skip-btn {
    height: 44px;
    padding: 0 16px;
    border-radius: 22px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.4);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s;
}

.input-skip-btn:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.6);
}

/* Final CTA button */
.final-cta-btn {
    width: 100%;
    height: 64px;
    border-radius: 20px;
    background: white;
    color: black;
    font-weight: 900;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 0 30px rgba(255,255,255,0.15);
}

.final-cta-btn:active {
    transform: scale(0.96);
}

/* Hidden state */
.hidden { display: none !important; }
