/* Modern ChatGPT-inspired Interface */

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

:root {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-settings: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-focus: #d1d5db;
    --accent: #10a37f;
    --accent-hover: #0e8c6f;
    --error-bg: #fee2e2;
    --error-text: #dc2626;
    --error-border: #fca5a5;
    --success-text: #059669;
    --bubble-bg: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.settings-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: var(--bg-settings);
    color: var(--text-primary);
}

/* Settings Panel */
.settings-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: var(--bg-settings);
    border-radius: 12px;
    margin-bottom: 16px;
}

.settings-panel.active {
    max-height: 300px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.settings-content label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.settings-content input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.settings-content input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 40px;
}

.chat-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Input Section */
.input-section {
    margin-bottom: 20px;
}

.input-section label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Buttons */
button {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-settings);
    color: var(--text-primary);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button svg {
    flex-shrink: 0;
}

/* Status and Error */
.status-area {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 12px 0;
    min-height: 20px;
    transition: all 0.2s;
}

.status-area.success {
    color: var(--success-text);
    font-weight: 500;
}

.error-area {
    display: none;
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin: 12px 0;
    white-space: pre-wrap;
    line-height: 1.5;
}

.error-area.active {
    display: block;
}

/* Output Section */
.output-section {
    margin-top: 24px;
    animation: fadeIn 0.3s ease-in;
}

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

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

.output-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.message-bubble {
    background: var(--bubble-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
}

.output-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.output-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 0 12px;
    }

    .chat-card {
        padding: 16px;
    }

    .header h1 {
        font-size: 18px;
    }

    .input-actions,
    .output-actions {
        flex-direction: column;
    }

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