/* Simple Minimalist Style */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-main: #ffffff;
    --bg-sidebar: #f0f4f9;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #e0e0e0;
    --text-main: #1f1f1f;
    --text-muted: #444746;
    --accent: #0066cc;
    --accent-hover: #0052a3;
    --msg-user: #f0f4f9;
    --msg-user-text: var(--text-main);
    --msg-bot: transparent;
    --msg-bot-text: var(--text-main);
}

[data-theme="dark"] {
    --bg-main: #131314;
    --bg-sidebar: #1e1f20;
    --bg-card: #1e1f20;
    --bg-input: #1e1f20;
    --border-color: #333333;
    --text-main: #e3e3e3;
    --text-muted: #c4c7c5;
    --accent: #a8c7fa;
    --accent-hover: #b4d0ff;
    --msg-user: #2a2b2c;
    --msg-user-text: var(--text-main);
    --msg-bot: transparent;
    --msg-bot-text: var(--text-main);
}

/* --- Utility Classes (Replacing Bootstrap) --- */
/* Display & Flexbox */
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.w-100 { width: 100% !important; }

/* Gaps */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* Margins */
.m-0 { margin: 0 !important; }
.me-1 { margin-right: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.ms-auto { margin-left: auto !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }

/* Padding */
.p-2 { padding: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }

/* Typography */
.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }
.fw-semibold { font-weight: 600 !important; }
.small { font-size: 0.875em !important; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: #dc3545 !important; }
.text-center { text-align: center !important; }

/* Borders & Shapes */
.rounded-circle { border-radius: 50% !important; }
.rounded-3 { border-radius: 0.5rem !important; }
.rounded-pill { border-radius: 50rem !important; }

/* Error Button Styles (formerly Bootstrap btn) */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    background-color: transparent;
    cursor: pointer;
}
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}
.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}
.btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
}

/* Responsive Utilities */
@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-flex { display: flex !important; }
}
@media (max-width: 767.98px) {
    .d-md-flex { display: none !important; }
}
/* ------------------------------------------- */

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.gemini-logo-icon i {
    color: var(--accent);
    font-size: 1.1rem;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    overflow: hidden;
}

@media (min-width: 769px) {
    .sidebar.collapsed {
        width: 68px;
    }

    .sidebar.collapsed .sidebar-text,
    .sidebar.collapsed .sidebar-section-title,
    .sidebar.collapsed .history-item-title,
    .sidebar.collapsed .history-item-actions {
        display: none !important;
    }
    
    .sidebar.collapsed .sidebar-header {
        padding: 0 !important;
        justify-content: center !important;
    }
    
    .sidebar.collapsed .sidebar-logo {
        display: none !important;
    }

    .sidebar.collapsed .sidebar-body {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .sidebar.collapsed .sidebar-action-btn,
    .sidebar.collapsed .sidebar-menu-item,
    .sidebar.collapsed .history-item {
        width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        margin: 5px 0 !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }

    .sidebar.collapsed .history-item-content {
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .sidebar.collapsed .sidebar-action-btn i,
    .sidebar.collapsed .sidebar-menu-item i,
    .sidebar.collapsed .history-item i {
        margin: 0 !important;
    }

    .sidebar.collapsed .sidebar-avatar {
        margin: 0 auto;
    }
}

.sidebar-header {
    height: 64px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    margin: 5px 15px;
    padding: 12px 15px;
    background-color: #e8eaed;
    color: var(--text-main);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sidebar-action-btn:hover {
    background-color: #dce1e8;
}

[data-theme="dark"] .sidebar-action-btn {
    background-color: #2a2b2c;
}
[data-theme="dark"] .sidebar-action-btn:hover {
    background-color: #333639;
}

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

.history-item {
    padding: 10px 15px;
    margin: 5px 15px;
    cursor: pointer;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
}

.history-item:hover {
    background-color: #f0f4f9;
}

.history-item.active {
    background-color: #e8eaed; /* Pill background for active */
    border-radius: 20px;
    font-weight: 500;
}

[data-theme="dark"] .history-item:hover {
    background-color: #2a2b2c;
}
[data-theme="dark"] .history-item.active {
    background-color: #333639;
}

.history-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
}

.history-item-actions {
    display: flex;
    gap: 5px;
}

.history-item-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 5px;
}

.history-item-actions button:hover {
    color: var(--text-main);
}

.history-edit-input {
    width: 100%;
    border: 1px solid var(--accent);
    background: var(--bg-input);
    color: var(--text-main);
    padding: 2px 5px;
}

/* Mobile Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}
.sidebar-overlay.show {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        height: 100%;
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    min-width: 0;
}

.top-bar {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-sidebar);
    height: 64px;
}

/* Sidebar Menu Items */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    padding: 0 10px;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    margin: 5px 15px;
    white-space: nowrap;
    transition: background-color 0.2s, justify-content 0.2s, width 0.2s;
}

[data-theme="dark"] .sidebar-section-title {
    color: var(--text-muted) !important;
}

.sidebar-menu-item:hover {
    background-color: #e8eaed;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}

.sidebar-avatar {
    display: flex;
    align-items: center;
    padding: 5px 15px;
    cursor: pointer;
    margin: 0 10px;
    border-radius: 24px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.sidebar-avatar:hover {
    background-color: #e8eaed;
}

.sidebar-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
}

.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.theme-toggle-btn:hover {
    background-color: #e8eaed;
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background-color: #333333;
}

/* Chat Section */
.content-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.chat-section {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-section.welcome-mode {
    justify-content: center;
    background: radial-gradient(circle at center bottom, #e4f0fe 0%, var(--bg-main) 60%);
}
[data-theme="dark"] .chat-section.welcome-mode {
    background: radial-gradient(circle at center bottom, #1a2a40 0%, var(--bg-main) 60%);
}

.chat-section.welcome-mode .chat-container {
    flex: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Search View */
.search-view {
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    display: flex;
    justify-content: center;
    padding-top: 40px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

.search-view-container {
    width: 100%;
    max-width: 830px;
    padding: 0 20px;
}

.search-bar-large {
    border-radius: 28px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
    margin-bottom: 30px;
    transition: box-shadow 0.2s ease-in-out;
}
.search-bar-large:focus-within {
    box-shadow: 0 2px 6px 0 rgba(0,0,0,0.15), 0 2px 4px 0 rgba(0,0,0,0.1);
}

.search-view-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    cursor: pointer;
    color: var(--text-main);
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease-in-out;
}

.search-view-item:hover {
    background-color: #f0f4f9;
    border-radius: 8px;
    padding: 16px 10px;
    margin: 0 -10px;
}

.search-view-item-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.welcome-logo {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 5px;
}

.welcome-title {
    font-size: 36px;
    font-weight: 400;
    margin-bottom: 20px;
    color: var(--text-main);
}

.welcome-subtitle {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.welcome-categories {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.category-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    border-radius: 20px;
}

.category-tab.active, .category-tab:hover {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.welcome-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    text-align: left;
}

@media (max-width: 600px) {
    .welcome-cards {
        grid-template-columns: 1fr;
    }
}

.welcome-card {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
}

.welcome-card:hover {
    border-color: var(--accent);
}

/* Messages */
.message-wrapper {
    display: flex;
    margin-bottom: 25px;
    gap: 15px;
    align-items: flex-start;
}

.message-wrapper.user {
    flex-direction: row-reverse;
}

.avatar {
    display: none !important; /* Gemini hides avatars in this view */
}

.avatar-assistant {
    display: none !important;
}

.avatar-user {
    display: none !important;
}

.message-bubble {
    max-width: 90%;
    padding: 5px 0;
    border-radius: 0;
    line-height: 1.6;
    background-color: transparent;
    color: var(--text-main);
    border: none;
}

.message-wrapper.user .message-bubble {
    background-color: var(--msg-user);
    color: var(--msg-user-text);
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
}

.message-content pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
}

.message-content code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
}

.message-content p > code {
    background-color: rgba(128,128,128,0.2);
    padding: 2px 4px;
    border-radius: 3px;
}

.message-actions {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 10px;
}

.copy-msg-btn, .action-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    border-radius: 50%;
}

.copy-msg-btn:hover, .action-icon-btn:hover {
    color: var(--text-main);
    background: rgba(0,0,0,0.05);
}

.code-header {
    background: #333;
    color: #ccc;
    padding: 5px 10px;
    font-size: 0.8em;
    display: flex;
    justify-content: space-between;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    border-bottom: 1px solid #555;
}

.copy-code-btn {
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
}
.copy-code-btn:hover {
    color: white;
}

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

.input-box {
    display: flex;
    background-color: var(--bg-sidebar);
    border: none;
    border-radius: 28px;
    padding: 8px 16px;
    align-items: center;
    box-shadow: none;
    min-height: 56px;
}

.input-box:focus-within {
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
    background-color: var(--bg-card);
}

[data-theme="dark"] .input-box:focus-within {
    box-shadow: none;
    background-color: #2a2b2c;
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-main);
    padding: 8px;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.add-file-icon, .mic-icon {
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
}
.add-file-icon:hover, .mic-icon:hover {
    color: var(--text-main);
}
.add-file-icon {
    margin-right: 10px;
}

.input-right-actions {
    display: flex;
    align-items: center;
}

.model-badge {
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    background: transparent;
    padding: 4px 8px;
}
.model-badge:hover {
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}

.send-action-btn, .stop-action-btn {
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-action-btn {
    background: #a8c7fa;
    color: #1f1f1f;
}
.send-action-btn:disabled {
    background: #e8eaed;
    color: #aaaaaa;
    cursor: not-allowed;
}

[data-theme="dark"] .send-action-btn:disabled {
    background: #2a2a2a;
    color: #555555;
}

.stop-action-btn {
    background: #e8eaed;
    color: #1f1f1f;
}
.stop-action-btn i {
    font-size: 0.75rem;
}

[data-theme="dark"] .stop-action-btn {
    background: #333333;
    color: #e0e0e0;
}

.disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 5px;
    align-items: center;
}
.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes geminiSlideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
.gemini-animate {
    animation: geminiSlideUp 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
}
