/* Modern Enterprise UI - Similar to Claude.ai / ChatGPT */

* {
    box-sizing: border-box;
}

:root {
    --ai-mobile-header-height: 0px;
    --ai-admin-bar-offset: 0px;
}

body.admin-bar {
    --ai-admin-bar-offset: 32px;
}

@media (max-width: 1024px) {
    :root {
        --ai-mobile-header-height: 60px;
    }
}

@media (max-width: 782px) {
    body.admin-bar {
        --ai-admin-bar-offset: 46px;
    }
}

/* Prevent whole-page scrolling when using AI comparison interface - DESKTOP ONLY */
@media (min-width: 1025px) {
    body:has(.ai-modern-container) {
        overflow: hidden;
        height: 100vh;
    }
}

.ai-modern-container {
    display: flex;
    height: 100vh;
    width: 100%;
    max-width: 100vw;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #fff;
    color: #0d0d0d;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.ai-sidebar {
    width: 260px;
    height: 100vh;
    background: #f9f9f9;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
}

.ai-sidebar-logo {
    padding: 16px 12px 12px 12px;
    display: flex;
    align-items: center;
}

.ai-sidebar-logo .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.ai-sidebar-logo .logo-link:hover {
    opacity: 0.8;
}

.ai-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #e5e5e5;
}

.new-conversation-btn {
    width: 100%;
    padding: 10px 14px;
    background: #0d0d0d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.new-conversation-btn:hover:not(:disabled) {
    background: #2d2d2d;
}

.new-conversation-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-item:hover {
    background: #e5e5e5;
}

.conversation-item.active {
    background: #e5e5e5;
}

.conversation-title {
    font-size: 14px;
    color: #0d0d0d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.conversation-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
    visibility: visible;
}

.conversation-action-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    border-radius: 4px;
}

.conversation-action-btn:hover {
    background: rgba(0,0,0,0.1);
}

.sidebar-message {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.sidebar-message a {
    color: #0d0d0d;
    text-decoration: underline;
}

.loading-conversations {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.ai-sidebar-footer {
    padding: 12px;
    border-top: 1px solid #e5e5e5;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: #f9f9f9;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-menu-btn:hover {
    background: #e5e5e5;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0d0d0d;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #0d0d0d;
    flex: 1;
    text-align: left;
}

.user-menu-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.user-menu-dropdown a {
    display: block;
    padding: 12px;
    color: #0d0d0d;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.user-menu-dropdown a:hover {
    background: #f5f5f5;
}

.login-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #0d0d0d;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.login-btn:hover {
    background: #2d2d2d;
}

/* ===== MAIN AREA ===== */
.ai-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 999;
    background: #0d0d0d;
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Welcome Screen */
.ai-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.welcome-content {
    max-width: 1200px;
    width: 100%;
    text-align: center;
    padding: 0 20px;
}

.welcome-content h1 {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #0d0d0d;
}

.welcome-content > p {
    font-size: 20px;
    color: #666;
    margin-bottom: 32px;
}

.cta-button {
    display: inline-block;
    padding: 14px 28px;
    background: #0d0d0d;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 48px;
}

.cta-button:hover {
    background: #2d2d2d;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.feature-item {
    text-align: center;
    padding: 24px;
}

.feature-item svg {
    margin-bottom: 16px;
    color: #0d0d0d;
}

.feature-item h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #0d0d0d;
}

.feature-item p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* Chat Container */
.ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.ai-messages {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 20px;
    padding-bottom: 100px;
    min-height: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.ai-messages > * {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #666;
    height: 100%;
    padding: 40px 20px;
}

.empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #0d0d0d;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 24px;
}

.empty-state-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 14px 14px 14px 18px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.empty-state-input-wrapper textarea {
    flex: 1;
    border: none;
    background: white;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    padding: 8px 0;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
}

.empty-state-input-wrapper textarea:focus {
    outline: none;
}

/* Message Groups */
.message-group {
    margin-bottom: 32px;
}

.user-message {
    background: #f4f4f4;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    width: 100%;
}

.user-message-header {
    margin-bottom: 8px;
}

.user-message-time {
    font-size: 11px;
    color: #999;
}

.user-message-text {
    font-size: 15px;
    line-height: 1.6;
    color: #0d0d0d;
}

.ai-responses {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: start;
}

.ai-response-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 600px;
}

.response-header {
    padding: 12px 16px;
    background: #f9f9f9;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.response-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.response-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: #0d0d0d;
    margin: 0;
}

.model-name {
    font-size: 11px;
    color: #999;
    font-weight: 400;
}

.response-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.response-time,
.response-duration {
    font-size: 11px;
    color: #999;
}

.response-duration {
    font-weight: 500;
    color: #666;
}

.reply-btn {
    background: none;
    border: 1px solid #e5e5e5;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: #0d0d0d;
    transition: all 0.2s;
}

.reply-btn:hover {
    background: #f4f4f4;
}

.response-content {
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    color: #0d0d0d;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.response-error {
    padding: 16px;
    color: #d93025;
    font-size: 14px;
}

/* Input Area */
.ai-input-container {
    padding: 0;
    padding-bottom: 20px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    z-index: 10;
    pointer-events: none;
}

.ai-input-container > * {
    width: 100%;
    max-width: 1200px;
    padding: 0;
    pointer-events: auto;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 14px 14px 14px 18px;
    position: relative;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

#prompt-input {
    flex: 1;
    border: none;
    background: white;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    padding: 8px 0;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
}

#prompt-input:focus {
    outline: none;
}

#prompt-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #0d0d0d;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: #2d2d2d;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    text-align: center;
}

.input-hint-inline {
    display: none;
}

/* Demo CTA Button (for landing page) */
.demo-cta-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: #0d0d0d;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.demo-cta-button:hover {
    background: #2d2d2d;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.demo-cta-button svg {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .ai-responses {
        grid-template-columns: 1fr;
    }

    .ai-messages > *,
    .ai-input-container > * {
        max-width: 700px;
    }

    .ai-response-card {
        max-height: 800px;
    }
}

/* Mobile header bar */
.mobile-header {
    display: none;
}

@media (max-width: 1024px) {
    /* Allow body scrolling on mobile and tablets */
    .ai-modern-container {
        height: auto;
        min-height: 100vh;
        flex-direction: column;
    }

    /* Mobile header bar */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: var(--ai-admin-bar-offset, 0px);
        left: 0;
        right: 0;
        height: var(--ai-mobile-header-height);
        background: white;
        border-bottom: 1px solid #e5e5e5;
        padding: 0 16px;
        z-index: 1002;
    }

    /* Fix double-tap issue: hide conversation action buttons on mobile entirely */
    .conversation-actions {
        display: none !important;
    }

    /* Remove hover state on conversation items since action buttons are hidden */
    .conversation-item:hover .conversation-actions {
        opacity: 0;
        visibility: hidden;
    }

    .mobile-header-logo {
        display: flex;
        align-items: center;
    }

    .mobile-header-logo a {
        display: flex;
        align-items: center;
    }

    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: static;
        background: #0d0d0d;
        border: none;
        padding: 0;
        width: 48px;
        height: 32px;
        border-radius: 6px;
        cursor: pointer;
    }

    .mobile-menu-toggle svg {
        color: white;
        stroke: white;
        width: 20px;
        height: 20px;
    }

    /* Sidebar on mobile */
    .ai-sidebar {
        position: fixed;
        left: -260px;
        z-index: 1001;
        transition: left 0.3s;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px; /* Extra space for sticky footer to fully enter viewport */
        padding-top: 60px; /* Match mobile header height to push "New Chat" below navbar */
    }

    .ai-sidebar.open {
        left: 0;
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }

    /* Hide logo on mobile (it's in the mobile header) */
    .ai-sidebar-logo {
        display: none;
    }

    /* Disable nested scroll - let sidebar be the scroll container */
    .ai-conversations-list {
        overflow-y: visible;
        flex: 0 1 auto; /* Allow it to grow naturally, not force flex:1 */
    }

    /* Keep footer sticky at bottom on mobile */
    .ai-sidebar-footer {
        position: sticky;
        bottom: 0;
        margin-bottom: -80px; /* Offset the sidebar padding so footer stays at true bottom */
    }

    .input-hint-inline {
        display: none;
    }

    /* Sidebar overlay - real element instead of ::before */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.3);
        z-index: 1000;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Welcome screen on mobile */
    .ai-chat-container.welcome-screen {
        padding-top: 0;
    }

    .welcome-content {
        padding-top: 40px;
    }

    .welcome-content h1 {
        font-size: 32px;
    }

    /* Messages container on mobile */
    .ai-messages {
        padding: 12px;
        padding-bottom: 100px; /* Extra space for sticky input box */
    }

    .ai-messages > * {
        max-width: 100%;
        padding: 0 12px;
    }

    /* Sticky input box at bottom on mobile (for logged-in users) */
    .ai-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e5e5;
        padding: 12px 16px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 100;
        pointer-events: auto;
    }

    .ai-input-container > * {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .input-wrapper {
        border-radius: 8px;
        padding: 12px 14px;
    }

    #prompt-input {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 20px;
        max-height: 100px; /* Smaller on mobile */
    }

    /* Main content area on mobile */
    .ai-main {
        flex: 1;
        width: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: calc(var(--ai-mobile-header-height) + var(--ai-admin-bar-offset, 0px)); /* Space for fixed header + admin bar */
        position: relative; /* Needed for absolute positioned children (settings panels) */
    }

    /* Chat containers on mobile (both demo and real conversations) */
    .ai-chat-container {
        padding-top: 0;
        height: auto;
        min-height: calc(100vh - 60px);
    }

    .conversation-title-section {
        padding: 16px;
        border-bottom: 1px solid #e5e5e5;
    }

    .conversation-title {
        font-size: 20px;
        font-weight: 600;
        padding: 0;
        text-align: center;
    }

    /* Demo-specific overrides */
    #demo-chat-container .ai-messages {
        padding: 12px;
        padding-bottom: 180px;
        height: auto;
        overflow-y: visible;
    }

    /* Hide demo input container on mobile, will use sticky buttons instead */
    #demo-chat-container .ai-input-container {
        display: none;
    }

}

/* Mobile sticky buttons (bottom of screen) */
.mobile-sticky-buttons {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e5e5;
    padding: 12px 16px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 1024px) {
    .mobile-sticky-buttons {
        display: flex;
    }
}

.mobile-sticky-btn {
    width: 100%;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    border: none;
}

.mobile-sticky-btn-primary {
    background: #0d0d0d;
    color: white;
}

.mobile-sticky-btn-primary:hover {
    background: #2d2d2d;
}

.mobile-sticky-btn-secondary {
    background: white;
    color: #0d0d0d;
    border: 1px solid #e5e5e5;
}

.mobile-sticky-btn-secondary:hover {
    background: #f4f4f4;
}

/* Removed - moved to after general .settings-panel rule for proper cascade */

/* Utility classes for display toggling */
.ai-input-container.hidden {
    display: none !important;
}

.ai-chat-container.hidden {
    display: none !important;
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: calc(var(--ai-admin-bar-offset, 0px) + var(--ai-mobile-header-height, 0px));
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 100;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Mobile override removed - settings panel now uses position: absolute to respect parent padding (line 928-940) */

.settings-content {
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
    padding: 32px;
}

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

@media (max-width: 1024px) {
    .settings-panel {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0;
    }

    .settings-content {
        max-width: 100%;
        width: 100%;
        border-radius: 0;
        border: none;
        padding: 24px;
    }

    .settings-header {
        padding-top: 0;
        margin-bottom: 16px;
    }

    .settings-actions {
        flex-direction: column;
        margin-bottom: 12px;
    }

    .settings-btn {
        width: 100%;
    }

    .auth-page-footer {
        margin-top: 12px !important;
        padding-top: 12px !important;
    }

    .settings-field-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.settings-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #0d0d0d;
}

.settings-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.settings-close:hover {
    background: #f4f4f4;
}

.settings-description {
    color: #666;
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.6;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.settings-field-header label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-field-header strong {
    font-size: 15px;
    color: #0d0d0d;
}

.field-model {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

.settings-link {
    font-size: 13px;
    color: #0d0d0d;
    text-decoration: none;
    transition: opacity 0.2s;
}

.settings-link:hover {
    opacity: 0.7;
}

.settings-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.settings-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'SF Mono', Monaco, monospace;
    background: #f9f9f9;
    transition: all 0.2s;
}

.settings-input:focus {
    outline: none;
    border-color: #0d0d0d;
    background: white;
}

.toggle-visibility-btn {
    background: none;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #666;
}

.toggle-visibility-btn:hover {
    background: #f4f4f4;
    border-color: #0d0d0d;
}

.settings-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.settings-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.settings-btn-primary {
    background: #0d0d0d;
    color: white;
}

.settings-btn-primary:hover:not(:disabled) {
    background: #2d2d2d;
}

.settings-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-btn-secondary {
    background: white;
    color: #0d0d0d;
    border: 1px solid #e5e5e5;
}

.settings-btn-secondary:hover {
    background: #f4f4f4;
}

.settings-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.settings-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.settings-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Conversation Title Section */
.conversation-title-section {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

h1.conversation-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #0d0d0d;
    max-width: 1200px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
    cursor: text;
    outline: none;
}

h1.conversation-title:hover {
    background: #f9f9f9;
}

h1.conversation-title:focus {
    background: #f9f9f9;
    box-shadow: 0 0 0 2px #e5e5e5;
}

h1.conversation-title:empty:before {
    content: 'Untitled Conversation';
    color: #999;
}


/* Search Functionality */
.search-wrapper {
    position: relative;
    margin-top: 12px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.conversation-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.conversation-search-input:focus {
    border-color: #0d0d0d;
    background: white;
}

.conversation-item.match-title {
    border-left: 3px solid #d4af37;
}

.conversation-item.match-content {
    border-left: 3px solid #c0c0c0;
}

.conversation-item.hidden {
    display: none;
}


/* Connected Accounts */
.connected-accounts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.account-connection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #f9f9f9;
}

.account-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
}

.account-status {
    font-size: 13px;
    color: #999;
}

.oauth-connect-btn,
.oauth-disconnect-btn {
    padding: 6px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #fff;
    color: #0d0d0d;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.oauth-connect-btn:hover {
    background: #0d0d0d;
    color: #fff;
    border-color: #0d0d0d;
}

.oauth-disconnect-btn {
    background: #fff;
    color: #d32f2f;
    border-color: #d32f2f;
}

.oauth-disconnect-btn:hover {
    background: #d32f2f;
    color: #fff;
}

.oauth-connect-btn:disabled,
.oauth-disconnect-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Auth Modals (Login/Signup) */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-modal-content {
    max-width: 450px;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.auth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.auth-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.auth-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.auth-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.auth-description {
    padding: 0 24px;
    margin: 16px 0 0 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

.auth-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-field label {
    font-size: 14px;
    color: #374151;
    margin: 0;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.auth-input:focus {
    outline: none;
    border-color: #0d0d0d;
    box-shadow: 0 0 0 3px rgba(13, 13, 13, 0.1);
}

.auth-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-top: 4px;
}

.auth-btn-primary {
    background: #0d0d0d;
    color: white;
}

.auth-btn-primary:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-btn-primary:active {
    transform: translateY(0);
}

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-status {
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: -8px;
}

.auth-status.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.auth-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-footer {
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.auth-footer p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.auth-footer a {
    color: #0d0d0d;
    font-weight: 500;
    text-decoration: none;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .auth-modal-content {
        max-width: 100%;
        margin: 0 16px;
    }

    .auth-header {
        padding: 20px 20px 12px;
    }

    .auth-form {
        padding: 20px;
    }
}

/* Auth Pages (Login/Signup) */
.ai-auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
}

.auth-page-content {
    max-width: 450px;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 48px 40px;
}

.auth-page-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.auth-page-header p {
    color: #6b7280;
    font-size: 15px;
    margin: 0;
}

.auth-page-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    border: 1px solid #fecaca;
}

.auth-page-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-page-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-page-field label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.auth-page-field small {
    font-size: 13px;
    color: #6b7280;
    margin-top: -4px;
}

.auth-page-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.auth-page-input:focus {
    outline: none;
    border-color: #0d0d0d;
    box-shadow: 0 0 0 3px rgba(13, 13, 13, 0.1);
}

.auth-page-button {
    padding: 14px 24px;
    background: #0d0d0d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.auth-page-button:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-page-button:active {
    transform: translateY(0);
}

.auth-page-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.auth-page-footer p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.auth-page-footer a {
    color: #0d0d0d;
    font-weight: 500;
    text-decoration: none;
}

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

@media (max-width: 1024px) {
    .auth-page-content {
        padding: 36px 28px;
    }

    .auth-page-header h1 {
        font-size: 24px;
    }
}
