* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    text-align: center;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.powered-by {
    color: #a0aec0;
    font-size: 0.8rem;
    font-style: italic;
}

.auth-bar .tool-button {
    border: 1px solid rgba(0,0,0,0.1);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    margin: 1rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease-out;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    margin-right: 0;
    margin-left: 1rem;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.message-content {
    flex: 1;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 80%;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.message-content p {
    line-height: 1.6;
    margin: 0 0 0.8rem 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* RTL Support for Persian Text */
.rtl-text {
    direction: rtl;
    text-align: right;
    font-family: 'Tahoma', 'Arial', sans-serif;
}

.rtl-text p {
    text-align: right;
}

.rtl-text h1, .rtl-text h2, .rtl-text h3 {
    text-align: right;
}

.rtl-text li {
    text-align: right;
    padding-right: 1rem;
    padding-left: 0;
}

.rtl-text li::before {
    right: 0;
    left: auto;
}

/* Text formatting styles */
.message-content strong {
    font-weight: 700;
    color: inherit;
}

.message-content em {
    font-style: italic;
    color: inherit;
}

.message-content .inline-code {
    background: #f1f3f4;
    color: #d73a49;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.85em;
    border: 1px solid #e1e4e8;
    direction: ltr;
    text-align: left;
}

.message-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem 0;
    color: inherit;
}

.message-content h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0.8rem 0 0.4rem 0;
    color: inherit;
}

.message-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.6rem 0 0.3rem 0;
    color: inherit;
}

.message-content li {
    margin: 0.3rem 0;
    padding-left: 1rem;
    position: relative;
}

.message-content li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.chat-input-container {
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

#messageInput {
    flex: 1;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    background: white;
    min-height: 50px;
    max-height: 120px;
}

#messageInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-button {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #718096;
}

#modelSelect {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.5rem;
    background: white;
    font-size: 0.9rem;
    outline: none;
}

.coding-tools {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.generated-image {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-top: 0.5rem;
}

.tool-button {
    width: 35px;
    height: 35px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: white;
    color: #667eea;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.tool-button:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.tool-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Voice Chat Styles */
.voice-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    animation: pulse 2s infinite;
}

.voice-btn:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
    transform: scale(1.05);
}

.voice-btn.active {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    animation: recording 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

@keyframes recording {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Chat History Styles */
#saveChatBtn, #loadChatBtn, #newChatBtn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
}

#saveChatBtn:hover, #loadChatBtn:hover, #newChatBtn:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: scale(1.05);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e5e5;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close:hover {
    color: #f0f0f0;
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-history-item:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.chat-history-info {
    flex: 1;
}

.chat-history-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.chat-history-date {
    font-size: 0.8rem;
    color: #6c757d;
}

.chat-history-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.chat-history-count {
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 500;
}

.chat-history-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-history-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-btn {
    background: #667eea;
    color: white;
}

.load-btn:hover {
    background: #5a6fd8;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
}

.empty-history {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.empty-history svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.voice-settings {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.voice-language-selector,
.voice-gender-selector {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.voice-language-selector label,
.voice-gender-selector label {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 500;
}

.voice-language-selector select,
.voice-gender-selector select {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    background: white;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.voice-language-selector select:focus,
.voice-gender-selector select:focus {
    border-color: #667eea;
}

.test-voice-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    width: 100%;
}

.test-voice-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: translateY(-1px);
}

.persian-test-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    font-family: 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
}

.persian-test-btn:hover {
    background: linear-gradient(135deg, #e55a5a 0%, #d4491a 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.voice-info-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.voice-info-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Code formatting styles - ChatGPT-like */
.code-block {
    background: #f7f7f8;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin: 1rem 0;
    overflow: hidden;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    direction: ltr !important;
    text-align: left !important;
    display: block;
    width: 100%;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f1f1;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e5e5;
}

.lang-badge {
    background: #007acc;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.copy-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
}

.copy-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    color: #374151;
    overflow-x: auto;
    background: transparent;
    direction: ltr !important;
    text-align: left !important;
    white-space: pre;
    word-wrap: normal;
}

/* Prism override to fit our theme */
pre[class*="language-"] {
    background: #f7f7f8 !important;
    border: 1px solid #e5e5e5;
    margin: 0;
}
code[class*="language-"] {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
}

.code-block code {
    color: #374151;
    background: transparent;
    font-family: inherit;
    direction: ltr !important;
    text-align: left !important;
    white-space: pre;
    word-wrap: normal;
}

/* Enhanced syntax highlighting colors - ChatGPT-like */
.keyword { 
    color: #d73a49; 
    font-weight: 600;
}
.string { 
    color: #032f62; 
}
.comment { 
    color: #6a737d; 
    font-style: italic;
}
.number { 
    color: #005cc5; 
    font-weight: 500;
}
.function { 
    color: #6f42c1; 
}
.class { 
    color: #e36209; 
    font-weight: 500;
}
.literal {
    color: #e36209;
    font-weight: 500;
}
.entity {
    color: #6f42c1;
    font-weight: 500;
}
.value {
    color: #005cc5;
    font-weight: 500;
}
.preprocessor {
    color: #d73a49;
    font-weight: 600;
}

/* Code blocks should always be left-aligned regardless of surrounding text */
.code-block {
    direction: ltr !important;
    text-align: left !important;
}

.code-block .code-header {
    flex-direction: row;
}

.code-block .lang-badge {
    margin-left: 0;
    margin-right: auto;
}

.code-block pre {
    direction: ltr !important;
    text-align: left !important;
}

.code-block code {
    direction: ltr !important;
    text-align: left !important;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
}

/* Code explanation styles */
.code-explanation {
    background: rgba(102, 126, 234, 0.1);
    border-left: 3px solid #667eea;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 0 8px 8px 0;
}

.code-explanation h4 {
    margin: 0 0 0.5rem 0;
    color: #667eea;
    font-size: 0.9rem;
}

.code-explanation p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.loading-indicator {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    gap: 1rem;
    animation: slideInUp 0.3s ease-out;
}

.loading-indicator.show {
    display: flex;
}

.loading-dots {
    display: flex;
    gap: 0.3rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Install Button Styles */
.install-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    animation: slideInRight 0.5s ease-out;
}

.install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design - Enhanced Mobile Experience */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        min-height: 100vh;
        overflow-x: hidden;
    }
    
    .container {
        margin: 0;
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        background: #f8fafc;
    }
    
    /* Enhanced Header */
    .header {
        padding: 0.8rem 1rem;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.2rem;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-weight: 700;
    }
    
    .header p {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
        line-height: 1.2;
        color: #64748b;
    }
    
    .powered-by {
        font-size: 0.6rem;
        opacity: 0.7;
        color: #94a3b8;
    }
    
    /* Enhanced Chat Container */
    .chat-container {
        flex: 1;
        margin: 0;
        border-radius: 0;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        box-shadow: none;
        overflow: hidden;
    }
    
    /* Enhanced Chat Messages */
    .chat-messages {
        flex: 1;
        padding: 1rem 0.8rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fafbfc;
    }
    
    .message {
        margin-bottom: 1rem;
        animation: fadeInUp 0.3s ease-out;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        margin-right: 0.8rem;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .user-message .message-avatar {
        margin-right: 0;
        margin-left: 0.8rem;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
    }
    
    .ai-message .message-avatar {
        background: linear-gradient(135deg, #f093fb, #f5576c);
        color: white;
    }
    
    .message-content {
        max-width: 85%;
        padding: 0.9rem 1.1rem;
        border-radius: 18px;
        font-size: 0.95rem;
        line-height: 1.4;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .user-message .message-content {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        margin-left: auto;
    }
    
    .ai-message .message-content {
        background: white;
        color: #1e293b;
    }
    
    .message-content p {
        margin-bottom: 0.6rem;
    }
    
    .message-content p:last-child {
        margin-bottom: 0;
    }
    
    /* Enhanced Input Area */
    .chat-input-container {
        padding: 1rem;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        position: sticky;
        bottom: 0;
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
    }
    
    .input-wrapper {
        flex-direction: row;
        align-items: flex-end;
        gap: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    #messageInput {
        flex: 1;
        min-height: 48px;
        max-height: 120px;
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
        border-radius: 24px;
        border: 2px solid rgba(0, 0, 0, 0.08);
        background: #f8fafc;
        resize: none;
        -webkit-appearance: none;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    #messageInput:focus {
        border-color: #667eea;
        background: white;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
        outline: none;
    }
    
    .send-button {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        flex-shrink: 0;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        border: none;
    }
    
    .send-button:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    }
    
    .send-button:disabled {
        opacity: 0.6;
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    /* Enhanced Model Selector */
    .model-selector {
        margin-bottom: 0.8rem;
        padding: 0.8rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .model-selector label {
        font-size: 0.8rem;
        font-weight: 600;
        color: #374151;
        margin-bottom: 0.4rem;
        display: block;
    }
    
    #modelSelect {
        width: 100%;
        padding: 0.7rem;
        border-radius: 12px;
        font-size: 0.85rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
        background: white;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.8rem center;
        background-size: 1.2em;
        padding-right: 2.8rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    /* Enhanced Coding Tools */
    .coding-tools {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
        gap: 0.6rem;
        margin-bottom: 0.8rem;
        padding: 0.8rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .tool-button {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        font-size: 0.8rem;
        border: 1px solid rgba(0, 0, 0, 0.08);
        background: white;
        color: #667eea;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .tool-button:active {
        transform: scale(0.95);
        background: #667eea;
        color: white;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    .tool-button:hover {
        background: #667eea;
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
    }
    
    /* Enhanced Voice Settings */
    .voice-settings {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
        padding: 0.8rem;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        margin-top: 0.5rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .voice-language-selector,
    .voice-gender-selector {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .voice-language-selector label,
    .voice-gender-selector label {
        font-size: 0.75rem;
        font-weight: 600;
        color: #374151;
        margin-bottom: 0.2rem;
    }
    
    .voice-language-selector select,
    .voice-gender-selector select {
        padding: 0.6rem;
        border-radius: 10px;
        font-size: 0.8rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
        background: white;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.6rem center;
        background-size: 1em;
        padding-right: 2.2rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    /* Enhanced Test Voice Buttons */
    .test-voice-btn {
        grid-column: 1 / -1;
        padding: 0.8rem;
        border-radius: 12px;
        font-size: 0.8rem;
        font-weight: 600;
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .test-voice-btn:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }
    
    .test-voice-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    }
    
    .persian-test-btn {
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
        color: white;
        font-family: 'Tahoma', 'Arial', sans-serif;
    }
    
    .voice-info-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }
    
    /* Enhanced Loading Indicator */
    .loading-indicator {
        bottom: 120px;
        left: 50%;
        transform: translateX(-50%);
        padding: 1rem 1.8rem;
        border-radius: 24px;
        font-size: 0.9rem;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
    }
    
    .loading-indicator p {
        font-size: 0.85rem;
        font-weight: 500;
        color: #374151;
    }
    
    /* Enhanced Install Button */
    .install-button {
        top: 15px;
        right: 15px;
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
        border-radius: 20px;
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
        z-index: 1000;
        font-weight: 600;
    }
    
    /* Enhanced Code Blocks */
    .code-block {
        margin: 0.8rem 0;
        border-radius: 12px;
        font-size: 0.8rem;
        line-height: 1.5;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .code-header {
        padding: 0.7rem 1rem;
        border-radius: 12px 12px 0 0;
        background: #f8f9fa;
        border-bottom: 1px solid #e9ecef;
    }
    
    .lang-badge {
        padding: 0.3rem 0.8rem;
        font-size: 0.7rem;
        border-radius: 8px;
        font-weight: 600;
    }
    
    .copy-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
        border-radius: 8px;
        min-width: 36px;
        min-height: 32px;
        border: 1px solid #d1d5db;
        background: white;
        color: #6b7280;
        transition: all 0.2s ease;
    }
    
    .copy-btn:hover {
        background: #f3f4f6;
        color: #374151;
        border-color: #9ca3af;
    }
    
    .code-block pre {
        padding: 1rem;
        font-size: 0.75rem;
        line-height: 1.4;
        margin: 0;
        background: #f8f9fa;
    }
    
    /* Enhanced Modal */
    .modal-content {
        margin: 5% auto;
        width: 95%;
        border-radius: 20px;
        max-height: 80vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }
    
    .modal-header {
        padding: 1.2rem 1.5rem;
        border-radius: 20px 20px 0 0;
        flex-shrink: 0;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
        font-weight: 600;
        margin: 0;
    }
    
    .close {
        font-size: 24px;
        padding: 0.5rem;
        border-radius: 50%;
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        color: white;
        transition: all 0.3s ease;
    }
    
    .close:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }
    
    .modal-body {
        padding: 1.2rem;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        background: #f8fafc;
    }
    
    .chat-history-item {
        padding: 1rem;
        border-radius: 16px;
        margin-bottom: 0.8rem;
        border: 1px solid rgba(0, 0, 0, 0.08);
        background: white;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .chat-history-item:active {
        transform: scale(0.98);
        background: #f8fafc;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
    
    .chat-history-title {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.3rem;
        color: #1e293b;
    }
    
    .chat-history-date {
        font-size: 0.75rem;
        color: #64748b;
        margin-bottom: 0.5rem;
    }
    
    .chat-history-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .chat-history-count {
        font-size: 0.7rem;
        color: #667eea;
        font-weight: 500;
    }
    
    .chat-history-actions {
        display: flex;
        gap: 0.5rem;
    }
    
    .chat-history-btn {
        padding: 0.5rem 1rem;
        border-radius: 10px;
        font-size: 0.75rem;
        font-weight: 500;
        min-width: 60px;
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        border: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .chat-history-btn:active {
        transform: scale(0.95);
    }
    
    .load-btn {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
    }
    
    .load-btn:hover {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    .delete-btn {
        background: linear-gradient(135deg, #e53e3e, #c53030);
        color: white;
    }
    
    .delete-btn:hover {
        box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
    }
    
    /* Enhanced Empty State */
    .empty-history {
        padding: 2rem 1rem;
        text-align: center;
        color: #64748b;
    }
    
    .empty-history svg {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
        opacity: 0.5;
        color: #94a3b8;
    }
    
    .empty-history p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        color: #64748b;
    }
    
    /* Enhanced RTL Support */
    .rtl-text {
        direction: rtl;
        text-align: right;
        font-family: 'Tahoma', 'Arial', sans-serif;
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .rtl-text p {
        text-align: right;
        margin-bottom: 0.6rem;
    }
    
    .rtl-text h1, .rtl-text h2, .rtl-text h3 {
        text-align: right;
        margin-bottom: 0.5rem;
    }
    
    .rtl-text li {
        text-align: right;
        padding-right: 1rem;
        padding-left: 0;
        margin-bottom: 0.3rem;
    }
    
    /* Enhanced Inline Code */
    .message-content .inline-code {
        padding: 0.2rem 0.5rem;
        font-size: 0.8rem;
        border-radius: 6px;
        background: #f1f5f9;
        color: #dc2626;
        border: 1px solid #e2e8f0;
        font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
        font-weight: 500;
    }
    
    /* Enhanced Headers */
    .message-content h1 {
        font-size: 1.3rem;
        margin: 0.8rem 0 0.4rem 0;
        font-weight: 700;
        color: inherit;
    }
    
    .message-content h2 {
        font-size: 1.1rem;
        margin: 0.6rem 0 0.3rem 0;
        font-weight: 600;
        color: inherit;
    }
    
    .message-content h3 {
        font-size: 1rem;
        margin: 0.5rem 0 0.3rem 0;
        font-weight: 600;
        color: inherit;
    }
    
    /* Enhanced Lists */
    .message-content li {
        margin: 0.4rem 0;
        padding-left: 1.2rem;
        line-height: 1.4;
        position: relative;
    }
    
    .message-content li::before {
        content: '•';
        position: absolute;
        left: 0;
        color: #667eea;
        font-weight: bold;
        font-size: 1.2em;
    }
    
    /* Enhanced Strong and Em */
    .message-content strong {
        font-weight: 700;
        color: inherit;
    }
    
    .message-content em {
        font-style: italic;
        color: inherit;
    }
    
    /* Prevent zoom on input focus for iOS */
    @media screen and (-webkit-min-device-pixel-ratio: 0) {
        #messageInput {
            font-size: 16px;
        }
    }
    
    /* Enhanced Scrollbar */
    .chat-messages::-webkit-scrollbar {
        width: 4px;
    }
    
    .chat-messages::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .chat-messages::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 2px;
    }
    
    .chat-messages::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }
    
    /* Enhanced Animations */
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translate(-50%, 20px);
        }
        to {
            opacity: 1;
            transform: translate(-50%, 0);
        }
    }
    
    /* Enhanced Pulse Animation */
    @keyframes pulse {
        0% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
        }
        70% {
            transform: scale(1.05);
            box-shadow: 0 0 0 20px rgba(102, 126, 234, 0);
        }
        100% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
        }
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.6rem 0.8rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
        margin-bottom: 0.2rem;
    }
    
    .header p {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
        line-height: 1.2;
    }
    
    .powered-by {
        font-size: 0.6rem;
        opacity: 0.7;
    }
    
    .chat-container {
        height: calc(100vh - 70px);
    }
    
    .chat-messages {
        padding: 0.8rem 0.6rem;
    }
    
    .message {
        margin-bottom: 0.8rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        margin-right: 0.6rem;
    }
    
    .user-message .message-avatar {
        margin-right: 0;
        margin-left: 0.6rem;
    }
    
    .message-content {
        max-width: 88%;
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
        line-height: 1.3;
        border-radius: 14px;
    }
    
    .message-content p {
        margin-bottom: 0.5rem;
    }
    
    /* Enhanced input area for small screens */
    .chat-input-container {
        padding: 0.6rem;
    }
    
    .input-wrapper {
        gap: 0.6rem;
        margin-bottom: 0.6rem;
    }
    
    #messageInput {
        min-height: 42px;
        max-height: 80px;
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
        border-radius: 21px;
    }
    
    .send-button {
        width: 42px;
        height: 42px;
    }
    
    /* Enhanced model selector for small screens */
    .model-selector {
        margin-bottom: 0.6rem;
        padding: 0.5rem;
        border-radius: 10px;
    }
    
    .model-selector label {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    #modelSelect {
        padding: 0.5rem;
        font-size: 0.8rem;
        border-radius: 6px;
    }
    
    /* Enhanced coding tools for small screens */
    .coding-tools {
        grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
        gap: 0.4rem;
        margin-bottom: 0.6rem;
        padding: 0.4rem;
        border-radius: 10px;
    }
    
    .tool-button {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 0.75rem;
    }
    
    /* Enhanced voice settings for small screens */
    .voice-settings {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 0.6rem;
        border-radius: 10px;
        margin-top: 0.4rem;
    }
    
    .voice-language-selector,
    .voice-gender-selector {
        gap: 0.2rem;
    }
    
    .voice-language-selector label,
    .voice-gender-selector label {
        font-size: 0.7rem;
        margin-bottom: 0.15rem;
    }
    
    .voice-language-selector select,
    .voice-gender-selector select {
        padding: 0.4rem;
        font-size: 0.75rem;
        border-radius: 6px;
    }
    
    /* Enhanced test voice buttons for small screens */
    .test-voice-btn {
        padding: 0.6rem;
        font-size: 0.75rem;
        min-height: 40px;
        border-radius: 8px;
    }
    
    /* Enhanced loading indicator for small screens */
    .loading-indicator {
        bottom: 90px;
        padding: 0.7rem 1.2rem;
        border-radius: 18px;
        font-size: 0.85rem;
    }
    
    .loading-indicator p {
        font-size: 0.8rem;
    }
    
    /* Enhanced install button for small screens */
    .install-button {
        top: 12px;
        right: 12px;
        padding: 7px 12px;
        font-size: 0.7rem;
        border-radius: 18px;
    }
    
    /* Enhanced code blocks for small screens */
    .code-block {
        margin: 0.6rem 0;
        border-radius: 8px;
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    .code-header {
        padding: 0.5rem 0.7rem;
        border-radius: 8px 8px 0 0;
    }
    
    .lang-badge {
        padding: 0.15rem 0.5rem;
        font-size: 0.65rem;
        border-radius: 4px;
    }
    
    .copy-btn {
        padding: 0.3rem;
        font-size: 0.65rem;
        border-radius: 4px;
        min-width: 28px;
        min-height: 28px;
    }
    
    .copy-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .code-block pre {
        padding: 0.7rem;
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    /* Enhanced modal for small screens */
    .modal-content {
        margin: 3% auto;
        width: 98%;
        border-radius: 14px;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 0.8rem 1rem;
        border-radius: 14px 14px 0 0;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .close {
        font-size: 20px;
        padding: 0.4rem;
        min-width: 36px;
        min-height: 36px;
    }
    
    .modal-body {
        padding: 0.8rem;
    }
    
    .chat-history-item {
        padding: 0.8rem;
        border-radius: 10px;
        margin-bottom: 0.6rem;
    }
    
    .chat-history-title {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }
    
    .chat-history-date {
        font-size: 0.7rem;
        margin-bottom: 0.4rem;
    }
    
    .chat-history-count {
        font-size: 0.65rem;
    }
    
    .chat-history-actions {
        gap: 0.4rem;
    }
    
    .chat-history-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
        min-width: 40px;
        min-height: 24px;
        border-radius: 5px;
    }
    
    /* Enhanced empty state for small screens */
    .empty-history {
        padding: 1.2rem 0.6rem;
    }
    
    .empty-history svg {
        width: 32px;
        height: 32px;
        margin-bottom: 0.6rem;
    }
    
    .empty-history p {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }
    
    /* Enhanced RTL support for small screens */
    .rtl-text {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .rtl-text p {
        margin-bottom: 0.4rem;
    }
    
    .rtl-text h1, .rtl-text h2, .rtl-text h3 {
        margin-bottom: 0.3rem;
    }
    
    .rtl-text li {
        padding-right: 0.7rem;
        margin-bottom: 0.15rem;
    }
    
    /* Enhanced inline code for small screens */
    .message-content .inline-code {
        padding: 0.1rem 0.25rem;
        font-size: 0.7rem;
        border-radius: 2px;
    }
    
    /* Enhanced headers for small screens */
    .message-content h1 {
        font-size: 1.1rem;
        margin: 0.6rem 0 0.25rem 0;
    }
    
    .message-content h2 {
        font-size: 0.95rem;
        margin: 0.4rem 0 0.25rem 0;
    }
    
    .message-content h3 {
        font-size: 0.85rem;
        margin: 0.35rem 0 0.15rem 0;
    }
    
    /* Enhanced lists for small screens */
    .message-content li {
        margin: 0.25rem 0;
        padding-left: 0.9rem;
        line-height: 1.2;
    }
    
    .message-content li::before {
        font-size: 1em;
    }
    
    /* Enhanced voice chat overlay for small screens */
    .voice-chat-container {
        padding: 1rem;
        margin: 0.6rem;
        border-radius: 12px;
        max-width: 300px;
    }
    
    .voice-chat-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .voice-chat-header h3 {
        font-size: 1.1rem;
    }
    
    .close-voice-chat {
        font-size: 1.1rem;
        padding: 0.3rem;
        min-width: 28px;
        min-height: 28px;
    }
    
    .voice-pulse {
        width: 55px;
        height: 55px;
    }
    
    .voice-pulse::after {
        font-size: 1.2rem;
    }
    
    .voice-indicator p {
        font-size: 0.85rem;
    }
    
    .voice-instructions {
        padding: 0.7rem;
        border-radius: 6px;
    }
    
    .voice-instructions p {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .ios-warning, .ios-info {
        padding: 0.4rem;
        border-radius: 5px;
        margin-top: 0.5rem;
    }
    
    .ios-warning p, .ios-info p {
        font-size: 0.7rem;
        line-height: 1.1;
    }
}

@media (max-width: 360px) {
    .header {
        padding: 0.5rem 0.6rem;
    }
    
    .header h1 {
        font-size: 1.3rem;
        margin-bottom: 0.15rem;
    }
    
    .header p {
        font-size: 0.65rem;
        margin-bottom: 0.1rem;
        line-height: 1.1;
    }
    
    .powered-by {
        font-size: 0.55rem;
        opacity: 0.6;
    }
    
    .chat-container {
        height: calc(100vh - 65px);
    }
    
    .chat-messages {
        padding: 0.6rem 0.5rem;
    }
    
    .message {
        margin-bottom: 0.7rem;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
        margin-right: 0.5rem;
    }
    
    .user-message .message-avatar {
        margin-right: 0;
        margin-left: 0.5rem;
    }
    
    .message-content {
        max-width: 90%;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        line-height: 1.25;
        border-radius: 12px;
    }
    
    .message-content p {
        margin-bottom: 0.4rem;
    }
    
    /* Enhanced input area for very small screens */
    .chat-input-container {
        padding: 0.5rem;
    }
    
    .input-wrapper {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    #messageInput {
        min-height: 40px;
        max-height: 70px;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        border-radius: 20px;
    }
    
    .send-button {
        width: 40px;
        height: 40px;
    }
    
    /* Enhanced model selector for very small screens */
    .model-selector {
        margin-bottom: 0.5rem;
        padding: 0.4rem;
        border-radius: 8px;
    }
    
    .model-selector label {
        font-size: 0.7rem;
        margin-bottom: 0.15rem;
    }
    
    #modelSelect {
        padding: 0.4rem;
        font-size: 0.75rem;
        border-radius: 5px;
    }
    
    /* Enhanced coding tools for very small screens */
    .coding-tools {
        grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
        gap: 0.3rem;
        margin-bottom: 0.5rem;
        padding: 0.3rem;
        border-radius: 8px;
    }
    
    .tool-button {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        font-size: 0.7rem;
    }
    
    /* Enhanced voice settings for very small screens */
    .voice-settings {
        gap: 0.5rem;
        padding: 0.5rem;
        border-radius: 8px;
        margin-top: 0.3rem;
    }
    
    .voice-language-selector,
    .voice-gender-selector {
        gap: 0.15rem;
    }
    
    .voice-language-selector label,
    .voice-gender-selector label {
        font-size: 0.65rem;
        margin-bottom: 0.1rem;
    }
    
    .voice-language-selector select,
    .voice-gender-selector select {
        padding: 0.3rem;
        font-size: 0.7rem;
        border-radius: 5px;
    }
    
    /* Enhanced test voice buttons for very small screens */
    .test-voice-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
        min-height: 36px;
        border-radius: 6px;
    }
    
    /* Enhanced loading indicator for very small screens */
    .loading-indicator {
        bottom: 85px;
        padding: 0.6rem 1rem;
        border-radius: 16px;
        font-size: 0.8rem;
    }
    
    .loading-indicator p {
        font-size: 0.75rem;
    }
    
    /* Enhanced install button for very small screens */
    .install-button {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 0.65rem;
        border-radius: 16px;
    }
    
    /* Enhanced code blocks for very small screens */
    .code-block {
        margin: 0.5rem 0;
        border-radius: 6px;
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    .code-header {
        padding: 0.4rem 0.6rem;
        border-radius: 6px 6px 0 0;
    }
    
    .lang-badge {
        padding: 0.1rem 0.4rem;
        font-size: 0.6rem;
        border-radius: 3px;
    }
    
    .copy-btn {
        padding: 0.25rem;
        font-size: 0.6rem;
        border-radius: 3px;
        min-width: 24px;
        min-height: 24px;
    }
    
    .copy-btn svg {
        width: 12px;
        height: 12px;
    }
    
    .code-block pre {
        padding: 0.6rem;
        font-size: 0.65rem;
        line-height: 1.2;
    }
    
    /* Enhanced modal for very small screens */
    .modal-content {
        margin: 2% auto;
        width: 99%;
        border-radius: 12px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 0.7rem 0.8rem;
        border-radius: 12px 12px 0 0;
    }
    
    .modal-header h3 {
        font-size: 0.95rem;
    }
    
    .close {
        font-size: 18px;
        padding: 0.3rem;
        min-width: 32px;
        min-height: 32px;
    }
    
    .modal-body {
        padding: 0.7rem;
    }
    
    .chat-history-item {
        padding: 0.7rem;
        border-radius: 8px;
        margin-bottom: 0.5rem;
    }
    
    .chat-history-title {
        font-size: 0.8rem;
        margin-bottom: 0.15rem;
    }
    
    .chat-history-date {
        font-size: 0.65rem;
        margin-bottom: 0.3rem;
    }
    
    .chat-history-count {
        font-size: 0.6rem;
    }
    
    .chat-history-actions {
        gap: 0.3rem;
    }
    
    .chat-history-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
        min-width: 40px;
        min-height: 24px;
        border-radius: 5px;
    }
    
    /* Enhanced empty state for very small screens */
    .empty-history {
        padding: 1.2rem 0.6rem;
    }
    
    .empty-history svg {
        width: 32px;
        height: 32px;
        margin-bottom: 0.6rem;
    }
    
    .empty-history p {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }
    
    /* Enhanced RTL support for very small screens */
    .rtl-text {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .rtl-text p {
        margin-bottom: 0.4rem;
    }
    
    .rtl-text h1, .rtl-text h2, .rtl-text h3 {
        margin-bottom: 0.3rem;
    }
    
    .rtl-text li {
        padding-right: 0.7rem;
        margin-bottom: 0.15rem;
    }
    
    /* Enhanced inline code for very small screens */
    .message-content .inline-code {
        padding: 0.1rem 0.25rem;
        font-size: 0.7rem;
        border-radius: 2px;
    }
    
    /* Enhanced headers for very small screens */
    .message-content h1 {
        font-size: 1.1rem;
        margin: 0.6rem 0 0.25rem 0;
    }
    
    .message-content h2 {
        font-size: 0.95rem;
        margin: 0.4rem 0 0.25rem 0;
    }
    
    .message-content h3 {
        font-size: 0.85rem;
        margin: 0.35rem 0 0.15rem 0;
    }
    
    /* Enhanced lists for very small screens */
    .message-content li {
        margin: 0.25rem 0;
        padding-left: 0.9rem;
        line-height: 1.2;
    }
    
    .message-content li::before {
        font-size: 1em;
    }
    
    /* Enhanced voice chat overlay for very small screens */
    .voice-chat-container {
        padding: 1rem;
        margin: 0.6rem;
        border-radius: 12px;
        max-width: 300px;
    }
    
    .voice-chat-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .voice-chat-header h3 {
        font-size: 1.1rem;
    }
    
    .close-voice-chat {
        font-size: 1.1rem;
        padding: 0.3rem;
        min-width: 28px;
        min-height: 28px;
    }
    
    .voice-pulse {
        width: 55px;
        height: 55px;
    }
    
    .voice-pulse::after {
        font-size: 1.2rem;
    }
    
    .voice-indicator p {
        font-size: 0.85rem;
    }
    
    .voice-instructions {
        padding: 0.7rem;
        border-radius: 6px;
    }
    
    .voice-instructions p {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .ios-warning, .ios-info {
        padding: 0.4rem;
        border-radius: 5px;
        margin-top: 0.5rem;
    }
    
    .ios-warning p, .ios-info p {
        font-size: 0.7rem;
        line-height: 1.1;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 0.5rem 1rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
        margin-bottom: 0.2rem;
    }
    
    .header p {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
    }
    
    .powered-by {
        font-size: 0.6rem;
    }
    
    .chat-container {
        margin: 0.3rem;
    }
    
    .chat-messages {
        padding: 0.8rem;
    }
    
    .chat-input-container {
        padding: 0.8rem;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .chat-messages {
        padding: 2.5rem;
    }
    
    .message-content {
        max-width: 70%;
    }
}

/* Voice Chat Overlay */
.voice-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.voice-chat-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideInUp 0.5s ease-out;
}

.voice-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.voice-chat-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-voice-chat {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-voice-chat:hover {
    background: #f7fafc;
    color: #2d3748;
}

.voice-chat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.voice-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.voice-pulse {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    animation: pulse 2s infinite;
}

.voice-pulse::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    animation: ripple 2s infinite;
}

.voice-pulse::after {
    content: '🎤';
    font-size: 2rem;
    z-index: 1;
}

.voice-pulse.speaking {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    animation: pulseSpeaking 1s infinite;
}

.voice-pulse.speaking::before {
    background: rgba(40, 167, 69, 0.3);
}

.voice-pulse.speaking::after {
    content: '🔊';
}

.voice-indicator p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: #2d3748;
}

.voice-instructions {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.voice-instructions p {
    margin: 0;
    color: #4a5568;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ios-warning {
    background: #fed7d7;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.ios-warning p {
    margin: 0;
    color: #c53030;
    font-size: 0.85rem;
    font-weight: 500;
}

.ios-info {
    background: #c6f6d5;
    border: 1px solid #9ae6b4;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.ios-info p {
    margin: 0;
    color: #22543d;
    font-size: 0.85rem;
    font-weight: 500;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(102, 126, 234, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

@keyframes pulseSpeaking {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 25px rgba(40, 167, 69, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design for voice chat overlay */
@media (max-width: 768px) {
    .voice-chat-container {
        padding: 1.5rem;
        margin: 1rem;
        border-radius: 16px;
        max-width: 350px;
        width: 90%;
    }
    
    .voice-chat-header {
        margin-bottom: 1.5rem;
    }
    
    .voice-chat-header h3 {
        font-size: 1.3rem;
    }
    
    .close-voice-chat {
        font-size: 1.3rem;
        padding: 0.5rem;
        min-width: 36px;
        min-height: 36px;
    }
    
    .voice-pulse {
        width: 70px;
        height: 70px;
    }
    
    .voice-pulse::after {
        font-size: 1.5rem;
    }
    
    .voice-indicator p {
        font-size: 1rem;
    }
    
    .voice-instructions {
        padding: 1rem;
    }
    
    .voice-instructions p {
        font-size: 0.9rem;
    }
    
    .speech-buffer-display {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }
    
    .speech-buffer-content h4 {
        font-size: 0.85rem;
    }
    
    .speech-text {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .speech-actions {
        gap: 0.4rem;
        margin-top: 0.6rem;
    }
    
    .send-speech-btn, .clear-speech-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    .interim-display {
        padding: 0.6rem;
        margin: 0.4rem 0;
    }
    
    .interim-text {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .interim-indicator {
        font-size: 0.7rem;
    }
    
    .ios-warning, .ios-info {
        padding: 0.6rem;
        margin-top: 0.8rem;
    }
    
    .ios-warning p, .ios-info p {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .voice-chat-container {
        padding: 1rem;
        margin: 0.6rem;
        border-radius: 12px;
        max-width: 300px;
    }
    
    .voice-chat-header {
        margin-bottom: 1rem;
    }
    
    .voice-chat-header h3 {
        font-size: 1.1rem;
    }
    
    .close-voice-chat {
        font-size: 1.1rem;
        padding: 0.3rem;
        min-width: 28px;
        min-height: 28px;
    }
    
    .voice-pulse {
        width: 60px;
        height: 60px;
    }
    
    .voice-pulse::after {
        font-size: 1.3rem;
    }
    
    .voice-chat-content {
        gap: 1rem;
    }
    
    .voice-indicator p {
        font-size: 0.9rem;
    }
    
    .voice-instructions {
        padding: 0.8rem;
    }
    
    .voice-instructions p {
        font-size: 0.85rem;
    }
    
    .speech-buffer-display {
        padding: 0.6rem;
        margin: 0.6rem 0;
    }
    
    .speech-buffer-content h4 {
        font-size: 0.8rem;
    }
    
    .speech-text {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .speech-actions {
        gap: 0.3rem;
        margin-top: 0.5rem;
    }
    
    .send-speech-btn, .clear-speech-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-height: 32px;
    }
    
    .interim-display {
        padding: 0.5rem;
        margin: 0.3rem 0;
    }
    
    .interim-text {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
    
    .interim-indicator {
        font-size: 0.65rem;
    }
    
    .ios-warning, .ios-info {
        padding: 0.5rem;
        margin-top: 0.6rem;
    }
    
    .ios-warning p, .ios-info p {
        font-size: 0.75rem;
    }
}

/* Speech Buffer Display Styles */
.speech-buffer-display {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    border: 2px solid #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    display: none;
}

.speech-buffer-content h4 {
    margin: 0 0 0.5rem 0;
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 600;
}

.speech-text {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.8rem;
    margin: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #2d3748;
    direction: rtl;
    text-align: right;
    font-family: 'Tahoma', 'Arial', sans-serif;
}

.speech-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.send-speech-btn, .clear-speech-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.send-speech-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.send-speech-btn:hover, .send-speech-btn:active {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.clear-speech-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.clear-speech-btn:hover, .clear-speech-btn:active {
    background: linear-gradient(135deg, #c82333, #bd2130);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Interim Display Styles */
.interim-display {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 0.8rem;
    margin: 0.5rem 0;
    border: 1px solid #e9ecef;
    display: none;
}

.interim-content {
    text-align: center;
}

.interim-text {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.6rem;
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    line-height: 1.3;
    color: #6c757d;
    font-style: italic;
    direction: rtl;
    text-align: right;
    font-family: 'Tahoma', 'Arial', sans-serif;
}

.interim-indicator {
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.interim-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

/* Enhanced Voice Chat Overlay for Mobile */
.voice-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.98) 0%, rgba(118, 75, 162, 0.98) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.voice-chat-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideInUp 0.5s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.voice-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.voice-chat-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-voice-chat {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-voice-chat:hover {
    background: #f7fafc;
    color: #2d3748;
}

.voice-chat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.voice-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.voice-pulse {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    animation: pulse 2s infinite;
}

.voice-pulse::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    animation: ripple 2s infinite;
}

.voice-pulse::after {
    content: '🎤';
    font-size: 2rem;
    z-index: 1;
}

.voice-pulse.speaking {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    animation: pulseSpeaking 1s infinite;
}

.voice-pulse.speaking::before {
    background: rgba(40, 167, 69, 0.3);
}

.voice-pulse.speaking::after {
    content: '🔊';
}

.voice-indicator p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: #2d3748;
}

.voice-instructions {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    width: 100%;
}

.voice-instructions p {
    margin: 0;
    color: #4a5568;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ios-warning {
    background: #fed7d7;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.ios-warning p {
    margin: 0;
    color: #c53030;
    font-size: 0.85rem;
    font-weight: 500;
}

.ios-info {
    background: #c6f6d5;
    border: 1px solid #9ae6b4;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.ios-info p {
    margin: 0;
    color: #22543d;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Mobile Responsive Styles for Voice Chat */
@media (max-width: 768px) {
    .voice-chat-container {
        padding: 1.5rem;
        margin: 1rem;
        border-radius: 16px;
        max-width: 350px;
        width: 90%;
    }
    
    .voice-chat-header {
        margin-bottom: 1.5rem;
    }
    
    .voice-chat-header h3 {
        font-size: 1.3rem;
    }
    
    .close-voice-chat {
        font-size: 1.3rem;
        padding: 0.5rem;
        min-width: 36px;
        min-height: 36px;
    }
    
    .voice-pulse {
        width: 70px;
        height: 70px;
    }
    
    .voice-pulse::after {
        font-size: 1.5rem;
    }
    
    .voice-indicator p {
        font-size: 1rem;
    }
    
    .voice-instructions {
        padding: 1rem;
    }
    
    .voice-instructions p {
        font-size: 0.9rem;
    }
    
    .speech-buffer-display {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }
    
    .speech-buffer-content h4 {
        font-size: 0.85rem;
    }
    
    .speech-text {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .speech-actions {
        gap: 0.4rem;
        margin-top: 0.6rem;
    }
    
    .send-speech-btn, .clear-speech-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    .interim-display {
        padding: 0.6rem;
        margin: 0.4rem 0;
    }
    
    .interim-text {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .interim-indicator {
        font-size: 0.7rem;
    }
    
    .ios-warning, .ios-info {
        padding: 0.6rem;
        margin-top: 0.8rem;
    }
    
    .ios-warning p, .ios-info p {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .voice-chat-container {
        padding: 1rem;
        margin: 0.6rem;
        border-radius: 12px;
        max-width: 300px;
    }
    
    .voice-chat-header {
        margin-bottom: 1rem;
    }
    
    .voice-chat-header h3 {
        font-size: 1.1rem;
    }
    
    .close-voice-chat {
        font-size: 1.1rem;
        padding: 0.3rem;
        min-width: 28px;
        min-height: 28px;
    }
    
    .voice-pulse {
        width: 60px;
        height: 60px;
    }
    
    .voice-pulse::after {
        font-size: 1.3rem;
    }
    
    .voice-chat-content {
        gap: 1rem;
    }
    
    .voice-indicator p {
        font-size: 0.9rem;
    }
    
    .voice-instructions {
        padding: 0.8rem;
    }
    
    .voice-instructions p {
        font-size: 0.85rem;
    }
    
    .speech-buffer-display {
        padding: 0.6rem;
        margin: 0.6rem 0;
    }
    
    .speech-buffer-content h4 {
        font-size: 0.8rem;
    }
    
    .speech-text {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .speech-actions {
        gap: 0.3rem;
        margin-top: 0.5rem;
    }
    
    .send-speech-btn, .clear-speech-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-height: 32px;
    }
    
    .interim-display {
        padding: 0.5rem;
        margin: 0.3rem 0;
    }
    
    .interim-text {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
    
    .interim-indicator {
        font-size: 0.65rem;
    }
    
    .ios-warning, .ios-info {
        padding: 0.5rem;
        margin-top: 0.6rem;
    }
    
    .ios-warning p, .ios-info p {
        font-size: 0.75rem;
    }
}

/* Feature Panel Styles - Mobile Only */
@media (max-width: 768px) {
    /* Toggle Features Button */
    .toggle-features-btn {
        width: 100%;
        padding: 0.8rem 1rem;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 12px;
        margin: 0.5rem 0;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        font-size: 0.85rem;
        font-weight: 500;
        color: #374151;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        -webkit-tap-highlight-color: transparent;
    }
    
    .toggle-features-btn:hover {
        background: rgba(255, 255, 255, 1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(-1px);
    }
    
    .toggle-features-btn:active {
        transform: scale(0.98);
    }
    
    .toggle-features-btn svg {
        transition: transform 0.3s ease;
    }
    
    .toggle-features-btn.open svg {
        transform: rotate(180deg);
    }
    
    .toggle-features-btn span {
        font-family: 'Tahoma', 'Arial', sans-serif;
        direction: rtl;
    }
    
    /* Feature Panel Container */
    .feature-panel {
        background: rgba(255, 255, 255, 0.98);
        border-radius: 16px 16px 0 0;
        padding: 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-bottom: none;
        position: relative;
        z-index: 10;
    }
    
    .feature-panel.open {
        max-height: 80vh;
        padding: 1rem;
        margin-top: 0.5rem;
    }
    
    /* Feature Panel Content */
    .feature-panel .model-selector,
    .feature-panel .coding-tools,
    .feature-panel .voice-settings {
        margin-bottom: 1rem;
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.3s ease;
        transition-delay: 0.1s;
    }
    
    .feature-panel.open .model-selector,
    .feature-panel.open .coding-tools,
    .feature-panel.open .voice-settings {
        opacity: 1;
        transform: translateY(0);
    }
    
    .feature-panel .voice-settings {
        margin-bottom: 0;
        transition-delay: 0.2s;
    }
    
    /* Enhanced Model Selector in Panel */
    .feature-panel .model-selector {
        background: rgba(255, 255, 255, 0.9);
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .feature-panel .model-selector label {
        font-size: 0.8rem;
        font-weight: 600;
        color: #374151;
        margin-bottom: 0.4rem;
        display: block;
    }
    
    .feature-panel .model-selector select {
        width: 100%;
        padding: 0.7rem;
        border-radius: 10px;
        font-size: 0.85rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
        background: white;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.8rem center;
        background-size: 1.2em;
        padding-right: 2.8rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    /* Enhanced Coding Tools in Panel */
    .feature-panel .coding-tools {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
        gap: 0.6rem;
        padding: 0.8rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .feature-panel .tool-button {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        font-size: 0.8rem;
        border: 1px solid rgba(0, 0, 0, 0.08);
        background: white;
        color: #667eea;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .feature-panel .tool-button:active {
        transform: scale(0.95);
        background: #667eea;
        color: white;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    .feature-panel .tool-button:hover {
        background: #667eea;
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
    }
    
    /* Enhanced Voice Settings in Panel */
    .feature-panel .voice-settings {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
        padding: 0.8rem;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .feature-panel .voice-language-selector,
    .feature-panel .voice-gender-selector {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .feature-panel .voice-language-selector label,
    .feature-panel .voice-gender-selector label {
        font-size: 0.75rem;
        font-weight: 600;
        color: #374151;
        margin-bottom: 0.2rem;
    }
    
    .feature-panel .voice-language-selector select,
    .feature-panel .voice-gender-selector select {
        padding: 0.6rem;
        border-radius: 8px;
        font-size: 0.8rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
        background: white;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.6rem center;
        background-size: 1em;
        padding-right: 2.2rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    /* Enhanced Test Voice Buttons in Panel */
    .feature-panel .test-voice-btn {
        grid-column: 1 / -1;
        padding: 0.8rem;
        border-radius: 10px;
        font-size: 0.8rem;
        font-weight: 600;
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .feature-panel .test-voice-btn:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }
    
    .feature-panel .test-voice-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    }
    
    .feature-panel .persian-test-btn {
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
        color: white;
        font-family: 'Tahoma', 'Arial', sans-serif;
    }
    
    .feature-panel .voice-info-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }
    
    /* Panel Animation Overlay */
    .feature-panel::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
        border-radius: 16px 16px 0 0;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .feature-panel.open::before {
        opacity: 1;
    }
    
    /* Panel Handle */
    .feature-panel::after {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 2px;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .feature-panel.open::after {
        opacity: 1;
    }
    
    /* Smooth transition for chat container */
    .chat-input-container {
        transition: padding-bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .chat-input-container.has-feature-panel {
        padding-bottom: 1rem;
    }
    
    /* Enhanced scrollbar for feature panel */
    .feature-panel {
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    }
    
    .feature-panel::-webkit-scrollbar {
        width: 4px;
    }
    
    .feature-panel::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .feature-panel::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 2px;
    }
    
    .feature-panel::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* Desktop styles - hide feature panel */
@media (min-width: 769px) {
    .toggle-features-btn,
    .feature-panel {
        display: none !important;
    }
}

/* Small mobile optimizations */
@media (max-width: 480px) {
    .toggle-features-btn {
        padding: 0.7rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 10px;
    }
    
    .toggle-features-btn span {
        font-size: 0.75rem;
    }
    
    .feature-panel.open {
        max-height: 75vh;
        padding: 0.8rem;
    }
    
    .feature-panel .model-selector,
    .feature-panel .coding-tools,
    .feature-panel .voice-settings {
        margin-bottom: 0.8rem;
    }
    
    .feature-panel .coding-tools {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 0.5rem;
        padding: 0.6rem;
    }
    
    .feature-panel .tool-button {
        width: 40px;
        height: 40px;
        font-size: 0.75rem;
    }
    
    .feature-panel .voice-settings {
        gap: 0.6rem;
        padding: 0.6rem;
    }
    
    .feature-panel .test-voice-btn {
        padding: 0.7rem;
        font-size: 0.75rem;
        min-height: 40px;
    }
}

@media (max-width: 360px) {
    .toggle-features-btn {
        padding: 0.6rem 0.7rem;
        font-size: 0.75rem;
        border-radius: 8px;
    }
    
    .toggle-features-btn span {
        font-size: 0.7rem;
    }
    
    .feature-panel.open {
        max-height: 70vh;
        padding: 0.6rem;
    }
    
    .feature-panel .model-selector,
    .feature-panel .coding-tools,
    .feature-panel .voice-settings {
        margin-bottom: 0.6rem;
    }
    
    .feature-panel .coding-tools {
        grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
        gap: 0.4rem;
        padding: 0.5rem;
    }
    
    .feature-panel .tool-button {
        width: 36px;
        height: 36px;
        font-size: 0.7rem;
    }
    
    .feature-panel .voice-settings {
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .feature-panel .test-voice-btn {
        padding: 0.6rem;
        font-size: 0.7rem;
        min-height: 36px;
    }
}
