/* static/css/style.css - Premium Modern Minimalist Theme */

:root {
    --bg-color: #0d0f12;            /* Deep Space Dark */
    --panel-color: #16191f;         /* Elegant Dark Gray */
    --card-color: #1e222b;          /* Charcoal Slate */
    --accent-color: #4f46e5;        /* Premium Violet Indigo */
    --accent-glow: rgba(79, 70, 229, 0.15);
    --border-color: #262c36;        /* Subtle Border Gray */
    --text-color: #f3f4f6;          /* Clean White/Light Gray */
    --text-muted: #9ca3af;          /* Slate Gray */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --max-width: 1200px;
}

/* Reset & Basics */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #2b303b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3e4554;
}

/* Containers */
.main-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: rgba(13, 15, 18, 0.75);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

header nav span {
    color: var(--text-muted);
}

header nav a {
    color: var(--text-muted);
}

header nav a:hover {
    color: #ffffff;
}

/* Hero Section (Landing Page) */
.hero-section {
    text-align: center;
    padding: 5rem 1rem 3rem 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-section h1 {
    font-size: 3.5rem;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    background: linear-gradient(to right, #ffffff, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Features Grid */
.features-section {
    padding: 4rem 0;
}

.features-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: #4f46e5;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Tech Stack Section */
.tech-section {
    text-align: center;
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
}

.tech-section h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.tech-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tech-badge {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    background-color: rgba(13, 15, 18, 0.5);
}

/* Forms (Login/Register) */
.form-container {
    max-width: 420px;
    margin: 5rem auto;
    width: 100%;
}

.neo-card {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.neo-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: #ffffff;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.neo-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.neo-button {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.neo-button:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

.neo-button:active {
    transform: translateY(0);
}

.neo-button.secondary {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid var(--border-color);
}

.neo-button.secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Chat Dashboard Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 100px);
    margin: 1rem auto;
}

/* Sidebar Histori */
.sidebar {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
}

.sidebar h2 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

#new-chat-btn {
    width: 100%;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

.history-list {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 1.25rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.8rem;
    margin-bottom: 0.4rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border: 1px solid transparent;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
    color: #ffffff;
}

.history-item.active {
    background-color: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    border-color: var(--border-color);
}

.history-title {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.fav-icon {
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: color 0.2s;
}
.fav-icon:hover {
    color: #fbbf24;
}

.delete-icon {
    font-size: 0.75rem;
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.2s;
}
.delete-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.sidebar-profile {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-username {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-level-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-top: 0.2rem;
    align-self: flex-start;
}

/* Chat Main Screen */
.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--panel-color);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.message {
    padding: 0.9rem 1.25rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    max-width: 80%;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    background-color: var(--card-color);
    color: #ffffff;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.message.assistant {
    background-color: var(--bg-color);
    color: #ffffff;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.message .sender {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.message.loading .message-content {
    animation: blink 1.5s infinite;
}

/* Modern Input Panel */
.chat-input-panel {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.chat-input-area {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#message-input {
    flex-grow: 1;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.chat-input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.selectors-group {
    display: flex;
    gap: 0.5rem;
}

.selectors-group select {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: var(--border-radius-sm);
    outline: none;
    cursor: pointer;
}

.input-utility-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.typing-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.typing-toggle-container input[type="checkbox"] {
    accent-color: var(--text-muted);
    cursor: pointer;
}

/* Codeblocks */
.message-content pre {
    background-color: #050608;
    color: #e6edf3;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.9rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.45;
}

.message-content code {
    font-family: var(--font-mono);
    background-color: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Markdown tables */
.message-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.message-content th, .message-content td {
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.85rem;
}

.message-content th {
    background-color: var(--bg-color);
    font-weight: 700;
}

/* Emoji feedback reactions */
.emoji-reactions {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.3;
}

.emoji-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.15rem 0.45rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.emoji-button:hover {
    border-color: var(--text-muted);
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.03);
}

/* Modals */
.donation-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
}

/* Flash Messages */
.flash-messages {
    max-width: 400px;
    margin: 0 auto 1.5rem auto;
}

/* Credit & Admin */
.credit-content li {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.credit-content li strong {
    color: #ffffff;
    font-size: 1rem;
    display: block;
    margin-bottom: 0.5rem;
}

.neo-button.danger {
    background-color: #2d1618;
    color: #f87171;
    border: 1px solid #451a1d;
}
.neo-button.danger:hover {
    background-color: #451a1d;
}

.neo-button.success {
    background-color: #142f1f;
    color: #34d399;
    border: 1px solid #164e32;
}
.neo-button.success:hover {
    background-color: #164e32;
}

.chat-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.donate-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.donate-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border-color: var(--text-muted);
}

/* Styled Code Block Containers */
.code-block-container {
    background-color: #050608;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.code-block-header {
    background-color: var(--panel-color);
    padding: 0.4rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

.code-block-lang {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.copy-code-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: color 0.2s;
    outline: none;
}

.copy-code-button:hover {
    color: #ffffff;
}

/* Override standard pre styling inside the custom container */
.code-block-container pre {
    margin: 0;
    padding: 0.85rem;
    border: none;
    border-radius: 0;
    background-color: transparent;
}