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

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.page-wrapper {
    display: flex;
    gap: 24px;
    max-width: 900px;
    width: 100%;
    align-items: flex-start;
}

.prompt-panel {
    background: white;
    border-radius: 16px;
    padding: 20px;
    width: 280px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.prompt-panel h3 {
    color: #1B5E8C;
    font-size: 16px;
    margin-bottom: 12px;
}

.prompt-panel label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prompt-panel textarea {
    width: 100%;
    height: 160px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    margin: 8px 0 12px;
    transition: border-color 0.2s;
}

.prompt-panel textarea:focus {
    outline: none;
    border-color: #1B5E8C;
}

.preset-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #f5f7fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #1B5E8C;
    color: white;
    border-color: #1B5E8C;
}

.chat-container {
    width: 420px;
    height: 620px;
    background: white;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    overflow: hidden;
    flex-shrink: 0;
}

.chat-header {
    background: #1B5E8C;
    color: white;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-dot {
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f9fafb;
}

.message {
    padding: 10px 16px;
    border-radius: 16px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
    white-space: pre-wrap;
    word-wrap: break-word;
}

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

.user-message {
    background: #1B5E8C;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #e8e8e8;
}

.welcome-message {
    background: #FFF8E7;
    color: #7a6520;
    align-self: center;
    text-align: center;
    font-size: 13px;
    border: 1px solid #f0e0b0;
}

.error-message {
    background: #FFF0F0;
    color: #c0392b;
    align-self: center;
    text-align: center;
    font-size: 13px;
    border: 1px solid #f0c0c0;
}

.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 12px 20px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    border: 1px solid #e8e8e8;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.chat-input {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input input:focus {
    outline: none;
    border-color: #1B5E8C;
}

.chat-input button {
    padding: 10px 20px;
    background: #1B5E8C;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-input button:hover { background: #14476a; }
.chat-input button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.clear-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 13px;
    margin-left: auto;
}

.clear-btn:hover { color: white; }

@media (max-width: 768px) {
    .page-wrapper {
        flex-direction: column;
        align-items: center;
    }
    .prompt-panel { width: 100%; max-width: 420px; }
    .chat-container { width: 100%; max-width: 420px; height: 500px; }
}