/* Modern WhatsApp-Style Chatbot - Enhanced UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.chatbot-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header - Enhanced */
.chat-header {
    background: linear-gradient(135deg, #00796B 0%, #004D40 100%);
    color: white;
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bot-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #26A69A, #80CBC4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.header-info h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.status {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.95;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FF6B6B;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}

.status-dot.online {
    background: #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.8);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.header-badge {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 0.6rem 1.1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Chat Messages - Enhanced */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem;
    background: #ECE5DD;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #26A69A, #00796B);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00796B, #004D40);
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.message.bot {
    flex-direction: row;
    align-self: flex-start;
}

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #26A69A, #80CBC4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message-bubble {
    padding: 0.85rem 1.1rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    position: relative;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #DCF8C6 0%, #C8E6C9 100%);
    border-bottom-right-radius: 0.25rem;
    max-width: fit-content;
}

.message.bot .message-bubble {
    background: white;
    border-bottom-left-radius: 0.25rem;
    max-width: 70%;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.welcome .message-bubble {
    background: linear-gradient(135deg, #00796B, #004D40);
    color: white;
    max-width: 85%;
    box-shadow: 0 4px 15px rgba(0, 121, 107, 0.3);
}

.message.welcome ul {
    color: white;
    margin-top: 0.5rem;
}

.message-content {
    margin-bottom: 0.35rem;
    line-height: 1.55;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.45);
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    font-weight: 500;
}

/* Typing Indicator - Enhanced */
.typing-indicator-container {
    display: flex;
    gap: 0.75rem;
    padding: 0 1.75rem 1rem;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.typing-bubble {
    background: white;
    padding: 0.85rem 1.1rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.typing-indicator {
    display: flex;
    gap: 0.35rem;
}

.typing-indicator span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: linear-gradient(135deg, #26A69A, #00796B);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.6;
    }

    30% {
        transform: translateY(-12px);
        opacity: 1;
    }
}

/* Chat Input - Enhanced */
.chat-input-area {
    padding: 1rem 1.75rem 1.25rem;
    background: #F5F5F5;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-input-container {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
    background: white;
    border-radius: 2rem;
    padding: 0.6rem 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    transition: all 0.3s;
}

.chat-input-container:focus-within {
    border-color: #00796B;
    box-shadow: 0 4px 12px rgba(0, 121, 107, 0.15);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    max-height: 100px;
    font-size: 0.98rem;
    resize: none;
    padding: 0.35rem 0;
    color: #333;
}

#messageInput::placeholder {
    color: #9E9E9E;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00796B, #004D40);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 121, 107, 0.3);
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #004D40, #00251A);
    transform: scale(1.08);
    box-shadow: 0 5px 15px rgba(0, 121, 107, 0.4);
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-footer {
    margin-top: 0.65rem;
    text-align: center;
    font-size: 0.75rem;
    color: #757575;
    font-weight: 500;
}

.input-footer i {
    color: #00796B;
    margin-right: 0.35rem;
}

/* Connection Toast - Enhanced */
.connection-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: #C62828;
    padding: 1rem 1.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 8px 20px rgba(198, 40, 40, 0.25);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    font-weight: 600;
    border-left: 4px solid #C62828;
}

/* ===================================
   CTA Container (Desktop only)
   =================================== */
.cta-container {
    position: fixed;
    bottom: 110px;
    right: 90px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    animation: cta-float 3s ease-in-out infinite;
}

@keyframes cta-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.cta-text {
    font-weight: 600;
    color: #3498db;
    background: white;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 5px;
    white-space: nowrap;
}

.arrow-svg {
    width: 50px;
    height: 50px;
    fill: #3498db;
    transform: rotate(-45deg);
}

@keyframes pulse-point {
    0% { transform: translate(0, 0); }
    50% { transform: translate(10px, 10px); }
    100% { transform: translate(0, 0); }
}

/* ===================================
   RESPONSIVE: Mobile (≤ 768px)
   Inline layout: [ Input + Send ] [ Vapi Widget ]
   =================================== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .chatbot-container {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .chat-header {
        padding: 0.85rem 1rem;
    }

    .bot-avatar {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }

    .header-info h1 {
        font-size: 1.05rem;
    }

    .header-badge {
        padding: 0.4rem 0.75rem;
        font-size: 0.7rem;
    }

    .chat-messages {
        padding: 1rem;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .message-bubble {
        max-width: 85% !important;
    }

    .message-content {
        font-size: 0.88rem;
    }

    /* Vapi widget sits below the input area */
    .chat-input-area {
        padding: 0.6rem 0.75rem;
        padding-bottom: 85px;
    }

    .chat-input-container {
        padding: 0.35rem 0.35rem 0.35rem 0.85rem;
        border-radius: 1.5rem;
        align-items: center;
    }

    #messageInput {
        font-size: 0.9rem;
        padding: 0.35rem 0;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    /* Hide footer text on mobile — keeps bottom row clean */
    .input-footer {
        display: none;
    }

    /* Hide CTA on mobile — Vapi widget is already visible */
    .cta-container {
        display: none !important;
    }

    .typing-indicator-container {
        padding: 0 1rem 0.5rem;
    }

    .connection-toast {
        top: 0.75rem;
        font-size: 0.8rem;
        padding: 0.65rem 1rem;
    }
}

/* ===================================
   RESPONSIVE: Small phones (≤ 400px)
   =================================== */
@media (max-width: 400px) {
    .chat-header {
        padding: 0.65rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .bot-avatar {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .header-info h1 {
        font-size: 0.92rem;
    }

    .status {
        font-size: 0.7rem;
    }

    .header-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
    }

    .chat-messages {
        padding: 0.75rem;
        gap: 0.65rem;
    }

    .message-avatar {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }

    .message-bubble {
        padding: 0.6rem 0.85rem;
        max-width: 90% !important;
    }

    .message-content {
        font-size: 0.84rem;
        line-height: 1.5;
    }

    .message-time {
        font-size: 0.6rem;
    }

    .chat-input-area {
        padding: 0.5rem 0.4rem;
        padding-bottom: 65px;
    }

    .chat-input-container {
        padding: 0.3rem 0.3rem 0.3rem 0.7rem;
        gap: 0.3rem;
    }

    #messageInput {
        font-size: 0.85rem;
        padding: 0.3rem 0;
    }

    .send-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }
}

/* ===================================
   Landscape orientation fix
   =================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .chatbot-container {
        height: 100dvh;
        max-height: 100dvh;
    }

    .chat-header {
        padding: 0.5rem 0.75rem;
    }

    .bot-avatar {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .header-info h1 {
        font-size: 0.9rem;
    }

    .header-badge {
        display: none;
    }

    .chat-messages {
        padding: 0.5rem;
    }

    .chat-input-area {
        padding: 0.4rem 0.5rem;
        padding-bottom: 60px;
    }

    .cta-container {
        display: none !important;
    }
}

/* ===================================
   Accessibility: Reduced motion
   =================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
