/* ===================================
   NOVO LAYOUT - CHATBOT LLM BETA 01
   =================================== */

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

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-main: #F9FAFB;
    --bg-sidebar: #FFFFFF;
    --bg-chat: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    /* Chat colors */
    --msg-user-bg: #4F46E5;
    --msg-user-text: #FFFFFF;
    --msg-assistant-bg: #F3F4F6;
    --msg-assistant-text: #111827;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --bg-main: #0F172A;
    --bg-sidebar: #1E293B;
    --bg-chat: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    
    /* Chat colors */
    --msg-user-bg: #6366F1;
    --msg-user-text: #FFFFFF;
    --msg-assistant-bg: #334155;
    --msg-assistant-text: #F1F5F9;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Fix para altura em mobile */
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    /* Fix para altura em mobile */
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* ===================================
   LAYOUT PRINCIPAL
   =================================== */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===================================
   SIDEBAR
   =================================== */

.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.logo h1 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text-primary);
}

.diagnostic-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.diagnostic-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.new-chat-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.shortcuts-help-btn {
    padding: 0.75rem;
    background: var(--bg-main);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shortcuts-help-btn:hover {
    background: var(--bg-chat);
    color: var(--primary);
    border-color: var(--primary);
}


/* ===================================
   BUSCA E FILTROS
   =================================== */

.search-filters {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.search-box {
    position: relative;
    margin-bottom: 0.75rem;
}

.search-input {
    width: 100%;
    padding: 0.625rem 2rem 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-main);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.clear-search:hover {
    color: var(--text-primary);
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-main);
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--primary);
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    transition: background 0.2s;
}

.filter-checkbox:hover {
    background: var(--bg-main);
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 1rem;
    height: 1rem;
}

.filter-checkbox span {
    user-select: none;
}

/* ===================================
   SESSIONS LIST
   =================================== */

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.sessions-header h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 0;
}

.loading-indicator {
    font-size: 0.875rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

mark {
    background-color: rgba(79, 70, 229, 0.2);
    color: var(--primary);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

[data-theme="dark"] mark {
    background-color: rgba(99, 102, 241, 0.3);
    color: var(--primary);
}

.session-item {
    display: block;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

.session-item:hover {
    background: var(--bg-main);
}

.session-item.active {
    background: var(--bg-main);
    font-weight: 500;
}

.session-title-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.session-title {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    cursor: text;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.favorite-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.archived-badge {
    font-size: 0.75rem;
    margin-left: 0.375rem;
    opacity: 0.7;
}

.edit-title-btn {
    background: none;
    border: none;
    font-size: 0.875rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0.25rem;
    line-height: 1;
}

.session-item:hover .edit-title-btn,
.session-item.active .edit-title-btn {
    opacity: 0.6;
}

.edit-title-btn:hover {
    opacity: 1 !important;
}

.title-edit-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 2px solid var(--primary);
    border-radius: 0.25rem;
    background: white;
    outline: none;
}

.session-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.empty-sessions {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.empty-sessions p {
    font-size: 0.875rem;
}

/* ===================================
   CHAT AREA
   =================================== */

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: white;
}

.chat-info h2 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.provider-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--bg-main);
    color: var(--text-secondary);
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.chat-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.favorite-btn,
.archive-btn,
.delete-btn,
.theme-toggle {
    padding: 0.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-width: 2.5rem;
}

.favorite-btn:hover,
.archive-btn:hover,
.theme-toggle:hover {
    background: var(--bg-main);
    transform: scale(1.1);
}

.delete-btn:hover {
    background: #FEE2E2;
    border-color: #DC2626;
    transform: scale(1.1);
}

[data-theme="dark"] .delete-btn:hover {
    background: #7F1D1D;
    border-color: #EF4444;
}

.export-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.export-btn:hover {
    background: var(--bg-main);
    border-color: var(--primary);
    color: var(--primary);
}

.model-selector {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.model-selector:hover {
    border-color: var(--primary);
}

/* ===================================
   MESSAGES
   =================================== */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-main);
}

.messages-area {
    max-width: 800px;
    margin: 0 auto;
}

.empty-chat {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-chat h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.message-avatar {
    flex-shrink: 0;
}

.avatar-user,
.avatar-assistant {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.avatar-user {
    background: var(--primary);
}

.avatar-assistant {
    background: var(--bg-main);
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message--user .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-text {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message--user .message-text {
    background: var(--msg-user-bg);
    color: var(--msg-user-text);
    border-bottom-right-radius: 0.25rem;
}

.message--assistant .message-text {
    background: var(--msg-assistant-bg);
    color: var(--msg-assistant-text);
    border-bottom-left-radius: 0.25rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

/* ===================================
   CODE HIGHLIGHTING
   =================================== */

.message-text code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.message-text .inline-code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    color: #e83e8c;
    font-weight: 500;
}

[data-theme="dark"] .message-text .inline-code {
    background: rgba(255, 255, 255, 0.1);
    color: #ff79c6;
}

.message-text .code-block {
    position: relative;
    margin: 0.75rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #2d2d2d !important;
}

.message-text pre[class*="language-"] {
    margin: 0;
    padding: 1rem;
    background: #2d2d2d;
    border-radius: 0.5rem;
}

.message-text code[class*="language-"] {
    background: transparent;
    color: #ccc;
    font-size: 0.875rem;
    line-height: 1.5;
    text-shadow: none;
}

.copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.375rem;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.message--user .code-block {
    background: rgba(0, 0, 0, 0.2) !important;
}

.message--user pre[class*="language-"] {
    background: rgba(0, 0, 0, 0.2);
}

/* Ajustar Prism theme para dark */
[data-theme="dark"] .message-text pre[class*="language-"] {
    background: #1e1e1e;
}

[data-theme="dark"] .message-text .code-block {
    background: #1e1e1e !important;
}

/* ===================================
   TYPING INDICATOR
   =================================== */

.typing-indicator {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.typing-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.typing-content {
    flex: 1;
}

.typing-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.typing-dots {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--msg-assistant-bg);
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ===================================
   INPUT AREA
   =================================== */

.input-container {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid var(--border);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    resize: none;
    max-height: 200px;
    overflow-y: auto;
}

.input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

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

.send-icon {
    font-size: 1.25rem;
    font-weight: bold;
}

.input-footer {
    max-width: 800px;
    margin: 0.5rem auto 0;
    text-align: center;
}

.input-footer small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===================================
   WELCOME SCREEN (index)
   =================================== */

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.welcome-screen {
    max-width: 800px;
    width: 100%;
}

.welcome-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.theme-toggle-home {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.theme-toggle-home:hover {
    background: var(--bg-main);
    transform: scale(1.1);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.cost-info {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.cost-info strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ===================================
   TESS INPUT AREA (DESKTOP E MOBILE)
   =================================== */

.tess-input-area {
    display: block; /* Mostrar por padrão */
    max-width: 700px;
    margin: 0 auto 2rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.tess-textarea {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    margin-bottom: 1rem;
    min-height: 80px;
}

.tess-textarea::placeholder {
    color: var(--text-muted);
}

.tess-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.tess-toolbar-left,
.tess-toolbar-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tess-tool-btn {
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tess-tool-btn:hover {
    background: var(--bg-main);
    border-color: var(--primary);
}

.tess-tool-btn:active {
    transform: scale(0.95);
}

.tess-model-selector {
    padding: 0.625rem 1.25rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    background: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    white-space: nowrap;
}

.tess-model-selector:hover {
    background: var(--bg-main);
    border-color: var(--primary);
}

.tess-model-selector:active {
    transform: scale(0.95);
}

.tess-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.tess-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.tess-send-btn:active {
    transform: scale(0.95);
}

/* ===================================
   MODELS DROPDOWN
   =================================== */

.models-dropdown-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 2rem;
    display: block; /* Mostrar no desktop */
}

.models-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.models-trigger:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.trigger-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.trigger-text {
    flex: 1;
    text-align: left;
    color: var(--text-muted);
}

.models-trigger:has(~ #models-dropdown[style*="display: block"]) .trigger-arrow,
.models-trigger:hover .trigger-arrow {
    transform: rotate(180deg);
}

.trigger-arrow {
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.models-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    max-height: 500px;
    overflow-y: auto;
    z-index: 100;
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.model-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-family: inherit;
}

.model-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.dropdown-section {
    padding: 0.5rem;
}

.section-label {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.model-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.model-option:hover {
    background: var(--bg-main);
}

.model-option.selected {
    background: rgba(79, 70, 229, 0.1);
}

.model-option.featured {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
    border: 1px solid rgba(79, 70, 229, 0.2);
    margin-bottom: 0.5rem;
}

.model-option.featured:hover {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(124, 58, 237, 0.1));
}

.model-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.model-info {
    flex: 1;
    min-width: 0;
}

.model-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.model-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.model-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.model-provider {
    color: var(--text-secondary);
}

.model-context {
    color: var(--text-muted);
}

.model-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.model-badge.new {
    background: #10B981;
    color: white;
}

.model-badge.beta {
    background: #F59E0B;
    color: white;
}

.models-list {
    max-height: 300px;
    overflow-y: auto;
}

/* ===================================
   OLD STYLES (mantidos para compatibilidade)
   =================================== */

.model-selector {
    margin-bottom: 2rem;
}

.model-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.model-dropdown {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-family: inherit;
}

.quick-start {
    text-align: center;
    margin-bottom: 3rem;
}

.primary-btn {
    padding: 0.875rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===================================
   MODAL
   =================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
}

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

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

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.secondary-btn {
    padding: 0.625rem 1.5rem;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.secondary-btn:hover {
    background: var(--bg-main);
}

/* ===================================
   BOTTOM NAVIGATION BAR (MOBILE)
   =================================== */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    padding: 0.5rem 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    min-width: 60px;
    position: relative;
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

.bottom-nav-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.bottom-nav-label {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Modal de menu mobile */
.mobile-menu-modal {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    z-index: 99;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease-out;
}

.mobile-menu-modal.active {
    display: block;
}

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

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 98;
    backdrop-filter: blur(2px);
}

.mobile-menu-overlay.active {
    display: block;
}

.mobile-menu-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.mobile-menu-content {
    padding: 0.5rem;
}

/* ===================================
   RESPONSIVE
   =================================== */

/* Desktop: Mostrar Tess input, esconder elementos mobile desnecessários */
@media (min-width: 769px) {
    .models-grid-mobile,
    .bottom-nav,
    .models-dropdown-container {
        display: none !important;
    }
    
    .tess-input-area {
        display: block !important;
    }
    
    /* Bottom sheet como modal centralizado no desktop */
    .bottom-sheet-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        backdrop-filter: blur(4px);
    }
    
    .bottom-sheet-overlay.active {
        display: block;
    }
    
    .models-bottom-sheet {
        position: fixed !important;
        bottom: auto !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        max-width: 600px;
        width: 90%;
        max-height: 80vh;
        border-radius: 1rem !important;
        background: white;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        z-index: 1000;
        transition: all 0.3s ease;
        opacity: 0;
        pointer-events: none;
    }
    
    .models-bottom-sheet.active {
        opacity: 1;
        pointer-events: auto;
    }
    
    .bottom-sheet-handle {
        display: none !important;
    }
    
    /* Estilos do conteúdo do modal no desktop */
    .bottom-sheet-header {
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.5rem;
        background: white;
        border-radius: 1rem 1rem 0 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .bottom-sheet-header h3 {
        font-size: 1.25rem;
        margin: 0;
        color: var(--text-primary);
        font-weight: 700;
    }
    
    .bottom-sheet-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 0.25rem 0.5rem;
        line-height: 1;
    }
    
    .bottom-sheet-search {
        width: 100%;
        padding: 0.75rem 1rem;
        border: 1px solid var(--border);
        border-radius: 0.5rem;
        margin-top: 1rem;
        font-size: 1rem;
        outline: none;
    }
    
    .bottom-sheet-search:focus {
        border-color: var(--primary);
    }
    
    .bottom-sheet-content {
        background: white;
        border-radius: 0 0 1rem 1rem;
        overflow-y: auto;
    }
    
    .model-section-label {
        background: white;
        position: sticky;
        top: 0;
        z-index: 10;
        padding: 0.75rem 1rem 0.5rem;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .model-card-mobile {
        border: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        cursor: pointer;
        transition: background 0.2s;
        background: white;
    }
    
    .model-card-mobile:hover {
        background: var(--bg-main);
    }
    
    .model-card-mobile:last-child {
        border-bottom: none;
    }
    
    .model-card-info {
        flex: 1;
    }
    
    .model-card-name {
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .model-logo {
        width: 24px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .model-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    
    .model-icon-inline {
        font-size: 1.25rem;
    }
    
    .model-card-badge {
        padding: 0.25rem 0.625rem;
        border-radius: 0.375rem;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    
    .badge-novo {
        background: #10B981;
        color: white;
    }
    
    .badge-beta {
        background: #8B5CF6;
        color: white;
    }
}

@media (max-width: 768px) {
    /* Bottom Navigation */
    .bottom-nav {
        display: block;
    }
    
    /* Esconder sidebar no mobile */
    .sidebar {
        display: none;
    }
    
    /* Ajustar layout principal */
    .app-layout {
        flex-direction: column;
    }
    
    .chat-main {
        width: 100%;
        height: calc(100vh - 70px);
        padding-bottom: 0;
    }
    
    /* Ajustar header */
    .chat-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .chat-info h2 {
        font-size: 1rem;
    }
    
    .chat-actions {
        gap: 0.25rem;
        flex-wrap: wrap;
    }
    
    .chat-actions button {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    .export-btn,
    .archive-btn,
    .delete-btn {
        display: none;
    }
    
    .model-selector {
        width: 100%;
        margin-top: 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Ajustar mensagens */
    .message-content {
        max-width: 85%;
    }
    
    .messages-container {
        padding: 1rem 0.75rem;
        padding-bottom: 0;
        height: calc(100vh - 200px);
    }
    
    /* Ajustar input */
    .input-container {
        padding: 0.75rem;
        margin-bottom: 0;
    }
    
    .input-wrapper {
        padding: 0.5rem;
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
    }
    
    /* Ajustes para textarea mobile */
    #message-input {
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    /* Home page */
    .main-content {
        height: calc(100vh - 70px);
        overflow-y: auto;
        padding: 1rem;
    }
    
    .welcome-header {
        margin-bottom: 2rem;
    }
    
    .welcome-icon {
        font-size: 3rem;
    }
    
    .theme-toggle-home {
        display: none;
    }
    
    .home-main {
        height: calc(100vh - 70px);
        overflow-y: auto;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    /* Ajustes de busca */
    .filter-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* Scrollbar customizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===================================
   KEYBOARD SHORTCUTS MODAL
   =================================== */

.shortcuts-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .shortcuts-modal {
    background: rgba(0, 0, 0, 0.7);
}

.shortcuts-content {
    background: var(--bg-sidebar);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.shortcuts-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

.shortcuts-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.shortcuts-close:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.shortcuts-list {
    padding: 1rem 1.5rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.shortcut-item:hover {
    background: var(--bg-main);
}

.shortcut-item kbd {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    box-shadow: 0 2px 0 var(--border);
    min-width: 2.5rem;
    text-align: center;
}

[data-theme="dark"] .shortcut-item kbd {
    background: var(--bg-chat);
    border-color: var(--border);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.shortcut-item span {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.shortcuts-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.shortcuts-footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.shortcuts-footer kbd {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    margin: 0 0.25rem;
}

