* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: #0f172a;
    color: #e2e8f0;
}

a {
    color: #38bdf8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(960px, 90vw);
    margin: 0 auto;
    padding: 1.5rem 0;
}

.navbar {
    background: #020617;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.navbar .brand {
    font-weight: 600;
    color: #e0f2fe;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.navbar .nav-links a {
    color: #94a3b8;
}

.nav-form {
    margin: 0;
}

h1,
h2 {
    color: #f8fafc;
}

section {
    margin-bottom: 2rem;
}

.card {
    background: rgba(30, 41, 59, 0.8);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

label {
    display: block;
    margin-bottom: 0.75rem;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.4rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    resize: vertical;
}

button {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.1);
}

.nav-form button {
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.6);
    color: #cbd5f5;
    transition: background 0.2s ease;
}

.nav-form button:hover {
    filter: none;
    background: rgba(59, 130, 246, 0.25);
}

.inline-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.inline-form label {
    margin-bottom: 0;
}

.flash-list {
    list-style: none;
    padding: 0;
}

.flash {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.flash.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.flash.info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.flash.warning {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.flash.danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.card.warning {
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(120, 53, 15, 0.35);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th,
table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    text-align: left;
}

.table-wrapper {
    overflow-x: auto;
}

.inline {
    display: inline;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.logout {
    text-align: right;
}

pre {
    background: rgba(15, 23, 42, 0.8);
    padding: 1rem;
    border-radius: 12px;
    overflow: auto;
}

.demo-output {
    min-height: 8rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

code {
    font-family: "Fira Code", "Source Code Pro", monospace;
    color: #facc15;
}

.steps {
    padding-left: 1.25rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.muted {
    color: #94a3b8;
    font-size: 0.95rem;
}

.details {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.details dt {
    font-weight: 600;
    color: #bfdbfe;
}

.details dd {
    margin: 0;
}

/* === Chat Styles === */
.chat-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 6rem);
}

.chat-sidebar {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1.5rem;
    overflow-y: auto;
}

.chat-sidebar h2 {
    font-size: 1.25rem;
    margin: 0 0 1rem 0;
    color: #f1f5f9;
}

.chat-sessions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-session-item {
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    text-decoration: none;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.4);
    transition: all 0.2s ease;
}

.chat-session-item:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    text-decoration: none;
}

.chat-session-item.active {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

.chat-session-item .title {
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.25rem;
}

.chat-session-item .model {
    font-size: 0.85rem;
    color: #94a3b8;
}

.chat-main {
    display: flex;
    flex-direction: column;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    overflow: hidden;
}

.chat-header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
}

.chat-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.chat-header .info {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    padding: 1.25rem;
    border-radius: 12px;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-user {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(147, 51, 234, 0.25));
    border: 1px solid rgba(59, 130, 246, 0.4);
    margin-left: auto;
    border-radius: 16px 16px 4px 16px;
}

.message-assistant {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.25);
    margin-right: auto;
    border-radius: 16px 16px 16px 4px;
}

.message-header {
    font-weight: 700;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.message-user .message-header {
    color: #bfdbfe;
}

.message-assistant .message-header {
    color: #94a3b8;
}

.message-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #e2e8f0;
}

.chat-input-container {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
}

.chat-input-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.chat-input-form textarea {
    flex: 1;
    min-height: 80px;
    max-height: 200px;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.5;
}

.chat-input-form button {
    align-self: flex-end;
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

.chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #94a3b8;
}

.chat-empty h2 {
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}

/* Scrollbar styling for chat */
.chat-messages::-webkit-scrollbar,
.chat-sidebar::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-sidebar::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}