:root {
    /* Color System - Native Minimalist */
    --bg-color: #ffffff;
    --text-primary: #1f1f1f;
    --text-secondary: #444746;
    --text-tertiary: #80868b;

    --accent-primary: #1a73e8;

    /* Input */
    --input-bg: #f0f4f9;
    --input-hover-bg: #e9eef6;
    --input-focus-bg: #ffffff;
    --input-shadow: 0 2px 6px rgba(60, 64, 67, 0.15);

    /* Thinking Process */
    --thinking-bg: #f8f9fa;
    --thinking-border-color: #e3e3e3;

    /* Layout */
    --max-width: 800px;
    --header-height: 64px;
    --input-max-width: 768px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
    transition: background-color 0.3s;
}

.ambient-bg {
    display: none;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: transparent;
    transition: all 0.3s ease;
}

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

body.initial-state .top-bar .brand {
    opacity: 0;
    pointer-events: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.brand-text h1 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.model-badge {
    display: none;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    scroll-behavior: smooth;
    padding-bottom: 120px;
    opacity: 0;
    transition: opacity 0.5s ease;
    scrollbar-width: none;
    /* Firefox */
}

body:not(.initial-state) .chat-history {
    opacity: 1;
}

/* Hide scrollbar for Chrome, Safari and Edge */
.chat-history::-webkit-scrollbar {
    display: none;
}

/* Messages */
.message {
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-items: flex-end;
}

.message.user .content {
    background: #f0f4f9;
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 20px 20px 4px 20px;
    font-size: 1rem;
    max-width: 80%;
}

.message.ai .content {
    background: transparent;
    color: var(--text-primary);
    padding: 0;
    width: 100%;
    font-size: 1rem;
}

/* Markdown & Typography */
.markdown-body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    line-height: 1.85;
}

.markdown-body p {
    margin-bottom: 1em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 600;
    color: #1f1f1f;
}

.markdown-body pre {
    background: #f6f8fa;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    position: relative;
}

.markdown-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

/* Loading Indicator */
.loading-indicator {
    color: var(--text-secondary);
    font-style: italic;
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

/* Thinking Process Component */
.thinking-process {
    margin-bottom: 24px;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    user-select: none;
}

.thinking-header:hover {
    opacity: 0.7;
}

.thinking-icon-gemini {
    width: 18px;
    height: 18px;
    color: #4285f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thinking-process.is-thinking .thinking-icon-gemini svg {
    animation: spin 2s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

.thinking-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
}

.thinking-toggle-icon {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.thinking-process:not(.collapsed) .thinking-toggle-icon {
    transform: rotate(180deg);
}

.thinking-content {
    padding: 0;
    padding-left: 16px;
    background: transparent;
    border-left: 2px solid #e0e0e0;
    margin-top: 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
    overflow: hidden;
    max-height: 2000px;
    opacity: 1;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

.thinking-process.collapsed .thinking-content {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

/* Action Buttons - Simplified */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    padding: 8px 0;
}

.action-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

.model-info {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    padding: 4px 8px;
}

/* Code Block Copy Button */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dadce0;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    color: var(--text-secondary);
}

pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.code-copy-btn svg {
    width: 14px;
    height: 14px;
}

.code-copy-btn.copied {
    color: #1a73e8;
    border-color: #1a73e8;
}

/* Input Area */
.input-area {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--input-max-width);
    padding: 0 20px;
    z-index: 50;
    transition: all 0.6s cubic-bezier(0.2, 0, 0, 1);
}

body.initial-state .input-area {
    top: 40%;
    bottom: auto;
}

body:not(.initial-state) .input-area {
    top: auto;
    bottom: 24px;
}

.center-brand {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    padding-bottom: 32px;
    width: 100%;
}

body.initial-state .center-brand {
    opacity: 1;
}

.center-brand h1 {
    font-size: 2.5rem;
    font-weight: 500;
    background: linear-gradient(90deg, #4285f4, #9b72cb, #d96570);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.input-wrapper {
    background: var(--input-bg);
    border-radius: 999px;
    padding: 10px 20px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: none;
}

.input-wrapper:hover {
    background: var(--input-hover-bg);
}

.input-wrapper:focus-within {
    background: var(--input-focus-bg);
    box-shadow: var(--input-shadow);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    overflow-y: hidden;
    outline: none;
    font-family: inherit;
    font-size: 1.05rem;
    max-height: 150px;
    padding: 12px 0;
    color: var(--text-primary);
}

#send-btn {
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.05);
}

#send-btn:disabled {
    color: #dadce0;
    cursor: not-allowed;
}

.footer-info {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.5s;
}

body:not(.initial-state) .footer-info {
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal.show {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 400px;
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.modal.show .modal-content {
    transform: scale(1);
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
}

.form-group select {
    background-color: white;
    min-height: 48px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.form-group input::placeholder {
    color: #bdc1c6;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 32px;
}

.primary-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.primary-btn:hover {
    background: #155db5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.primary-btn:active {
    transform: scale(0.98);
}
/* Custom Modal Dialog */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal.show {
    opacity: 1;
}

.custom-modal .modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-modal.show .modal-content {
    transform: scale(1);
}

.custom-modal .modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.custom-modal .modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.custom-modal .modal-body {
    padding: 24px;
}

.custom-modal .modal-body p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.custom-modal .modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.custom-modal .modal-btn {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-modal .modal-btn:hover {
    background: #1a73e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.custom-modal .modal-btn:active {
    transform: translateY(0);
}
