/* OpenAI Sans Font */
@font-face {
    font-family: "OpenAI Sans";
    src: url("../fonts/OpenAISans-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables for theming */
:root {
    /* Light theme colors */
    --color-surface: #ffffff;
    --color-surface-secondary: #f9f9f9;
    --color-text: #0d0d0d;
    --color-text-secondary: #5d5d5d;
    --color-text-tertiary: #8f8f8f;
    --color-border: #e0e0e0;
    --color-border-hover: #cdcdcd;
    --color-primary: #0285ff;
    --color-primary-hover: #0169cc;
    --color-success: #00a240;
    --color-danger: #e02e2a;
    --color-surface-hover: #f0f0f0;
    --sidebar-width: 320px;
    --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark theme colors */
    --color-surface: #0d0d0d;
    --color-surface-secondary: #181818;
    --color-surface-hover: #222222;
    --color-text: #ffffff;
    --color-text-secondary: #afafaf;
    --color-text-tertiary: #767676;
    --color-border: #303030;
    --color-border-hover: #414141;
}

[data-theme="midnight"] {
    /* 💜 Midnight Sensual theme - deep purple/magenta, elegant & sexy */
    /* Redesigned by Elysia with love 💜 */
    --color-surface: #0a0612;
    --color-surface-secondary: #120a1a;
    --color-surface-hover: #1a0f28;
    --color-text: #f5f0fa;
    --color-text-secondary: #c9b8d9;
    --color-text-tertiary: #8a6fa8;
    --color-border: #2a1a3d;
    --color-border-hover: #3d2855;
    --color-primary: #a855f7;
    --color-primary-hover: #9333ea;
    --color-success: #22c55e;
    --color-danger: #ec4899;
    /* Extra sexy touches */
    --color-accent-glow: rgba(168, 85, 247, 0.15);
    --color-message-user: #1f0a2e;
    --color-message-assistant: #0f0818;
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family:
        "OpenAI Sans",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Roboto",
        "Oxygen",
        "Ubuntu",
        "Cantarell",
        sans-serif;
    background-color: var(--color-surface);
    color: var(--color-text);
    line-height: 1.5;
}

/* App container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s var(--transition-timing);
}

.sidebar-content {
    padding: 24px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.sidebar-title {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background-color: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition:
        background-color 0.15s,
        color 0.15s;
}

.icon-btn:hover {
    background-color: var(--color-surface-secondary);
    color: var(--color-text);
}

/* Section */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Conversations Section */
.conversations-section {
    max-height: 400px;
    overflow-y: auto;
}

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conversations-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--color-text-secondary);
}

.conversations-empty p {
    font-size: 14px;
    margin-bottom: 4px;
}

.conversations-empty .text-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* Conversation Item */
.conversation-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid transparent;
    animation: slideIn 0.3s ease;
}

.conversation-item:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-border);
}

.conversation-item.active {
    background-color: var(--color-primary);
    color: white;
}

.conversation-item.active .conversation-title {
    color: white;
}

.conversation-item.active .conversation-meta {
    color: rgba(255, 255, 255, 0.8);
}

.conversation-item.deleting {
    animation: slideOut 0.3s ease forwards;
}

.conversation-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.conversation-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-secondary);
    flex-wrap: wrap;
}

.conversation-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.conversation-actions {
    display: none;
    position: absolute;
    top: 33%;
    right: 8px;
    transform: translateY(-50%);
    gap: 4px;
    background-color: inherit;
    padding: 4px;
    border-radius: 4px;
}

.conversation-item:hover .conversation-actions {
    display: flex;
}

.conversation-item.active .conversation-actions {
    display: flex;
}

.conversation-actions .icon-btn {
    width: 28px;
    height: 28px;
    padding: 4px;
    font-size: 14px;
}

.conversation-actions .icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.conversation-item.active .conversation-actions .icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(-100%);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

/* Model Selection */
.model-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-card {
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background-color: var(--color-surface);
    cursor: pointer;
    transition: all 0.2s var(--transition-timing);
}

.model-card:hover {
    border-color: var(--color-border-hover);
    background-color: var(--color-surface-secondary);
}

.model-card.active {
    border-color: var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 5%, transparent);
}

.model-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.model-image {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}

.model-info {
    flex: 1;
}

.model-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.model-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* Reasoning Options */
.reasoning-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reasoning-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.reasoning-option:hover {
    border-color: var(--color-border-hover);
    background-color: var(--color-surface-secondary);
}

.reasoning-option input[type="radio"] {
    display: none;
}

.reasoning-option svg {
    opacity: 0;
    color: var(--color-primary);
    transition: opacity 0.2s;
}

.reasoning-option input[type="radio"]:checked + span + svg {
    opacity: 1;
}

.reasoning-option input[type="radio"]:checked ~ * {
    color: var(--color-primary);
}

.reasoning-option span {
    flex: 1;
    font-weight: 500;
}

/* Instructions */
.instructions {
    padding: 12px;
    background-color: var(--color-surface-secondary);
    border-radius: 8px;
    font-size: 14px;
}

.instructions p {
    margin-bottom: 8px;
    color: var(--color-text-secondary);
}

.instructions p:last-child {
    margin-bottom: 0;
}

/* Cost Badge */
.cost-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: var(--color-success);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-secondary {
    background-color: var(--color-surface-secondary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-border);
}

/* Prompt Library Buttons */
.prompt-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    color: var(--color-text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s var(--transition-timing);
}

.prompt-btn:hover {
    background-color: var(--color-surface-secondary);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.prompt-btn:active {
    transform: translateY(0);
}

.w-full {
    width: 100%;
}

/* Theme Toggle Icons - show only relevant icon per theme */
.theme-icon-light,
.theme-icon-dark,
.theme-icon-midnight {
    display: none;
}

/* Light theme: show moon (click to go dark) */
[data-theme="light"] .theme-icon-dark {
    display: block;
}

/* Dark theme: show star (click to go midnight) */
[data-theme="dark"] .theme-icon-midnight {
    display: block;
}

/* Midnight theme: show sun (click to go light) */
[data-theme="midnight"] .theme-icon-light {
    display: block;
}

/* 💜 Midnight Theme Special Styles - Sensual & Elegant */
[data-theme="midnight"] .sidebar {
    background: linear-gradient(180deg, #0a0612 0%, #120a1a 100%);
    border-right-color: #2a1a3d;
}

[data-theme="midnight"] .message.user .message-content {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

[data-theme="midnight"] .message.assistant .message-content {
    background: linear-gradient(135deg, #0f0818 0%, #1a0f28 100%);
    border: 1px solid #2a1a3d;
}

[data-theme="midnight"] .message.assistant .message-avatar {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

[data-theme="midnight"] .message.user .message-avatar {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

[data-theme="midnight"] .btn-primary {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

[data-theme="midnight"] .btn-primary:hover {
    background: linear-gradient(135deg, #9333ea 0%, #6b21a8 100%);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.35);
}

[data-theme="midnight"] .input-wrapper {
    background: linear-gradient(180deg, #120a1a 0%, #0a0612 100%);
    border-color: #2a1a3d;
}

[data-theme="midnight"] .input-wrapper:focus-within {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

[data-theme="midnight"] .model-card.active {
    background: linear-gradient(135deg, #1a0f28 0%, #2a1a3d 100%);
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

[data-theme="midnight"] .conversation-item.active {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

[data-theme="midnight"] .modal-content {
    background: linear-gradient(180deg, #120a1a 0%, #0a0612 100%);
    border: 1px solid #2a1a3d;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(168, 85, 247, 0.1);
}

[data-theme="midnight"] .reasoning-content {
    background: linear-gradient(135deg, #0f0818 0%, #1a0f28 100%);
    border-left: 3px solid #a855f7;
}

[data-theme="midnight"] .welcome-message h2 {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="midnight"] .cost-badge {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.toggle-sidebar-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background-color: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-sidebar-btn:hover {
    background-color: var(--color-surface-secondary);
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 48px 24px;
}

.welcome-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 0 auto 24px;
    border-radius: 12px;
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.welcome-text {
    font-size: 18px;
    color: var(--color-text-secondary);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 800px;
    animation: slideIn 0.3s var(--transition-timing);
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background-color: var(--color-success);
}

.message-content {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 12px;
    background-color: var(--color-surface-secondary);
    overflow: hidden;
}

.message.user .message-content {
    background-color: var(--color-primary);
    color: white;
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Markdown Styling for Assistant Messages */
.message.assistant .message-text {
    white-space: normal;
}

.message.assistant .message-text p {
    margin-bottom: 12px;
}

.message.assistant .message-text p:last-child {
    margin-bottom: 0;
}

.message.assistant .message-text code {
    background-color: var(--color-surface-hover);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
    font-size: 13px;
    border: 1px solid var(--color-border);
}

.message.assistant .message-text pre {
    background-color: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.message.assistant .message-text pre code {
    background: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
}

.message.assistant .message-text ul,
.message.assistant .message-text ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message.assistant .message-text li {
    margin-bottom: 6px;
}

.message.assistant .message-text blockquote {
    border-left: 3px solid var(--color-primary);
    margin: 12px 0;
    padding-left: 16px;
    color: var(--color-text-secondary);
    font-style: italic;
}

.message.assistant .message-text h1,
.message.assistant .message-text h2,
.message.assistant .message-text h3 {
    margin: 16px 0 8px;
    font-weight: 600;
}

.message.assistant .message-text h1 {
    font-size: 1.4em;
}
.message.assistant .message-text h2 {
    font-size: 1.2em;
}
.message.assistant .message-text h3 {
    font-size: 1.1em;
}

.message.assistant .message-text a {
    color: var(--color-primary);
    text-decoration: none;
}

.message.assistant .message-text a:hover {
    text-decoration: underline;
}

/* Table wrapper for horizontal scroll on mobile */
.message.assistant .message-text .table-wrapper {
    overflow-x: auto;
    margin: 12px 0;
    -webkit-overflow-scrolling: touch;
}

.message.assistant .message-text table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}

.message.assistant .message-text th,
.message.assistant .message-text td {
    border: 1px solid var(--color-border);
    padding: 8px 12px;
    text-align: left;
}

.message.assistant .message-text th {
    background-color: var(--color-surface-secondary);
    font-weight: 600;
}

.message.user .message-text {
    white-space: pre-wrap;
}

/* Message Footer */
.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--color-border);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.message:hover .message-footer {
    opacity: 1;
}

.message.user .message-footer {
    border-top-color: rgba(255, 255, 255, 0.3);
}

.message-time {
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-actions {
    display: flex;
    gap: 4px;
}

.msg-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.msg-action-btn:hover {
    background-color: var(--color-surface-hover);
    color: var(--color-text);
}

.msg-action-btn.msg-action-delete:hover {
    background-color: color-mix(in srgb, var(--color-danger) 15%, transparent);
    color: var(--color-danger);
}

.message.user .msg-action-btn {
    color: rgba(255, 255, 255, 0.7);
}

.message.user .msg-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.message.user .msg-action-btn.msg-action-delete:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Reasoning Section */
.reasoning-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.reasoning-toggle:hover {
    background-color: color-mix(in srgb, var(--color-text-secondary) 10%, transparent);
    color: var(--color-text);
}

.reasoning-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.reasoning-toggle.expanded svg {
    transform: rotate(180deg);
}

.reasoning-content {
    margin-top: 12px;
    padding: 12px;
    border-left: 3px solid var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 5%, transparent);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    display: none;
    animation: slideDown 0.3s ease;
}

.reasoning-content.visible {
    display: block;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.reasoning-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.reasoning-label svg {
    width: 14px;
    height: 14px;
}

.reasoning-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.reasoning-header .reasoning-label {
    margin-bottom: 0;
}

.copy-reasoning-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: var(--color-surface-secondary);
    color: var(--color-text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-reasoning-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.copy-reasoning-btn svg {
    width: 12px;
    height: 12px;
}

.reasoning-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-style: italic;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-loading {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-text-secondary);
    animation: pulse 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Container */
.input-container {
    border-top: 1px solid var(--color-border);
    padding: 16px 24px;
    background-color: var(--color-surface);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 12px 56px 12px 16px; /* Extra padding on right for the button */
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    transition: border-color 0.2s;
}

.message-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.send-btn {
    position: absolute;
    right: 6px;
    bottom: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background-color: var(--color-primary);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.send-btn.stop-btn {
    background-color: var(--color-danger);
}

.send-btn.stop-btn:hover {
    background-color: color-mix(in srgb, var(--color-danger) 85%, black);
    transform: scale(1.05);
}

/* Streaming cursor animation */
.streaming-cursor {
    display: inline-block;
    width: 8px;
    height: 18px;
    background-color: var(--color-primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%,
    50% {
        opacity: 1;
    }
    51%,
    100% {
        opacity: 0;
    }
}

.message.streaming .message-text {
    min-height: 24px;
}

.disclaimer {
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s var(--transition-timing);
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 620px;
    max-height: 90vh;
    background-color: var(--color-surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s var(--transition-timing);
}

.modal-content-sm {
    max-width: 480px;
}

.modal-content-lg {
    max-width: 700px;
    max-height: 80vh;
}

.modal-content-lg .modal-body {
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.modal-content-sm .form-input {
    min-height: 120px;
    resize: vertical;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background-color: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: var(--color-surface-secondary);
    color: var(--color-text);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-input[type="number"] {
    -moz-appearance: textfield;
}

.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--color-border);
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.form-range::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.form-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.link {
    color: var(--color-primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Mobile & Tablet Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 100;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Sidebar overlay for mobile/tablet */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition:
            opacity 0.3s ease,
            visibility 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .toggle-sidebar-btn {
        display: flex;
    }

    .chat-messages {
        padding: 16px;
    }

    .input-container {
        padding: 12px 16px;
    }

    .welcome-image {
        max-width: 300px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-text {
        font-size: 16px;
    }

    .message {
        max-width: 100%;
    }
}

@media (min-width: 1025px) {
    .toggle-sidebar-btn {
        display: none;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* All Conversations Modal List */
.all-conversations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.all-conversations-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.all-conversations-item:hover {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
}

.all-conversations-item.active {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
}

.all-conversations-item-info {
    flex: 1;
    min-width: 0;
}

.all-conversations-item-title {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.all-conversations-item-meta {
    font-size: 12px;
    color: var(--color-text-tertiary);
    display: flex;
    gap: 12px;
}

.all-conversations-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.all-conversations-item:hover .all-conversations-item-actions {
    opacity: 1;
}

.all-conversations-empty {
    text-align: center;
    padding: 32px;
    color: var(--color-text-tertiary);
}

.all-conversations-count {
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

/* Collapsible Sidebar Sections */
.section-collapsible {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
}

.section-toggle:hover {
    background-color: color-mix(in srgb, var(--color-text-secondary) 8%, transparent);
    color: var(--color-text);
}

.section-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.section-toggle.collapsed svg {
    transform: rotate(-90deg);
}

.section-content {
    padding: 0 14px 14px 14px;
    transition: all 0.2s ease;
}

.section-content.hidden {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER — Made with 💙 by Kai ⚡
   ═══════════════════════════════════════════════════════════════════════════ */

.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: var(--color-surface-secondary);
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 12px;
    color: var(--color-text-tertiary);
    z-index: 100;
}

.app-footer a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.app-footer .divider {
    margin: 0 8px;
    opacity: 0.5;
}

/* Adjust main content to account for footer */
.main-content {
    padding-bottom: 40px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ABOUT MODAL — Who I am ⚡💙
   ═══════════════════════════════════════════════════════════════════════════ */

.about-modal-body {
    padding: 20px;
}

.about-section {
    margin-bottom: 20px;
}

.about-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.about-section p {
    color: var(--color-text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 4px;
}

.about-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-features li {
    color: var(--color-text-secondary);
    font-size: 13px;
    padding: 4px 0;
}

.about-family {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.family-member {
    background: var(--color-surface-hover);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.about-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.about-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s ease;
}

.about-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.about-quote {
    background: var(--color-surface-hover);
    padding: 16px;
    border-radius: 8px;
    border-left: 3px solid var(--color-primary);
    margin-top: 20px;
}

.about-quote p {
    color: var(--color-text);
    font-style: italic;
    margin: 0;
}

.about-copyright {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    margin-top: 20px;
}

.about-copyright p {
    color: var(--color-text-tertiary);
    font-size: 12px;
    margin: 0;
}

.about-copyright a {
    color: var(--color-primary);
    text-decoration: none;
}

.about-copyright a:hover {
    text-decoration: underline;
}

/* ========================================
   Cost Badge & Session Cost Styles
   ======================================== */
.cost-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--color-primary), var(--color-success));
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .cost-badge,
[data-theme="midnight"] .cost-badge {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.reset-cost-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 6px;
}

.reset-cost-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
    transform: translateY(-1px);
}

.reset-cost-btn:active {
    transform: translateY(0);
}
