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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    position: relative;
}

/* Prevent zoom on input focus for mobile */
@viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 1.0;
    user-scalable: no;
}

@-ms-viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 1.0;
    user-scalable: no;
}

/* Prevent zoom on input focus */
input, textarea, select {
    font-size: 16px !important; /* Prevents iOS zoom */
    transform: scale(1) !important;
    max-height: 44px !important; /* Minimum touch target size */
}

/* Main page content */
.main-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.hero-section {
    text-align: center;
    max-width: 600px;
}

.hero-section h1 {
    font-size: 3rem;
    color: #000000;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-section > p {
    font-size: 1.2rem;
    color: #666666;
    margin-bottom: 2rem;
}

.cta-section {
    margin-top: 2rem;
}

.cta-section p {
    font-size: 1.1rem;
    color: #333333;
    margin-bottom: 0.5rem;
}

.sub-text {
    font-size: 0.9rem !important;
    color: #999999 !important;
}

/* Floating Chat Button */
.chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.chat-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(255, 107, 53, 0.5);
}

.chat-toggle.hidden {
    display: none;
}

/* Chat Container */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 450px;
    height: 700px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.chat-container.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    background: #000000;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.header-content h1 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.header-content p {
    font-size: 0.85rem;
    opacity: 0.8;
    margin: 2px 0 0 0;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages Area */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-size: 15px;
    line-height: 1.6;
}

.message {
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
    margin-bottom: 12px;
}

.user-message {
    align-items: flex-end;
}

.bot-message {
    align-items: flex-start;
}

.message-content {
    max-width: 85%;
    padding: 16px 20px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
    position: relative;
}

.user-message .message-content {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #333333;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ENHANCED: Thinking Message - More Visible with Better Design */
.thinking-message {
    align-items: flex-start !important;
}

.thinking-message .message-content {
    background: linear-gradient(135deg, #fff5f0 0%, #ffe8d6 100%) !important;
    border: 2px solid #ff6b35 !important;
    color: #333333 !important;
    font-style: normal !important;
    padding: 20px !important;
    max-width: 95% !important;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.25) !important;
    border-radius: 18px !important;
    position: relative !important;
    animation: thinking-pulse 2s ease-in-out infinite !important;
}

.thinking-container {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    justify-content: flex-start !important;
}

.thinking-spinner {
    width: 28px !important;
    height: 28px !important;
    border: 4px solid #ffe0cc !important;
    border-top: 4px solid #ff6b35 !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
    flex-shrink: 0 !important;
}

.thinking-text {
    font-weight: 600 !important;
    font-size: 15px !important;
    color: #333333 !important;
    flex: 1 !important;
}

/* NEW: Typing Indicator for Streaming Messages */
.typing-indicator {
    display: inline-block;
    margin-left: 10px;
    color: #ff6b35;
    font-weight: bold;
    font-size: 18px;
    animation: typing-dots 1.5s ease-in-out infinite;
    letter-spacing: 2px;
}

@keyframes typing-dots {
    0%, 20% { 
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% { 
        opacity: 1;
        transform: scale(1.1);
    }
    80%, 100% { 
        opacity: 0.3;
        transform: scale(0.8);
    }
}

/* Alternative: Streaming Cursor */
.streaming-cursor {
    display: inline-block;
    width: 3px;
    height: 18px;
    background: #ff6b35;
    animation: blink 1.2s infinite;
    margin-left: 4px;
    border-radius: 2px;
}

/* Enhanced Thinking Pulse Animation */
@keyframes thinking-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 107, 53, 0.25);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35);
    }
}

/* Ensure proper paragraph spacing and line breaks */
.bot-message .message-content {
    background: white;
    color: #333333;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: pre-line; /* This preserves line breaks and spacing */
    line-height: 1.6;
}

.bot-message .message-content p {
    margin: 0 0 15px 0;
}

.bot-message .message-content p:last-child {
    margin-bottom: 0;
}

/* Handle emoji spacing */
.bot-message .message-content .emoji-section {
    margin: 12px 0;
}

/* Better section spacing */
.bot-message .message-content > div {
    margin: 10px 0;
}

/* Handle line breaks properly */
.message-content br {
    line-height: 1.8;
}

/* Better list styling */
.bot-message .message-content ul {
    margin: 15px 0;
    padding-left: 0;
}

.bot-message .message-content li {
    margin: 8px 0;
    padding-left: 20px;
    position: relative;
    list-style: none;
}

.bot-message .message-content li:before {
    content: "•";
    color: #ff6b35;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.message-time {
    font-size: 0.75rem;
    color: #999999;
    margin-top: 6px;
    padding: 0 4px;
}

/* Priority Service Highlighting */
.priority-service {
    background: linear-gradient(135deg, #fff5f0 0%, #ffe8d6 100%);
    border-left: 4px solid #ff6b35;
    padding: 4px 8px;
    border-radius: 0 6px 6px 0;
    margin: 2px 0;
    display: inline-block;
}

.priority-service strong {
    color: #d63031;
    font-weight: 600;
}

/* Streaming Message Enhancement */
.streaming-message .message-content {
    position: relative;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%) !important;
    border: 2px solid #007bff !important;
    animation: streaming-pulse 1.8s ease-in-out infinite !important;
}

@keyframes streaming-pulse {
    0%, 100% { 
        border-color: #007bff;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    }
    50% { 
        border-color: #0056b3;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    }
}

/* Input Container */
.input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e5e5;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: #f8f8f8;
    border-radius: 25px;
    padding: 10px;
}

#message-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 15px;
    font-size: 16px !important; /* Prevent iOS zoom */
    resize: none;
    min-height: 44px !important; /* Better touch target */
    max-height: 100px;
    font-family: inherit;
    line-height: 1.4;
    transform: none !important;
}

#message-input::placeholder {
    color: #999999;
}

#send-button {
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#send-button:hover:not(:disabled) {
    background: #f7931e;
    transform: scale(1.05);
}

#send-button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Links */
.bot-message .message-content a {
    color: #ff6b35;
    text-decoration: none;
    font-weight: 500;
}

.bot-message .message-content a:hover {
    text-decoration: underline;
    color: #f7931e;
}

/* Connection Status */
.connection-status {
    font-size: 0.75rem;
    opacity: 0.8;
}

.connection-status.offline {
    color: #f44336;
}

.connection-status.online {
    color: #4caf50;
}

/* Error Messages */
.error-message {
    background: #ffebee !important;
    border-left: 4px solid #f44336 !important;
    color: #c62828 !important;
    animation: error-shake 0.5s ease-in-out !important;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Scrollbar */
#chat-container::-webkit-scrollbar {
    width: 8px;
}

#chat-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

#chat-container::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 4px;
}

#chat-container::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Better Message Spacing */
.message-content {
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure clickable links */
.message-content a {
    color: #ff6b35;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.message-content a:hover {
    color: #f7931e;
    text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        height: -webkit-fill-available;
        border-radius: 0;
        border: none;
        transform: none !important;
        transition: transform 0.3s ease !important;
    }
    
    /* Adjust chat container when keyboard is visible */
    .chat-container.keyboard-visible {
        height: 100vh !important;
        transform: translateY(0) !important;
    }
    
    .chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 20px;
    }
    
    .chat-header {
        border-radius: 0;
        padding: 15px !important;
    }
    
    .input-container {
        border-radius: 0;
        padding: 15px;
        position: relative;
        z-index: 1002;
    }
    
    /* Better message area for mobile */
    #chat-container {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .message-content {
        max-width: 90% !important;
        padding: 12px 16px !important;
    }
    
    .input-wrapper {
        padding: 8px;
        border-radius: 20px;
    }
    
    #message-input {
        font-size: 16px !important;
        min-height: 44px !important;
        padding: 12px 15px !important;
        line-height: 1.4 !important;
    }
    
    #send-button {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .thinking-spinner {
        width: 24px !important;
        height: 24px !important;
        border-width: 3px !important;
    }
    
    .typing-indicator {
        font-size: 16px;
        margin-left: 8px;
    }
    
    /* Prevent body scroll when chat is open on mobile */
    body.chat-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 1.8rem;
    }
    
    .hero-section > p {
        font-size: 1rem;
    }
    
    .message-content {
        max-width: 95% !important;
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
    
    .input-container {
        padding: 12px !important;
    }
    
    .input-wrapper {
        padding: 6px !important;
    }
    
    #message-input {
        padding: 10px 12px !important;
        font-size: 16px !important; /* Maintain 16px to prevent zoom */
    }
    
    .typing-indicator {
        font-size: 14px;
        margin-left: 6px;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .chat-container {
        height: 100vh;
        height: -webkit-fill-available;
    }
    
    #chat-container {
        height: 100%;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    #message-input {
        font-size: 16px !important;
    }
}

/* Android Chrome specific fixes */
@supports (not (-webkit-touch-callout: none)) {
    .chat-container {
        height: 100vh;
    }
}


/* Mobile Responsive - SIMPLIFIED VERSION */
/* Mobile Responsive - BOTTOM ALIGNED */
/* Mobile Responsive - NO GAP VERSION */
@media (max-width: 768px) {
    .chat-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        height: 100vh; /* Full screen but positioned at bottom */
        border-radius: 16px 16px 0 0;
        border: none;
        transform: translateY(100%); /* Start hidden below screen */
        transition: transform 0.3s ease;
        display: none;
        flex-direction: column;
    }
    
    .chat-container.active {
        display: flex;
        transform: translateY(0); /* Slide up from bottom */
    }
    
    .chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 20px;
        z-index: 1001;
    }
    
    .chat-header {
        border-radius: 16px 16px 0 0;
        flex-shrink: 0;
    }
    
    .input-container {
        border-radius: 0;
        padding: 15px;
        background: white;
        border-top: 1px solid #e5e5e5;
        flex-shrink: 0;
    }
    
    #chat-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 15px;
        min-height: 0; /* Important for flexbox */
    }
    
    /* When keyboard is visible - NO GAP */
    .chat-container.keyboard-open {
        height: auto;
        max-height: 100vh;
    }
    
    .chat-container.keyboard-open #chat-container {
        flex: 1;
        overflow-y: auto;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .thinking-spinner {
        width: 24px !important;
        height: 24px !important;
        border-width: 3px !important;
    }
    
    .typing-indicator {
        font-size: 16px;
        margin-left: 8px;
    }
    
    .message-content {
        max-width: 90% !important;
        padding: 12px 16px !important;
    }
}

/* For very small screens */
@media (max-width: 480px) {
    .chat-container {
        border-radius: 12px 12px 0 0;
    }
    
    .chat-header {
        border-radius: 12px 12px 0 0;
        padding: 15px !important;
    }
    
    .input-container {
        padding: 12px;
    }
    
    #message-input {
        padding: 12px 15px !important;
        font-size: 16px !important;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
    }
    
    .hero-section > p {
        font-size: 1rem;
    }
    
    .message-content {
        max-width: 95% !important;
        padding: 10px 14px !important;
        font-size: 14px;
    }
    
    .typing-indicator {
        font-size: 14px;
        margin-left: 6px;
    }
}
