@import url('https://fonts.googleapis.com/css2?family=Libre+Caslon+Text:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --color-bg: #FFFBF7;
    --color-bg-dark: #efefef;
    --color-border: #DDD;
    --color-text: #000;
    --color-text-muted: #333;
    --color-primary: #0056B3;
    --color-primary-hover: #007BFF;
    --color-disabled: #CCC;
    --color-success: #28A745;
    --color-error: #DC3545;
    --font-family: "Libre Caslon Text", serif;
    --font-size-lg: 22px;
    --font-size-md: 18px;
    --font-size-sm: 14px;
    --line-height: 1.6;
    --space-unit: 10px;
    --space-sm: 10px;
    --space-md: 20px;
    --radius: 4px;
    --transition-fast: 0.3s ease-in;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-lg);
    line-height: var(--line-height);
    color: var(--color-text);
    background: var(--color-bg);
    zoom: 1.25;
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: var(--space-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6, h7, h8{
    font-weight: normal;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
}

#prototype-warning{
    text-align: center;
    padding: 4px;
    font-size: var(--font-size-sm);
}

.logo{
    width: 30%;
    display: block;
}

.logo img{
    min-width: 100%;
}

.logo img{
    cursor: pointer;
}

nav {
    align-items: center;
    gap: 12px;
}

.nav-user {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.nav-link {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-decoration: none;
}

.nav-link:hover {
    color: var(--color-primary-hover);
}

button.nav-link {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-decoration: none;
}

button.nav-link:hover {
    color: var(--color-primary-hover);
    cursor: pointer;
}

/* Main */
main {
    flex: 1;
}

/* Footer */
footer {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
}

.footer-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.usage-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.usage-bar-container {
    flex: 1;
    max-width: 120px;
    height: 4px;
    background: var(--color-bg-dark);
    border-radius: 2px;
    overflow: hidden;
}

.usage-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.usage-bar-over {
    background: var(--color-error);
}

.usage-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-size-md);
    font-family: var(--font-family);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

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

.btn:disabled {
    background: var(--color-disabled);
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: var(--font-size-md);
    margin-bottom: 4px;
    color: var(--color-text-muted);
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea {
    width: 100%;
    padding: var(--space-sm);
    background-color: white;
    border: 1px solid black;
    border-radius: var(--radius);
    font-size: var(--font-size-md);
    font-family: var(--font-family);
    resize: vertical;
    outline: none;
    box-shadow: none; /* Removes additional glow effects in some versions */
    -webkit-box-shadow: none; /* Specific for WebKit/Safari */
}

textarea:focus{
   border: 1px solid blue;
}

/* Auth form */
.auth-form {
    max-width: 400px;
    margin: 60px auto;
}

.auth-form h1 {
    margin-bottom: var(--space-md);
}

/* Settings form */
.settings-form {
    max-width: 500px;
    margin: 60px auto;
}

.settings-form h1 {
    margin-bottom: var(--space-md);
}

.settings-form h2 {
    margin-bottom: var(--space-sm);
    font-weight: normal;
}

.settings-form hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-md) 0;
}

.settings-billing p {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
}

.success-message {
    color: var(--color-success);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
}

.btn-secondary {
    background: var(--color-text-muted);
}

.btn-secondary:hover {
    background: var(--color-text);
}

/* Errors */
.errors {
    list-style: none;
    margin-bottom: 12px;
    padding: var(--space-sm);
    background: #FFF0F0;
    border: 1px solid var(--color-error);
    border-radius: var(--radius);
}

.errors li {
    font-size: var(--font-size-sm);
    color: var(--color-error);
}

/* Conversations list */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.list-header h1 {
    font-size: 28px;
}

.conversation-items {
    list-style: none;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border: 1px solid black;
    background-color: white;
    margin: 1em 0;
    padding: 0.75em;
    border-radius: var(--radius);
}

.conversation-link {
    flex: 1;
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.conversation-link:hover .conversation-title {
    color: var(--color-primary);
}

.conversation-title {
    font-size: var(--font-size-md);
}

.conversation-meta {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.delete-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.5;
}

.delete-btn:hover {
    opacity: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-md) 0;
}

.pagination-link {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-decoration: none;
}

.pagination-link:hover {
    color: var(--color-primary-hover);
}

.pagination-info {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.empty-state {
    font-size: var(--font-size-md);
    color: var(--color-text-muted);
    text-align: center;
    padding: 40px 0;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    min-height: 60vh;
}

.messages {
    flex: 1;
    margin-bottom: var(--space-md);
}

.message {
    padding: 2px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
    margin-bottom: 16px;
}

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

.user-message .message-body {
    font-family: var(--font-family);
    background: white;
    border: 1px solid black;
    padding: 12px 16px;
    border-radius: var(--radius);
    max-width: 80%;
    font-size: var(--font-size-md);
    text-align: justify;
    white-space: pre-wrap;
    line-height: var(--line-height);
}

.agent-message .message-body {
    white-space: pre-wrap;
    font-size: var(--font-size-md);
    line-height: var(--line-height);
    text-align: justify;
}

.agent-response {
    width: 100%;
}

/* Thinking block */
.thinking-block {
    margin-bottom: 12px;
}

.thinking-block summary {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.perspectives {
    margin-top: 8px;
    padding: 12px;
    border-radius: var(--radius);
}

.perspective {
    margin-bottom: 15px;
    font-size: var(--font-size-md);
    line-height: 1.4;
    text-align: justify;
    display: flex;
}

.perspective:last-child {
    margin-bottom: 0;
}

.perspective-emoji {
  margin-right: 15px;
  font-size: 30px;
  display: inline-block;
  position: relative;
  top: -3px;
}

.perspective-name {
    font-weight: 700;
    margin-right: 8px;
    text-transform: capitalize;
}

.perspective-statement {
  display: inline-block;
  font-size: var(--font-size-md);
}

/* Contribution bar (linear pie chart) */
.contribution-bar {
    margin-top: 12px;
    margin-bottom: 0;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    align-items: center;
}

.message-actions form {
    display: inline;
}

.btn-action {
    font-size: 0.75rem;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-family);
    border: none;
    text-decoration: underline;
}

.btn-action:hover{
  color: var(--color-text);
}

.contribution-segments {
    display: flex;
    height: 6px;
    overflow: hidden;
}

.contribution-segments .segment {
    height: 100%;
    min-width: 1px;
    transition: width 0.3s ease;
}

.contribution-labels {
    position: relative;
    height: 22px;
    margin-top: 2px;
}

.contribution-labels .label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 14px;
    line-height: 22px;
}

@media print {
    .contribution-segments .segment {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Chat input */
.chat-input {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
}

#status-indicator {
}

/* Status */
.status {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.status.connected {
    color: var(--color-success);
}

.status.disconnected {
    color: var(--color-error);
}

/* Error page */
.error-page {
    text-align: center;
    padding: 60px 0;
}

.error-page h1 {
    margin-bottom: var(--space-md);
}

.error-page p {
    margin-bottom: var(--space-md);
    color: var(--color-text-muted);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.3s ease-in;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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