/* Mobile Specific Styles */
body {
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    overflow: hidden; /* Prevent body scroll, handle in chat area */
    height: 100dvh;
    /* Handle safe areas for notched phones */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.mobile-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    background: #fff;
    position: relative;
}

/* Header */
.mobile-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
    flex-shrink: 0;
    min-height: 60px;
}

.mobile-mascot {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    padding: 2px;
    margin-right: 12px;
    border: 2px solid rgba(255,255,255,0.5);
}

.mascot-icon {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.header-info h1 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}

.status-badge {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.status-badge.online::before {
    content: '●';
    color: #4ade80;
    margin-right: 4px;
}

.desktop-link {
    margin-left: auto;
    text-decoration: none;
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Chat Area */
.mobile-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Reuse message styles but adjust for mobile */
.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 35px;
    height: 35px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    position: relative;
}

.ai-message .message-content {
    background: white;
    color: #1f2937;
    border-top-left-radius: 4px;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-top-right-radius: 4px;
}

/* Input Area */
.mobile-input-area {
    background: white;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)); /* Extra padding for home bar */
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

.mobile-voice-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-bottom: 5px;
}

.mobile-voice-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mobile-voice-btn.listening {
    background: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-status-text {
    font-size: 0.85rem;
    color: #6b7280;
}

.mobile-text-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

#textInput {
    flex: 1;
    padding: 12px 15px;
    border-radius: 25px;
    border: 1px solid #e5e7eb;
    font-size: 1rem;
    outline: none;
    background: #f9fafb;
    font-family: 'Kanit', sans-serif;
}

#textInput:focus {
    border-color: #667eea;
    background: white;
}

.mobile-send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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