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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 800px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.header-content > div {
    flex: 1;
}

header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.help-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.help-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.help-text {
    display: inline;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in;
}

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

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.5;
}

.user-message {
    display: flex;
    justify-content: flex-end;
}

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

.bot-message {
    display: flex;
    justify-content: flex-start;
}

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

.correction {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    padding: 12px 16px;
    margin-top: 8px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #1565C0;
}

.correction strong {
    color: #0D47A1;
    font-weight: 600;
}

.correction br {
    margin-bottom: 4px;
}

.input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    padding: 12px 50px 12px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    outline: none;
    border-color: #667eea;
}

#send-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#send-button:active {
    transform: translateY(0);
}

#send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.controls {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.controls button {
    padding: 10px 20px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.controls button:hover {
    background: #667eea;
    color: white;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Microphone button */
.mic-button {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mic-button:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.mic-button.recording {
    background: #ff4444;
    animation: pulse 1.5s ease-in-out infinite;
}

.mic-button.recording:hover {
    background: #cc0000;
}

.mic-icon {
    font-size: 20px;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
}

/* Recording status */
.recording-status {
    padding: 10px 20px;
    background: #fff3cd;
    border-top: 1px solid #ffc107;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    color: #856404;
    font-weight: 500;
}

.recording-indicator {
    width: 12px;
    height: 12px;
    background: #ff4444;
    border-radius: 50%;
    animation: blink 1s ease-in-out infinite;
}

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

/* TTS Toggle */
.tts-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.tts-toggle:hover {
    background: #f0f0f0;
}

.tts-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.tts-toggle span {
    user-select: none;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 25px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    gap: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-toggle {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 8px;
}

.lang-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 32px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.setup-section {
    margin-bottom: 30px;
}

.setup-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 20px;
}

.setup-section h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

.setup-section p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #555;
}

.setup-section ul, .setup-section ol {
    margin-left: 20px;
    margin-bottom: 15px;
    color: #555;
}

.setup-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.feature-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.feature-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.feature-box strong {
    color: #667eea;
    display: block;
    margin-bottom: 10px;
}

.feature-box ul {
    margin: 0;
    padding-left: 20px;
}

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    position: relative;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.code-block code {
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: all 0.2s;
}

.copy-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.note {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    padding: 10px 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
}

.faq {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.faq-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.faq-item strong {
    color: #667eea;
    display: block;
    margin-bottom: 8px;
}

.faq-item p {
    margin: 0;
    color: #555;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    background: #f8f9fa;
    border-radius: 0 0 20px 20px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        height: 95vh;
        border-radius: 15px;
    }

    header {
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    header h1 {
        font-size: 22px;
    }

    .subtitle {
        font-size: 12px;
    }

    .help-button {
        width: 100%;
        justify-content: center;
    }

    .help-text {
        display: inline;
    }

    .modal-header {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .language-toggle {
        order: 2;
    }

    .message-content {
        max-width: 85%;
        font-size: 14px;
    }

    .input-container {
        padding: 15px;
        flex-wrap: wrap;
    }

    #send-button {
        width: 100%;
        margin-top: 10px;
    }

    .controls {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .controls button,
    .tts-toggle {
        flex: 1;
        min-width: 120px;
        font-size: 12px;
        padding: 8px 15px;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        max-height: 95vh;
        border-radius: 15px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .feature-comparison {
        grid-template-columns: 1fr;
    }

    .setup-steps {
        gap: 15px;
    }

    .step {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .step-content {
        text-align: left;
    }

    .code-block {
        font-size: 12px;
        padding: 12px;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 18px;
    }

    .subtitle {
        font-size: 11px;
    }

    .message-content {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 13px;
    }

    .controls {
        flex-direction: column;
    }

    .controls button,
    .tts-toggle {
        width: 100%;
        margin-bottom: 8px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-body {
        padding: 15px;
    }

    .setup-section h3 {
        font-size: 18px;
    }
}

