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

:root {
    --sidebar-width: 260px;
    /* Softer, more refined dark grays */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-elevated: #141414;
    /* Refined text hierarchy */
    --text-primary: #fafafa;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-tertiary: rgba(255, 255, 255, 0.4);
    /* Borderless design - very subtle separators */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-subtle: rgba(255, 255, 255, 0.03);
    /* Muted teal accent with purple secondary */
    --accent: #14b8a6;
    --accent-hover: #0d9488;
    --accent-secondary: #8b5cf6;
    --accent-glow: rgba(20, 184, 166, 0.15);
    /* Message backgrounds */
    --user-msg-bg: rgba(255, 255, 255, 0.03);
    --ai-msg-bg: transparent;
    --input-bg: rgba(255, 255, 255, 0.04);
    /* Modal and overlays */
    --modal-bg: rgba(0, 0, 0, 0.8);
    --modal-backdrop: rgba(0, 0, 0, 0.6);
    /* Scrollbar */
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --scrollbar-track: transparent;
    /* Refined shadows with subtle glow */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-glow: 0 0 20px var(--accent-glow), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

html {
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height - accounts for mobile browser chrome */
    overflow: hidden;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Subtle noise texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
}

.user-group {
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.03) 0%, transparent 100%);
    border-radius: 12px;
    margin: 16px 0;
    padding: 24px 20px;
    border: 1px solid rgba(16, 163, 127, 0.08);
}

.ai-group {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, transparent 100%);
    border-radius: 12px;
    margin: 16px 0;
    padding: 24px 20px;
    border: 1px solid rgba(99, 102, 241, 0.08);
}

/* Sidebar - Borderless, refined design */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.new-chat-button {
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.new-chat-button:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.chat-history-item {
    padding: 9px 12px;
    padding-left: 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chat-history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    transition: height 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-history-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    padding-left: 16px;
}

.chat-history-item:hover::before {
    height: 60%;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.wallet-section {
    padding: 14px 16px;
    background: rgba(20, 184, 166, 0.06);
    border: 1px solid rgba(20, 184, 166, 0.12);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.wallet-section:hover {
    background: rgba(20, 184, 166, 0.1);
    border-color: rgba(20, 184, 166, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.1);
}

.wallet-label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    font-weight: 600;
}

.wallet-balance {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: -0.02em;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    z-index: 2;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 200px;
}

.chat-wrapper {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Empty State - Minimal, sophisticated */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 40px 20px;
    text-align: center;
    animation: fadeIn 0.8s ease;
}

.logo-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 32px;
    margin-bottom: 32px;
    box-shadow: 0 12px 32px rgba(20, 184, 166, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    letter-spacing: -0.03em;
}

.empty-state h1 {
    font-size: 48px;
    font-weight: 300;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

/* Messages */
.message-group {
    padding: 32px 0 8px 0; /* Increased top padding, reduced bottom */
    /* Remove: border-bottom: 1px solid var(--border-color); */
}

.message-group:first-child {
    padding-top: 20px; /* Less padding for first message */
}

.message-group:last-child {
    padding-bottom: 20px; /* Consistent bottom padding */
}

.message {
    display: flex;
    gap: 16px;
    margin-bottom: 24px; /* Increased spacing between messages */
    opacity: 0;
    transform: translateY(10px);
    animation: slideInMessage 0.4s ease forwards;
}

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

@keyframes slideInMessage {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
.message:last-child {
    margin-bottom: 0;
}

.message-avatar {
    width: 36px; /* Slightly larger */
    height: 36px;
    border-radius: 8px; /* More rounded */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-avatar {
    background: linear-gradient(135deg, var(--accent), #0d9668);
    color: white;
}

.ai-avatar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.message-content {
    flex: 1;
    line-height: 1.7; /* Improved readability */
    font-size: 15px;
    color: var(--text-primary);
}

.message-content p {
    margin-bottom: 16px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
}

.message-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 16px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* Lists - aligned with normal text */
.message-content ul,
.message-content ol {
    margin: 12px 0;
    padding-left: 0;
    list-style-position: inside;
}

.message-content ul {
    list-style-type: disc;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content li {
    margin-bottom: 8px;
    padding-left: 4px;
    line-height: 1.6;
}

.message-content li:last-child {
    margin-bottom: 0;
}

/* Code blocks */
.code-block {
    position: relative;
    margin: 16px 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.code-language {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.copy-button {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.copy-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.inline-code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Citation Links */
.citation-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    padding: 2px 6px;
    background: rgba(16, 163, 127, 0.1);
    border-radius: 3px;
    border: 1px solid rgba(16, 163, 127, 0.2);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 2px;
}

.citation-link:hover {
    background: rgba(16, 163, 127, 0.2);
    border-color: var(--accent);
}

.citation-link::before {
    content: "🔗";
    font-size: 11px;
    opacity: 0.7;
}

/* Callouts/Admonitions */
.callout {
    border-left: 4px solid;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.02);
}

.callout-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.callout-icon {
    font-size: 16px;
}

.callout-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.callout-content p:last-child {
    margin-bottom: 0;
}

/* Callout Types */
.callout-note {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}
.callout-note .callout-header {
    color: #60a5fa;
}

.callout-tip {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}
.callout-tip .callout-header {
    color: #34d399;
}

.callout-warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}
.callout-warning .callout-header {
    color: #fbbf24;
}

.callout-important {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}
.callout-important .callout-header {
    color: #f87171;
}

.callout-success {
    border-color: var(--accent);
    background: rgba(16, 163, 127, 0.05);
}
.callout-success .callout-header {
    color: var(--accent);
}

/* Markdown Tables */
.table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.markdown-table th,
.markdown-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.markdown-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.markdown-table td {
    color: var(--text-secondary);
}

.markdown-table tbody tr:hover {
    background: var(--bg-hover);
}

.markdown-table tbody tr:last-child td {
    border-bottom: none;
}

/* Typing indicator */
.typing-indicator {
    display: inline-flex;
    gap: 8px;
    padding: 8px 0;
    align-items: center;
}

.thinking-text {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
    transition: opacity 0.15s ease;
    min-width: 180px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input Area - FIXED */
.input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); /* Safe area for notched devices */
    z-index: 100;
    pointer-events: auto;
}

.input-wrapper {
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
}

/* Simple Prompt Bubbles - Floating above input */
.prompt-bubbles {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    opacity: 1;
    max-height: 200px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.prompt-bubbles.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    pointer-events: none;
}

.prompt-bubble {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.prompt-bubble:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(20, 184, 166, 0.3);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Compact Controls Bar */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.model-selector-compact {
    display: flex;
    align-items: center;
}

.model-button-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.model-button-compact:hover {
    background: var(--bg-hover);
}

.model-button-compact svg {
    width: 10px;
    height: 10px;
}

.feature-toggles-compact {
    display: flex;
    gap: 4px;
    align-items: center;
}

.feature-toggle-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.feature-toggle-compact:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.feature-toggle-compact.active {
    background: rgba(16, 163, 127, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.feature-toggle-compact svg {
    width: 16px;
    height: 16px;
}

/* Floating Integrated Input Box - Premium feel */
.input-box-integrated {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    position: relative;
}

.input-box-integrated::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.input-box-integrated:focus-within {
    border-color: rgba(20, 184, 166, 0.3);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.input-box-integrated:focus-within::before {
    opacity: 1;
}

.message-input-integrated {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    padding: 16px 18px 0 18px;
    font-family: inherit;
    min-height: 24px;
    height: auto;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
    word-wrap: break-word;
    white-space: pre-wrap;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.message-input-integrated::-webkit-scrollbar {
    width: 6px;
}

.message-input-integrated::-webkit-scrollbar-track {
    background: transparent;
}

.message-input-integrated::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.message-input-integrated::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

.message-input-integrated::placeholder {
    color: var(--text-tertiary);
    opacity: 0.6;
}

/* Bottom Controls Row */
.input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid transparent;
    position: relative;
    z-index: 2;
}

.input-controls-left,
.input-controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 2;
}

/* Icon Buttons - Refined interactions */
.input-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.input-icon-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.05);
}

.input-icon-button.active {
    background: rgba(20, 184, 166, 0.1);
    color: var(--accent);
}

.file-count-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Model Selector - Simplified and clickable */
.model-selector-integrated {
    position: relative;
    z-index: 100;
    margin-left: 8px;
}

.model-button-integrated {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: rgba(20, 184, 166, 0.1);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    z-index: 100;
}

.model-button-integrated:hover {
    background: rgba(20, 184, 166, 0.15);
    border-color: rgba(20, 184, 166, 0.5);
    transform: scale(1.05);
}

.model-button-integrated:active {
    transform: scale(0.98);
}

/* Model Provider Select - AI provider dropdown */
.model-select-provider {
    padding: 7px 12px;
    background: rgba(20, 184, 166, 0.1);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    margin-left: 8px;
    max-width: 110px;
    position: relative;
    z-index: 100;
}

.model-select-provider:hover {
    background: rgba(20, 184, 166, 0.15);
    border-color: rgba(20, 184, 166, 0.5);
}

.model-select-provider:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.model-select-provider option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 8px;
}

/* Model Tier Select - Smartness level dropdown */
.model-select-tier {
    padding: 7px 12px;
    background: rgba(20, 184, 166, 0.1);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    margin-left: 6px;
    width: auto;
    min-width: 90px;
    max-width: 200px;
    position: relative;
    z-index: 100;
}

.model-select-tier:hover {
    background: rgba(20, 184, 166, 0.15);
    border-color: rgba(20, 184, 166, 0.5);
}

.model-select-tier:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.model-select-tier option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 8px;
}

/* Send Button - Gradient accent */
.send-button-integrated {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 6px;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
    position: relative;
    z-index: 2;
}

.send-button-integrated:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(20, 184, 166, 0.35);
}

.send-button-integrated:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.send-button-integrated:disabled:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
}

/* Attached Files Preview */
.attached-files {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.attached-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
}

.attached-file-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attached-file-icon img {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 3px;
}

.attached-file-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attached-file-size {
    font-size: 11px;
    color: var(--text-tertiary);
}

.attached-file-remove {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s;
}

.attached-file-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.input-box {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    transition: border-color 0.2s;
    /* margin: 0 175px;  Add horizontal margin to make it narrower */
}

.input-box:focus-within {
    border-color: var(--accent);
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 200px;
    font-family: inherit;
    min-height: 24px;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: var(--accent-hover);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Model Selector */
.model-selector {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.model-dropdown {
    position: relative;
}

.model-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 13px;
}

.model-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.model-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    min-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.model-menu.active {
    display: block;
}

.model-category {
    margin-bottom: 12px;
}

.model-category:last-child {
    margin-bottom: 0;
}

.model-category-title {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    margin-bottom: 4px;
}

.model-item {
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.model-item:hover {
    background: var(--bg-hover);
}

.model-item.selected {
    background: var(--bg-hover);
}

.model-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.model-price {
    font-size: 12px;
    color: var(--text-tertiary);
}

.model-badge {
    padding: 2px 6px;
    background: var(--accent);
    color: white;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.cost-info-icon {
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-tertiary);
    transition: all 0.2s;
}

.cost-info-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Modal */
/* Modal - Refined with backdrop blur */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-backdrop);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 22px;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.balance-card {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(13, 148, 136, 0.06));
    border: 1px solid rgba(20, 184, 166, 0.2);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.balance-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    font-weight: 600;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.03em;
}

.credit-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.credit-button {
    padding: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.credit-button:hover {
    background: rgba(20, 184, 166, 0.1);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(20, 184, 166, 0.2);
}

/* Auto-Reload Section */
.auto-reload-section {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.auto-reload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.auto-reload-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.auto-reload-title svg {
    color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Auto-reload settings */
.auto-reload-settings {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.auto-reload-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.auto-reload-row label {
    font-size: 13px;
    color: var(--text-secondary);
}

.auto-reload-row select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    min-width: 80px;
}

.auto-reload-row select:focus {
    outline: none;
    border-color: var(--accent);
}

.saved-payment-method {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(20, 184, 166, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.saved-payment-method .card-icon {
    font-size: 16px;
}

/* Card Setup Form (for adding card without charging) */
.card-setup-form {
    padding: 20px;
}

.setup-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}

#payment-element {
    margin-bottom: 20px;
}

.submit-setup-button {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-setup-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.3);
}

.submit-setup-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.setup-error {
    margin-top: 12px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-size: 13px;
    text-align: center;
}

.api-status {
    background: var(--bg-hover);
    border-radius: 8px;
    padding: 16px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

.status-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Pricing Section */
.pricing-section {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--border-color);
}

.pricing-header {
    margin-bottom: 20px;
}

.pricing-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.pricing-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    font-style: italic;
}

.pricing-tables {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 16px;
}

.pricing-table-wrapper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pricing-table-wrapper:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(20, 184, 166, 0.2);
}

.provider-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.provider-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.provider-icon.chatgpt {
    background: linear-gradient(135deg, #10a37f, #0e8c6f);
}

.provider-icon.claude {
    background: linear-gradient(135deg, #d97757, #c86a4c);
}

.provider-icon.gemini {
    background: linear-gradient(135deg, #4285f4, #357ae8);
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
}

.pricing-table thead th {
    text-align: left;
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.pricing-table tbody td {
    padding: 12px 12px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pricing-table tbody tr:last-child td {
    border-bottom: none;
}

.pricing-table tbody tr:hover {
    background: rgba(20, 184, 166, 0.05);
}

.tier-name {
    font-weight: 600;
    color: var(--text-primary);
}

.tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.tier-badge.smartest {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.tier-badge.smart {
    background: rgba(20, 184, 166, 0.15);
    color: var(--accent);
}

.tier-badge.normal {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
}

.tier-badge.free {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.model-name {
    color: var(--text-secondary);
    font-size: 12px;
}

.model-description {
    color: var(--text-tertiary);
    font-size: 12px;
    line-height: 1.4;
}

.price-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

.price-value.free {
    color: #4ade80;
}

.pricing-note {
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--border-color);
    border-radius: 6px;
    line-height: 1.5;
}

/* Mobile Toggle - Refined */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-toggle:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height on mobile */
        height: -webkit-fill-available; /* iOS Safari fallback */
    }

    html {
        height: -webkit-fill-available; /* iOS Safari fallback */
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 200;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        height: 100%;
        height: 100dvh;
    }

    .chat-container {
        padding-bottom: 160px; /* Reduced for mobile - accounts for smaller input area */
    }

    .chat-wrapper {
        padding: 16px;
        padding-top: 60px; /* Space for mobile toggle button */
    }

    .input-container {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); /* Safe area for notched devices */
    }

    .input-wrapper {
        max-width: 100%;
    }

    .example-prompts {
        grid-template-columns: 1fr;
    }

    /* Prompt bubbles on mobile */
    .prompt-bubbles {
        gap: 6px;
        margin-bottom: 8px;
    }

    .prompt-bubble {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Mobile optimizations for integrated input box */
    .input-box-integrated {
        border-radius: 10px;
    }

    .message-input-integrated {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 14px 0 14px;
        min-height: 20px;
        max-height: 150px; /* Smaller max height on mobile */
        -webkit-user-select: text;
        user-select: text;
        touch-action: manipulation;
    }

    .input-controls {
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .input-controls-left {
        flex: 1;
        flex-wrap: wrap;
        gap: 4px;
    }

    .input-controls-right {
        gap: 4px;
    }

    .model-select-provider {
        max-width: 85px;
        font-size: 11px;
        padding: 6px 8px;
        margin-left: 2px;
    }

    .model-select-tier {
        min-width: 70px;
        max-width: 140px;
        font-size: 11px;
        padding: 6px 8px;
        margin-left: 2px;
    }

    .input-icon-button {
        width: 36px; /* Slightly smaller but still good touch target */
        height: 36px;
    }

    .model-button-integrated {
        padding: 8px 10px;
        font-size: 12px;
        max-width: 120px; /* Prevent overflow on small screens */
    }

    .model-button-integrated span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .send-button-integrated {
        width: 40px; /* Larger touch target */
        height: 40px;
        flex-shrink: 0;
    }

    /* Attached files on mobile */
    .attached-files {
        margin-bottom: 8px;
    }

    .attached-file-name {
        max-width: 100px; /* Smaller on mobile */
    }

    /* Model menu on mobile */
    .model-menu {
        max-height: 50vh; /* Don't take up entire screen */
        left: 50%;
        transform: translateX(-50%);
        width: 90vw;
        max-width: 400px;
    }

    /* Empty state mobile adjustments */
    .empty-state {
        min-height: calc(100vh - 250px);
        min-height: calc(100dvh - 250px);
        padding: 20px;
    }

    .empty-state h1 {
        font-size: 36px;
    }

    .logo-large {
        width: 60px;
        height: 60px;
        font-size: 24px;
        margin-bottom: 20px;
    }

    /* Message styling on mobile */
    .message {
        gap: 12px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .message-content {
        font-size: 14px;
    }

    /* Modal on mobile */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        padding: 20px;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    .input-controls-left {
        gap: 2px;
    }

    .model-select-provider {
        max-width: 75px;
        font-size: 10px;
        padding: 5px 6px;
    }

    .model-select-tier {
        min-width: 60px;
        max-width: 120px;
        font-size: 10px;
        padding: 5px 6px;
    }

    .input-icon-button {
        width: 32px;
        height: 32px;
    }

    .prompt-bubbles {
        display: none; /* Hide prompts on very small screens */
    }

    .chat-wrapper {
        padding: 12px;
        padding-top: 60px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ========== Stripe Embedded Checkout Modal ========== */
.stripe-checkout-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.stripe-checkout-modal.active {
    display: flex;
}

.stripe-checkout-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.stripe-checkout-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    margin: 20px;
    background: var(--bg-elevated);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stripe-checkout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.stripe-checkout-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.stripe-checkout-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stripe-checkout-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.stripe-checkout-container {
    flex: 1;
    overflow-y: auto;
    min-height: 400px;
}

.stripe-checkout-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: var(--text-secondary);
}

.stripe-checkout-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.stripe-checkout-loading p {
    font-size: 14px;
}

/* Style the Stripe embedded checkout iframe container */
#stripe-checkout-container iframe {
    min-height: 400px !important;
}

/* Mobile adjustments for Stripe */
@media (max-width: 600px) {
    .stripe-checkout-content {
        margin: 10px;
        margin-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        max-height: 95vh;
        max-height: 95dvh;
        border-radius: 12px;
    }

    .stripe-checkout-header {
        padding: 16px 20px;
    }

    .stripe-checkout-header h3 {
        font-size: 16px;
    }
}

/* Landscape mode on mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .chat-container {
        padding-bottom: 140px;
    }

    .empty-state {
        min-height: auto;
        padding: 20px;
    }

    .logo-large {
        width: 50px;
        height: 50px;
        font-size: 20px;
        margin-bottom: 12px;
    }

    .empty-state h1 {
        font-size: 28px;
    }

    .input-container {
        padding: 8px 12px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .prompt-bubbles {
        display: none; /* Hide in landscape to save space */
    }

    .message-input-integrated {
        padding: 8px 12px 0 12px;
        max-height: 100px;
    }

    .input-controls {
        padding: 6px 8px;
    }

    .modal-content {
        max-height: 90vh;
        max-height: 90dvh;
    }
}