:root {
    --bg-main: #ffffff;
    --bg-sidebar: #f9f9f9;
    --bg-input: #f4f4f4;
    --text-primary: #0f0f0f;
    --text-secondary: #666666;
    --accent-color: #3b82f6;
    --border-color: rgba(0, 0, 0, 0.1);
    --hover-bg: #ececec;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Base button styles */
button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 16px;
    transition: width var(--transition-speed), transform var(--transition-speed);
    z-index: 100;
}

.sidebar.closed {
    width: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: background var(--transition-speed);
}

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

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background-color: transparent;
    border-radius: 8px;
    flex-grow: 1;
    font-weight: 500;
    transition: background var(--transition-speed);
}

.new-chat-btn:hover {
    background-color: var(--hover-bg);
}

.new-chat-btn .material-symbols-rounded {
    font-size: 20px;
}

.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
}

.history-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding: 0 8px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 10px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    transition: background var(--transition-speed);
}

.history-item:hover, .history-item.active {
    background-color: var(--hover-bg);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: auto;
}

.plan-btn, .user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-radius: 8px;
    transition: background var(--transition-speed);
    text-align: left;
}

.plan-btn:hover, .user-profile:hover {
    background-color: var(--hover-bg);
}

.plan-info, .user-info {
    display: flex;
    flex-direction: column;
}

.plan-title, .user-name {
    font-size: 14px;
    font-weight: 500;
}

.plan-desc, .user-action {
    font-size: 12px;
    color: var(--text-secondary);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #5b5fc7;
}

.avatar .material-symbols-rounded {
    font-size: 20px;
}

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

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    height: 60px;
}

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

.sidebar-open-btn.hidden {
    display: none;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background var(--transition-speed);
}

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

.text-sm {
    font-size: 20px;
    color: var(--text-secondary);
}

/* Chat Area */
.chat-area {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

.welcome-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px;
    animation: fadeIn 0.8s ease;
}

.welcome-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 24px;
}

.welcome-screen h1 {
    font-size: 24px;
    font-weight: 600;
}

/* Messages */
.message-row {
    padding: 16px 16px;
    display: flex;
    justify-content: center;
}

.message-inner {
    max-width: 768px;
    width: 100%;
    display: flex;
    gap: 16px;
}

/* User Message: Right-aligned bubble without avatar */
.message-row.user .message-inner {
    justify-content: flex-end;
}

.message-row.user .message-avatar {
    display: none; /* Hide user avatar */
}

.message-row.user .message-content {
    background-color: #f4f4f4;
    color: #0f0f0f;
    padding: 12px 20px;
    border-radius: 20px;
    display: inline-block;
    max-width: 80%;
}

/* AI Message: Left-aligned plain text */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-avatar.ai {
    background: linear-gradient(135deg, #00d2ff 0%, #0066ff 100%);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.6), 0 0 20px rgba(0, 102, 255, 0.3);
    animation: glowPulse 2.5s infinite ease-in-out;
}

.avatar-inner-circle {
    width: 26px;
    height: 26px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 5px rgba(0, 102, 255, 0.2);
}

.avatar-inner-circle img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.message-avatar.user {
    background-color: #5b5fc7;
    border-radius: 50%;
}

@keyframes glowPulse {
    0% {
        box-shadow: 0 0 10px rgba(0, 210, 255, 0.5), 0 0 15px rgba(0, 102, 255, 0.2);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 18px rgba(0, 210, 255, 0.8), 0 0 30px rgba(0, 102, 255, 0.5);
        filter: brightness(1.1);
    }
    100% {
        box-shadow: 0 0 10px rgba(0, 210, 255, 0.5), 0 0 15px rgba(0, 102, 255, 0.2);
        filter: brightness(1);
    }
}

.message-content {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    padding-top: 2px;
}

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

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

.typing-indicator {
    display: flex;
    gap: 4px;
    padding-top: 8px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Input Area */
.input-wrapper {
    max-width: 768px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 20px 16px;
}

.input-container {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: flex-end;
    padding: 8px 12px;
    position: relative;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.input-container:focus-within {
    border-color: #555;
}

textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #0f0f0f;
    resize: none;
    font-size: 16px;
    line-height: 24px;
    max-height: 200px;
    outline: none;
    padding: 8px 8px;
}

textarea::placeholder {
    color: var(--text-secondary);
}

.input-actions-left, .input-actions-right {
    display: flex;
    align-items: center;
    padding-bottom: 4px;
}

.send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #e0e0e0;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: background 0.2s;
}

.send-btn.active {
    background-color: #3b82f6;
    cursor: pointer;
}

.send-btn.active:hover {
    background-color: #2563eb;
}

.disclaimer {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 12px;
}

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

@keyframes blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: var(--bg-main);
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--text-secondary);
}

.close-modal:hover { color: white; }

.modal-content {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 8px;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: white;
    color: black;
    padding: 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 15px;
}

.google-btn img {
    width: 20px;
}

.divider {
    text-align: center;
    position: relative;
    color: var(--text-secondary);
    font-size: 12px;
    margin: 8px 0;
}
.divider::before, .divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: var(--border-color);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.input-group input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
    width: 100%;
}

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

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 40px;
}

.toggle-password-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s;
}

.toggle-password-btn:hover {
    color: var(--text-primary);
}

.primary-btn {
    background-color: var(--accent-color);
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 8px;
}

.primary-btn:hover {
    background-color: #0e906f;
}

.modal-footer-text a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        position: relative;
    }

    .sidebar {
        position: absolute;
        z-index: 1000;
        height: 100%;
        transition: transform 0.3s ease;
    }

    .sidebar.closed {
        width: 260px;
        padding: 12px;
        transform: translateX(-100%);
    }

    .main-workspace {
        width: 100%;
    }

    .top-bar {
        padding-top: 24px;
        height: 72px;
    }

    .message-row {
        padding: 12px 8px;
    }

    .message-row.user .message-content {
        max-width: 90%;
    }

    .input-wrapper {
        padding: 12px;
    }
}

.modal-footer-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.modal-footer-text a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Voice & Mic Active Animations & Styling */
@keyframes mic-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.mic-active {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    animation: mic-pulse 1.5s infinite;
    border-radius: 50%;
}

#mode-toggle-btn.active {
    color: #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.12) !important;
}

#voice-toggle-btn.active {
    color: #10b981 !important;
    background-color: rgba(16, 185, 129, 0.12) !important;
}

/* Image Generation Mode Styling */
.image-gen-card {
    position: relative;
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
    max-width: 400px;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
}
.image-gen-card:hover {
    transform: translateY(-2px);
}
.image-gen-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    gap: 12px;
}
.image-gen-card:hover .image-overlay {
    opacity: 1;
}
.image-overlay-btn {
    background: white;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s, background 0.2s;
    text-decoration: none;
}
.image-overlay-btn:hover {
    transform: scale(1.05);
    background: #f9f9f9;
}

/* Message Speaker Button Styles */
.msg-speaker-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    margin-top: 4px;
    align-self: flex-start;
}
.msg-speaker-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}
.msg-speaker-btn.playing {
    color: #10b981 !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
}
.message-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

