/* Chat Container */
.chat-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Chat Info Section */
.chat-info {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-info h2 {
    color: #1c4587;
    margin-bottom: 0.5rem;
}

.chat-info p {
    color: #666;
    margin-bottom: 1rem;
}

.privacy-notice {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.privacy-notice strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #856404;
}

/* Chat Window */
.chat-window {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
}

/* Message Container */
.message-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #f8f9fa;
}

/* Message Styles */
.message {
    display: flex;
    gap: 0.75rem;
    animation: messageSlideIn 0.3s ease-out;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.assistant-message .message-avatar {
    background-color: #e3f2fd;
}

.user-message .message-avatar {
    background-color: #e8f5e9;
}

.message-content {
    flex: 1;
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.user-message .message-content {
    background-color: #1c4587;
    color: white;
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.5rem;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Loading Message */
.loading-message {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.loading-dots {
    display: flex;
    gap: 0.25rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #1c4587;
    animation: loadingDot 1.4s infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDot {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.4;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Input Area */
.input-area {
    border-top: 1px solid #e0e0e0;
    padding: 1rem;
    background-color: white;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#userInput {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.3s;
}

#userInput:focus {
    outline: none;
    border-color: #1c4587;
}

.send-button {
    background-color: #1c4587;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

.send-button:hover {
    background-color: #2c5aa0;
}

.send-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-action-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-action-btn:hover {
    background-color: #e3f2fd;
    border-color: #1c4587;
    color: #1c4587;
}

/* Chat Actions */
.chat-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.action-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.action-button.secondary {
    background-color: white;
    color: #1c4587;
    border: 1px solid #1c4587;
}

.action-button.secondary:hover {
    background-color: #f0f0f0;
}

/* Error Message */
.error-message {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    color: #721c24;
}

.error-message strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.nav-button {
    background-color: #2c5aa0;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.nav-button:hover {
    background-color: #1c4587;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-window {
        height: 500px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .send-button {
        width: 100%;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-action-btn {
        width: 100%;
        text-align: left;
    }
}

/* ── API Settings Modal ──────────────────────────────────────────────── */
.settings-btn {
    background-color: #4a4a6a;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}
.settings-btn:hover { background-color: #333355; }

.api-settings-modal {
    max-width: 520px;
}

.settings-description {
    font-size: 0.85rem;
    color: #666;
    background: #f8f9fa;
    border-left: 3px solid #1c4587;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.api-key-group {
    margin-bottom: 1.25rem;
}

.api-key-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.provider-label {
    font-size: 0.95rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-weight: 600;
}
.provider-label.anthropic {
    background: #e8f4fd;
    color: #1a6b9a;
}
.provider-label.openai {
    background: #e8fdf0;
    color: #1a6b3a;
}

.get-key-link {
    font-size: 0.78rem;
    color: #888;
    text-decoration: none;
}
.get-key-link:hover { color: #1c4587; text-decoration: underline; }

.key-input-wrapper {
    display: flex;
    gap: 0.4rem;
}

.key-input-wrapper input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: monospace;
    transition: border-color 0.2s;
}
.key-input-wrapper input:focus {
    outline: none;
    border-color: #1c4587;
}

.toggle-visibility {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}
.toggle-visibility:hover { background: #e0e0e0; }

.key-status {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    display: block;
    min-height: 1.2em;
}
.key-status.ok  { color: #2e7d32; }
.key-status.err { color: #c62828; }
.key-status.set { color: #1565c0; }

.settings-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.action-button.primary {
    background-color: #1c4587;
    color: white;
}
.action-button.primary:hover { background-color: #2c5aa0; }

/* API key indicator in header */
.api-indicator {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.3rem;
    vertical-align: middle;
}
.api-indicator.active   { background: #c8e6c9; color: #2e7d32; }
.api-indicator.inactive { background: #ffccbc; color: #bf360c; }

/* Scrollbar Styling */
.message-container::-webkit-scrollbar {
    width: 8px;
}

.message-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.message-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}
