/* static/css/style.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    background-color: #ffffff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 700px;
    margin-top: 20px;
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
}

.auth-section, .form-section, .usage-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    background-color: #fdfdfd;
}

.auth-section h2, .form-section h2, .usage-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #34495e;
    font-size: 1.4em;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

input[type="text"],
input[type="url"],
textarea {
    width: calc(100% - 24px); /* Account for padding */
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #d1d9e0;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
    outline: none;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

button, input[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}

button:hover, input[type="submit"]:hover {
    background-color: #0056b3;
}

.user-info p {
    margin: 5px 0;
    font-size: 0.95em;
}

.flash-messages {
    list-style-type: none;
    padding: 0;
    margin-bottom: 20px;
}

.flash-messages li {
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    font-size: 0.9em;
}

.flash-messages .success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-messages .error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-messages .info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.flash-messages .warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

#loadingIndicator {
    display: none; /* Hidden by default */
    margin-top: 20px;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

#answerDisplay {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    min-height: 100px;
    white-space: pre-wrap; /* Ensures newlines are respected initially */
    font-size: 0.95em;
    line-height: 1.7;
}

/* Styles for Markdown content generated by marked.js */
.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #2c3e50;
    font-weight: 600;
}
.markdown-content h1 { font-size: 1.8em; }
.markdown-content h2 { font-size: 1.5em; }
.markdown-content h3 { font-size: 1.3em; }

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.markdown-content li {
    margin-bottom: 0.5em;
}

.markdown-content code {
    background-color: #e9ecef;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.markdown-content pre {
    background-color: #e9ecef;
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
}

.markdown-content pre code {
    padding: 0;
    margin: 0;
    font-size: inherit;
    background-color: transparent;
}

.markdown-content blockquote {
    margin-left: 0;
    padding-left: 1em;
    border-left: 3px solid #007bff;
    color: #555;
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.markdown-content th, 
.markdown-content td {
    border: 1px solid #dee2e6;
    padding: 0.5em 0.75em;
    text-align: left;
}

.markdown-content th {
    background-color: #f1f3f5;
    font-weight: 600;
}

.auth-action-buttons form {
    display: inline-block; /* Align buttons on the same line */
    margin-right: 15px; /* Space between buttons */
}

.auth-action-buttons form:last-child {
    margin-right: 0; /* No margin for the last button */
}

.form-group {
    margin-bottom: 1.5rem; 
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 20px;
    }
    h1 {
        font-size: 1.8em;
    }
    input[type="text"],
    input[type="url"],
    textarea,
    button,
    input[type="submit"] {
        font-size: 0.95em;
    }
}

/* Added to ensure AJAX response messages are styled if needed */
#answerDisplay .error-text {
    color: #721c24; /* Bootstrap danger text color */
    font-weight: bold;
}

#answerDisplay .success-message .markdown-content {
    /* No specific styles for success message wrapper, 
       markdown content itself will be styled by .markdown-content rules 
    */
}