:root {
    --bg-color: #131314;
    --sidebar-bg: #1e1f20;
    --text-primary: #e3e3e3;
    --text-secondary: #c4c7c5;
    --border-color: #444746;
    --input-bg: #1e1f20;
    --input-bg-focus: #282a2c;
    --hover-bg: #333537;
    --active-bg: #414345;
    --accent-blue: #a8c7fa;
    --gemini-grad: linear-gradient(74deg, #4285f4 0, #9b72cb 9%, #d96570 20%, #d96570 24%, #9b72cb 35%, #4285f4 44%, #9b72cb 50%, #d96570 56%, #131314 75%, #131314 100%);
    --gradient-text: linear-gradient(74deg, #4285f4 0, #9b72cb 9%, #d96570 20%, #d96570 24%, #9b72cb 35%, #4285f4 44%);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Google Sans', 'Inter', sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Icons */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.icon-btn:hover { background: var(--hover-bg); }

/* App Container */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    z-index: 50;
}
.sidebar.collapsed { width: 0; border-right: none; transform: translateX(-100%); }

.sidebar-top {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: none;
    width: 280px; /* Keep content width fixed during transition */
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
}
.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}
.gemini-logo { width: 24px; height: 24px; }
.logo-text { font-size: 18px; font-weight: 500; letter-spacing: -0.5px; }

.nav-links {
    list-style: none;
    padding: 8px 12px;
}
.nav-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}
.nav-links li:hover { background: var(--hover-bg); }
.nav-links li.active { background: var(--active-bg); }
.nav-links li .material-symbols-outlined { font-size: 20px; color: var(--text-secondary); }
.nav-links li.active .material-symbols-outlined { color: var(--text-primary); font-variation-settings: 'FILL' 1; }
.badge { background: #3c4043; font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: auto; color: #9aa0a6; }

.nav-section { margin-top: 10px; }
.nav-section-title {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 24px;
}
.sub-links li { padding: 8px 12px; font-weight: 400; color: var(--text-secondary); }
.sub-links li:hover { color: var(--text-primary); }

.history-section { margin-top: 10px; }
.history-list { list-style: none; padding: 0 12px; }
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item:hover { background: var(--hover-bg); color: var(--text-primary); }

.sidebar-bottom {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    width: 280px;
}
.profile-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}
.profile-area:hover { background: var(--hover-bg); }
.profile-info { flex-grow: 1; }
.profile-name { font-size: 14px; font-weight: 500; }
.profile-tier { font-size: 12px; color: var(--text-secondary); }

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-color);
}

.main-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    z-index: 10;
}
.main-header .logo-container { cursor: pointer; padding: 8px; border-radius: 8px; }
.main-header .logo-container:hover { background: var(--hover-bg); }
.main-header .arrow { font-size: 20px; color: var(--text-secondary); }

.background-glow {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.08) 0%, rgba(155, 114, 203, 0.05) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Chat Container */
.chat-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    z-index: 1;
    position: relative;
}

.welcome-screen {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 10vh;
}
.greeting {
    font-size: 32px;
    font-weight: 400;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    text-align: center;
}

.messages-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Message Styles */
.message { display: flex; gap: 16px; width: 100%; }
.message.user { justify-content: flex-end; }
.message.ai { justify-content: flex-start; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-avatar { background: #384252; color: #a8c7fa; font-weight: 500; font-size: 14px; }
.ai-avatar { background: transparent; position: relative; }

.gemini-star-wrapper {
    width: 32px;
    height: 32px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gemini-star {
    width: 24px;
    height: 24px;
    background: var(--gradient-text);
    background-size: 400% 100%;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 0l1.7 8.3L22 10l-8.3 1.7L12 20l-1.7-8.3L2 10l8.3-1.7L12 0z"/></svg>') no-repeat center;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 0l1.7 8.3L22 10l-8.3 1.7L12 20l-1.7-8.3L2 10l8.3-1.7L12 0z"/></svg>') no-repeat center;
}
.gemini-star.loading { animation: gemini-gradient 2s infinite alternate, spin 1.5s infinite cubic-bezier(0.5, 0, 0.5, 1); }

@keyframes spin {
    0% { transform: rotate(0deg) scale(0.8); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(0.8); }
}
@keyframes gemini-gradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.message-content {
    max-width: 80%;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}
.message.user .message-content {
    background-color: var(--input-bg);
    padding: 12px 18px;
    border-radius: 24px;
    border-bottom-right-radius: 4px;
}
.message.ai .message-content { padding-top: 4px; }

/* Input Box Area */
.center-input-wrapper {
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.bottom-input-container {
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
    padding: 10px 20px 20px;
    background: var(--bg-color);
    z-index: 10;
}

.input-box {
    width: 100%;
    background: var(--input-bg);
    border-radius: 32px;
    padding: 10px 16px;
    display: flex;
    align-items: flex-end;
    border: 1px solid transparent;
    transition: background 0.3s, border 0.3s;
}
.input-box:focus-within { background: var(--input-bg-focus); }

.plus-icon {
    color: var(--text-secondary);
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 24px;
    cursor: pointer;
    font-variation-settings: 'FILL' 1;
}
.plus-icon:hover { color: var(--text-primary); }

textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    resize: none;
    padding: 10px 8px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none;
    line-height: 1.5;
}
textarea:focus { outline: none; }
textarea::placeholder { color: #8e918f; }

.model-selector-container { position: relative; margin-bottom: 4px; margin-left: 8px; }
.model-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #333537;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 16px;
    transition: background 0.2s;
}
.model-selector:hover { background: #444746; }
.model-selector .arrow { font-size: 18px; }

.model-dropdown {
    position: absolute;
    bottom: calc(100% + 10px); /* Open upwards */
    right: 0;
    background: #282a2c;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 0;
    width: 260px;
    display: none;
    flex-direction: column;
    z-index: 20;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.model-dropdown.show { display: flex; }

.model-option {
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.model-option:hover { background: #333537; }
.check-container { width: 24px; display: flex; justify-content: center; padding-top: 2px;}
.model-option .check { display: none; font-size: 20px; color: var(--text-primary); }
.model-option.active .check { display: block; }
.option-text { display: flex; flex-direction: column; gap: 4px; }
.option-title { color: var(--text-primary); font-size: 14px; font-weight: 500; }
.option-desc { color: #8e918f; font-size: 12px; }

.mic-btn, .send-btn { margin-left: 4px; margin-bottom: 4px; }

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

.modal-content {
    background: var(--sidebar-bg);
    padding: 30px;
    border-radius: 28px;
    text-align: center;
    max-width: 400px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.show .modal-content { transform: translateY(0); }
.alert-icon { font-size: 48px; color: #f28b46; margin-bottom: 15px; }
.modal-content h3 { color: var(--text-primary); margin-bottom: 15px; font-size: 22px; font-weight: 500;}
.modal-content p { color: var(--text-secondary); margin-bottom: 30px; line-height: 1.6; font-size: 15px; }
.modal-content button {
    background: var(--accent-blue);
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
.modal-content button:hover { background: #b9d5ff; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { position: fixed; height: 100%; }
    .greeting { font-size: 24px; padding: 0 20px; }
    .chat-container { padding: 0; }
}
