:root {
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --primary-color: #007AFF;
    --text-color: #1d1d1f;
    --secondary-text: #86868b;
    --accent-color: #5E5CE6;
    --danger-color: #FF3B30;
    --success-color: #34C759;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: #fbfbfd;
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.background-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #ff9a9e;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #a18cd1;
    bottom: -150px;
    right: -150px;
    animation-delay: 2s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #fbc2eb;
    top: 40%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, -50px) scale(1.1);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

.app-container {
    width: 95vw;
    height: 90vh;
    display: flex;
    gap: 20px;
    position: relative;
    align-items: center;
}

.floating-menu {
    width: 60px;
    height: fit-content;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 15px;
    align-self: center;
    z-index: 100;
}

.menu-logo {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
}

.menu-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.menu-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--secondary-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-divider {
    width: 30px;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 5px 0;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 120px);
    height: 100%;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.main-content.centered {
    max-width: 90vh;
    max-height: 700px;
    margin: 0 auto;
}

.chat-header {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.model-selector-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.model-selector-wrapper:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.model-selector-wrapper select {
    appearance: none;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    padding-right: 20px;
    cursor: pointer;
    outline: none;
}

.model-selector-wrapper i {
    position: absolute;
    right: 10px;
    pointer-events: none;
    font-size: 0.7rem;
    color: var(--secondary-text);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.history-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 80px;
    top: 20px;
    bottom: 20px;
    z-index: 90;
    transform: translateX(-150%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0;
}

.history-panel.show {
    transform: translateX(0);
    opacity: 1;
}

.panel-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--secondary-text);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.history-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateX(3px);
}

.history-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-delete-btn {
    background: rgba(255, 59, 48, 0.1);
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--danger-color);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.history-item:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    background: var(--danger-color);
    color: white;
}

.history-item.active {
    background: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--secondary-text);
    text-align: center;
}

.logo-animate {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.message-row {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
}

.message-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-row.assistant {
    align-self: flex-start;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.avatar img,
.avatar svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-row.user .message-content {
    background: var(--primary-color);
    color: white;
    border-top-right-radius: 4px;
}

.message-row.assistant .message-content {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-color);
    border-top-left-radius: 4px;
}

.reasoning-block {
    font-size: 0.85rem;
    color: var(--secondary-text);
    background: rgba(0, 0, 0, 0.03);
    border-left: 3px solid var(--accent-color);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-style: italic;
}

.reasoning-header {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reasoning-header i {
    animation: spin 2s linear infinite;
}

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

.markdown-body p {
    margin-bottom: 10px;
}

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

.markdown-body code {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
}

.chat-input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.glass-input {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 8px 16px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.glass-input:focus-within {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.glass-input textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    max-height: 120px;
    padding: 10px 0;
    overflow-y: auto;
}

.glass-input textarea::-webkit-scrollbar {
    width: 4px;
}

.glass-input textarea::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.attach-btn,
.send-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-text);
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.send-btn {
    background: var(--primary-color);
    color: white;
    width: 36px;
    height: 36px;
}

.send-btn:hover {
    background: #0062cc;
    transform: scale(1.05);
}

.send-btn.stop {
    background: var(--danger-color);
}

.send-btn.stop:hover {
    background: #cc0000;
}

.file-preview {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.file-tag {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.file-preview-img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    object-fit: cover;
}

.remove-file-btn {
    background: rgba(255, 59, 48, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 6px;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s;
}

.remove-file-btn:hover {
    background: var(--danger-color);
    transform: scale(1.15);
}

.footer-info {
    position: fixed;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: var(--secondary-text);
    z-index: 10;
    pointer-events: none;
}

.footer-info a {
    color: var(--secondary-text);
    text-decoration: none;
    margin-left: 5px;
    pointer-events: auto;
}

.footer-info a:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

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

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