/* === LOCAL AI CHAT STYLES === */
/* All classes prefixed with lai- to avoid conflicts with site-wide styles */

:root {
    --lai-bg-dark: #0f0f12;
    --lai-text-primary: #ffffff;
    --lai-text-secondary: #a1a1aa;
    --lai-accent: #8b5cf6;
    --lai-accent-glow: rgba(139, 92, 246, 0.4);
    --lai-glass-bg: rgba(25, 25, 30, 0.6);
    --lai-glass-border: rgba(255, 255, 255, 0.08);
    --lai-user-bubble: #27272a;
    --lai-bot-bubble: rgba(139, 92, 246, 0.2);
    --lai-success: #22c55e;
    --lai-danger: #ef4444;
}

body {
    margin: 0;
    padding: 0;
    /* Override global padding */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* Move gradient here to cover full page including behind header */
    background: radial-gradient(circle at top left, #1a1a2e 0%, #000000 100%);
    background-color: var(--lai-bg-dark);
    color: var(--lai-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#main-nav-placeholder {
    width: 100%;
    z-index: 100;
}

/* === APP CONTAINER === */
.lai-app-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: transparent;
    /* Gradient moved to body */
}

.lai-glass-card {
    width: 100%;
    max-width: 900px;
    height: 85vh;
    background: var(--lai-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--lai-glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* === HEADER === */
.lai-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--lai-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
    gap: 12px;
}

/* Model Selector in Header */
.lai-model-selector-wrapper {
    display: flex;
    align-items: center;
}

.lai-model-selector-wrapper .lai-select {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    padding: 6px 28px 6px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--lai-accent);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.2s ease;
}

.lai-model-selector-wrapper .lai-select:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--lai-accent);
}

.lai-model-selector-wrapper .lai-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Fallback Mode Badge (shown when WebGPU unavailable) */
.lai-fallback-badge {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.4);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #eab308;
}

.lai-fallback-icon {
    font-size: 0.85rem;
}

/* Header Action Buttons */
.lai-header-actions {
    display: flex;
    gap: 8px;
}

.lai-header-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--lai-glass-border);
    color: var(--lai-text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lai-header-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--lai-accent);
    color: var(--lai-accent);
}

/* === CHAT HISTORY SIDEBAR === */
.lai-history-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 360px;
    height: 100vh;
    background: rgba(15, 15, 18, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--lai-glass-border);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.lai-history-sidebar.open {
    transform: translateX(0);
}

.lai-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lai-sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.lai-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--lai-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lai-sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--lai-text-primary);
}

.lai-sidebar-close-btn {
    background: transparent;
    border: none;
    color: var(--lai-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.lai-sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Chat List */
.lai-chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.lai-chat-list::-webkit-scrollbar {
    width: 6px;
}

.lai-chat-list::-webkit-scrollbar-track {
    background: transparent;
}

.lai-chat-list::-webkit-scrollbar-thumb {
    background: var(--lai-accent);
    border-radius: 3px;
}

.lai-chat-item {
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    border: 1px solid transparent;
}

.lai-chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lai-chat-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.lai-chat-item-info {
    flex: 1;
    min-width: 0;
}

.lai-chat-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--lai-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.lai-chat-item-date {
    font-size: 0.7rem;
    color: var(--lai-text-secondary);
}

.lai-chat-item-delete {
    background: transparent;
    border: none;
    color: var(--lai-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.lai-chat-item:hover .lai-chat-item-delete {
    opacity: 1;
}

.lai-chat-item-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--lai-danger);
}

.lai-empty-history {
    text-align: center;
    padding: 40px 20px;
    color: var(--lai-text-secondary);
    font-size: 0.85rem;
}

.lai-empty-history svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Sidebar Footer */
.lai-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--lai-glass-border);
}

.lai-delete-all-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    color: var(--lai-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.lai-delete-all-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--lai-danger);
}

/* === CONFIRMATION MODAL === */
.lai-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: lai-fadeIn 0.3s ease-out;
}

.lai-confirm-overlay.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lai-confirm-modal {
    background: rgba(30, 30, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 32px;
    border-radius: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    color: white;
    animation: lai-slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lai-confirm-icon {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--lai-danger);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.lai-confirm-modal h2 {
    margin: 0 0 12px;
    font-size: 1.3rem;
    font-weight: 600;
}

.lai-confirm-modal p {
    margin: 0 0 24px;
    color: var(--lai-text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Slider Confirmation */
.lai-slider-confirm {
    margin-bottom: 20px;
}

.lai-slider-label {
    font-size: 0.8rem;
    color: var(--lai-text-secondary);
    margin-bottom: 10px;
    display: block;
}

.lai-slider-track {
    width: 100%;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--lai-glass-border);
}

.lai-slider-thumb {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 60px;
    height: 40px;
    background: var(--lai-danger);
    border-radius: 20px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.1s ease, background 0.2s;
    user-select: none;
}

.lai-slider-thumb:active {
    cursor: grabbing;
}

.lai-slider-thumb svg {
    color: white;
}

.lai-slider-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--lai-text-secondary);
    font-size: 0.85rem;
    pointer-events: none;
}

.lai-slider-track.confirmed .lai-slider-thumb {
    background: var(--lai-success);
}

/* Confirm Modal Buttons */
.lai-confirm-buttons {
    display: flex;
    gap: 12px;
}

.lai-confirm-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.lai-confirm-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--lai-text-secondary);
}

.lai-confirm-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.lai-confirm-btn.danger {
    background: var(--lai-danger);
    color: white;
    opacity: 0.5;
    pointer-events: none;
}

.lai-confirm-btn.danger.enabled {
    opacity: 1;
    pointer-events: auto;
}

.lai-confirm-btn.danger.enabled:hover {
    background: #dc2626;
}

.lai-header-info h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.lai-header-info h1 span {
    color: var(--lai-accent);
    font-weight: 400;
}

.lai-subtitle {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    color: var(--lai-text-secondary);
}

/* === STATUS BADGE === */
.lai-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    border: 1px solid var(--lai-glass-border);
}

.lai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #eab308;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
}

.lai-status-ready .lai-status-dot {
    background-color: var(--lai-success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.lai-status-busy .lai-status-dot {
    background-color: var(--lai-accent);
    animation: lai-pulse 1s infinite;
}

@keyframes lai-pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* === PLATFORM BADGE (macOS/Apple Silicon) === */
.lai-platform-badge {
    display: none;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(100, 100, 110, 0.2) 0%, rgba(80, 80, 90, 0.15) 100%);
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--lai-text-secondary);
    transition: all 0.3s ease;
}

.lai-platform-badge.visible {
    display: flex;
    animation: lai-slideInRight 0.4s ease-out;
}

.lai-platform-badge .lai-apple-logo {
    flex-shrink: 0;
}

/* Apple gradient effect when Apple Silicon detected */
.lai-platform-badge:has(.lai-apple-logo) {
    background: linear-gradient(135deg, rgba(147, 147, 155, 0.15) 0%, rgba(100, 100, 110, 0.1) 100%);
    border-color: rgba(180, 180, 190, 0.2);
    color: #e5e5ea;
}

@keyframes lai-slideInRight {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === PROGRESS PANEL === */
.lai-progress-panel {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 24px;
    border-bottom: 1px solid var(--lai-glass-border);
    transition: max-height 0.5s ease;
}

.lai-progress-panel.collapsed {
    display: none;
}

.lai-stage-container {
    margin-bottom: 10px;
}

.lai-stage-container.hidden {
    display: none;
}

.lai-stage-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.lai-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.lai-progress-fill {
    height: 100%;
    background: var(--lai-accent);
    width: 0%;
    transition: width 0.2s ease;
    box-shadow: 0 0 10px var(--lai-accent-glow);
}

.lai-file-name {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    color: #666;
    font-family: monospace;
}

/* Indeterminate Loading Animation */
.lai-infinite-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.lai-infinite-bar {
    position: absolute;
    height: 100%;
    width: 40%;
    background: var(--lai-success);
    border-radius: 3px;
    animation: lai-slide 1.5s infinite ease-in-out;
}

@keyframes lai-slide {
    0% {
        left: -40%;
    }

    100% {
        left: 100%;
    }
}

/* === CHAT AREA === */
.lai-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Area */
.lai-chat-area::-webkit-scrollbar {
    width: 8px;
}

.lai-chat-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.lai-chat-area::-webkit-scrollbar-thumb {
    background: var(--lai-accent);
    border-radius: 4px;
    box-shadow: 0 0 6px var(--lai-accent-glow);
}

.lai-chat-area::-webkit-scrollbar-thumb:hover {
    background: #9d6ff7;
}

/* Firefox scrollbar */
.lai-chat-area {
    scrollbar-width: thin;
    scrollbar-color: var(--lai-accent) rgba(255, 255, 255, 0.05);
}

.lai-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: lai-slideUp 0.3s ease-out;
}

.lai-message.lai-user {
    align-self: flex-end;
    align-items: flex-end;
}

.lai-message.lai-bot {
    align-self: flex-start;
    align-items: flex-start;
}

.lai-message.lai-system {
    align-self: center;
    max-width: 100%;
}

.lai-bubble {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.lai-message.lai-user .lai-bubble {
    background-color: var(--lai-user-bubble);
    color: white;
    border-bottom-right-radius: 4px;
}

.lai-message.lai-bot .lai-bubble {
    background-color: var(--lai-bot-bubble);
    color: #ffffff;
    /* User requested white text */
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(139, 92, 246, 0.1);
    position: relative;
    /* For copy button positioning */
}

.lai-message.lai-user .lai-bubble {
    background-color: var(--lai-user-bubble);
    color: white;
    border-bottom-right-radius: 4px;
    position: relative;
}

.lai-message.lai-system .lai-bubble {
    background: transparent;
    color: var(--lai-text-secondary);
    font-size: 0.8rem;
    text-align: center;
}

/* Copy Button in Message */
.lai-msg-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--lai-text-secondary);
    cursor: pointer;
    opacity: 0;
    /* Hidden until hover */
    transition: opacity 0.2s, color 0.2s;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lai-bubble:hover .lai-msg-copy-btn {
    opacity: 0.6;
}

.lai-msg-copy-btn:hover {
    opacity: 1 !important;
    color: var(--lai-accent);
    background: rgba(255, 255, 255, 0.1);
}

/* Context Toggle Styles */
.lai-context-details {
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.lai-context-summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--lai-text-secondary);
    opacity: 0.7;
    transition: opacity 0.2s;
    user-select: none;
    outline: none;
}

.lai-context-summary:hover {
    opacity: 1;
    color: var(--lai-accent);
}

.lai-context-content {
    margin: 8px 0 0 0;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--lai-text-secondary);
    white-space: pre-wrap;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}

/* Markdown Rendering Styles */
.lai-bubble p {
    margin: 0.5em 0;
}

.lai-bubble p:first-child {
    margin-top: 0;
}

.lai-bubble p:last-child {
    margin-bottom: 0;
}

.lai-bubble code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.lai-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.lai-bubble pre code {
    background: transparent;
    padding: 0;
}

.lai-bubble ul,
.lai-bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.lai-bubble h1,
.lai-bubble h2,
.lai-bubble h3 {
    margin: 0.5em 0;
    font-size: 1.1em;
    font-weight: 600;
}

/* Metrics Footer */
.lai-message-metrics {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.65rem;
    color: var(--lai-text-secondary);
    display: flex;
    gap: 8px;
    opacity: 0.8;
    font-family: monospace;
}

@keyframes lai-slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === SETTINGS PANEL === */
.lai-settings-panel {
    padding: 0 20px;
    border-bottom: 1px solid var(--lai-glass-border);
    background: rgba(0, 0, 0, 0.15);
}

.lai-settings-toggle-btn {
    background: rgba(30, 30, 35, 0.6);
    color: var(--lai-text-secondary);
    border: 1px solid var(--lai-glass-border);
    width: fit-content;
    min-width: 120px;
    height: auto;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    gap: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.lai-settings-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--lai-text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.lai-settings-content {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lai-settings-content.hidden {
    display: none;
}

.lai-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.lai-setting-row label {
    font-size: 0.8rem;
    color: var(--lai-text-secondary);
    flex-shrink: 0;
}

.lai-setting-row textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--lai-glass-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    min-height: 60px;
    resize: vertical;
    color: var(--lai-text-primary);
    font-family: inherit;
}

.lai-setting-row textarea:focus {
    outline: none;
    border-color: var(--lai-accent);
}

/* Model Selector Row */
.lai-model-row {
    background: rgba(139, 92, 246, 0.05);
    margin: -12px -16px 12px -16px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px dashed rgba(139, 92, 246, 0.3);
}

.lai-select {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--lai-glass-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--lai-text-primary);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.lai-select:hover {
    border-color: var(--lai-accent);
}

.lai-select:focus {
    outline: none;
    border-color: var(--lai-accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.lai-select option {
    background: #1e1e23;
    color: var(--lai-text-primary);
    padding: 8px;
}

/* Cache Row */
.lai-cache-row {
    align-items: center;
}

.lai-cache-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lai-cache-info small {
    font-size: 0.7rem;
    color: var(--lai-text-secondary);
    font-family: monospace;
}

/* Toggle Switch */
.lai-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.lai-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.lai-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 24px;
    border: 1px solid var(--lai-glass-border);
}

.lai-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--lai-text-secondary);
    transition: 0.3s;
    border-radius: 50%;
}

.lai-toggle-switch input:checked+.lai-toggle-slider {
    background-color: var(--lai-accent);
    border-color: var(--lai-accent);
}

.lai-toggle-switch input:checked+.lai-toggle-slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* === CONTROLS AREA === */
.lai-controls-area {
    padding: 20px;
    border-top: 1px solid var(--lai-glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.lai-input-wrapper {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--lai-glass-border);
}

/* Example Prompts Row */
.lai-prompt-examples-row {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.lai-example-btn {
    background: rgba(139, 92, 246, 0.1);
    color: var(--lai-accent);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.lai-example-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--lai-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--lai-accent-glow);
}

.lai-example-btn:active {
    transform: translateY(0px);
}

.lai-input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 10px;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    max-height: 120px;
    outline: none;
}

.lai-send-btn {
    background: var(--lai-accent);
    color: white;
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.lai-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #555;
}

.lai-send-btn:hover:not(:disabled) {
    background: #7c4ddb;
}

/* === DEBUG AREA === */
.lai-debug-wrapper {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid var(--lai-glass-border);
    overflow: hidden;
}

.lai-debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--lai-glass-border);
    font-size: 0.75rem;
    color: var(--lai-text-secondary);
}

.lai-debug-console {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #a1a1aa;
    text-align: left;
    height: 120px;
    overflow-y: auto;
    padding: 10px;
    white-space: pre-wrap;
    border: none;
    background: transparent;
    border-radius: 0;
}

/* === BUTTONS === */
.lai-icon-btn {
    background: transparent;
    color: var(--lai-accent);
    border: 1px solid var(--lai-accent);
    width: auto;
    height: 24px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    gap: 6px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.lai-icon-btn:hover {
    background: var(--lai-accent);
    color: white;
}

.lai-danger-btn {
    color: var(--lai-danger);
    border-color: var(--lai-danger);
}

.lai-danger-btn:hover {
    background: var(--lai-danger);
    color: white;
}

/* === MOBILE === */
@media (max-width: 600px) {
    .lai-glass-card {
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .lai-setting-row {
        flex-direction: column;
        align-items: stretch;
    }

    .lai-cache-row {
        flex-direction: row;
        align-items: center;
    }
}

/* === CUSTOM MODAL === */
.lai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: lai-fadeIn 0.3s ease-out;
}

.lai-modal-overlay.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lai-modal {
    background: rgba(30, 30, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 32px;
    border-radius: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    color: white;
    transform: translateY(0);
    animation: lai-slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lai-modal-icon {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--lai-danger);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.lai-modal h2 {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 600;
}

.lai-modal-body {
    margin: 0 0 24px;
    color: var(--lai-text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.lai-modal-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--lai-accent);
}

.lai-modal-body strong {
    color: white;
}

.lai-modal-btn {
    background: white;
    color: black;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s, opacity 0.2s;
}

.lai-modal-btn:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

@keyframes lai-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes lai-slideUpModal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === THINKING INDICATOR === */
.lai-thinking-bubble {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 120px;
}

/* Timer at the top of thinking bubble */
.lai-thinking-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--lai-accent);
    font-family: 'Courier New', monospace;
    opacity: 0.9;
}

.lai-thinking-timer::before {
    content: '⏱️';
    font-size: 0.8rem;
}

/* Animated dots container */
.lai-thinking-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.lai-thinking-dots span {
    width: 10px;
    height: 10px;
    background: var(--lai-accent);
    border-radius: 50%;
    animation: lai-bounce 1.4s ease-in-out infinite;
    box-shadow: 0 0 8px var(--lai-accent-glow);
}

.lai-thinking-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes lai-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Thinking status text */
.lai-thinking-status {
    font-size: 0.75rem;
    color: var(--lai-text-secondary);
    font-style: italic;
    animation: lai-textPulse 2s ease-in-out infinite;
}

@keyframes lai-textPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Pulsing border on the bubble while thinking */
.lai-message.lai-thinking .lai-bubble {
    border: 1px solid var(--lai-accent);
    animation: lai-borderPulse 2s ease-in-out infinite;
}

@keyframes lai-borderPulse {

    0%,
    100% {
        border-color: var(--lai-accent);
        box-shadow: 0 0 5px var(--lai-accent-glow);
    }

    50% {
        border-color: rgba(139, 92, 246, 0.3);
        box-shadow: 0 0 15px var(--lai-accent-glow);
    }
}

/* === HARDWARE SELECTION MODAL === */
.lai-hardware-modal .lai-modal {
    max-width: 480px;
}

.lai-hardware-selection h2 {
    margin: 0 0 8px;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.lai-hardware-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.lai-hardware-option {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: white;
}

.lai-hardware-option:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateX(4px);
}

.lai-hardware-option:active {
    transform: translateX(2px);
    background: rgba(139, 92, 246, 0.15);
}

.lai-hw-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lai-accent);
    flex-shrink: 0;
}

.lai-hw-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lai-hw-info strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.lai-hw-info span {
    font-size: 0.8rem;
    color: var(--lai-text-secondary);
}

.lai-hw-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.lai-hw-tag.fast {
    background: rgba(34, 197, 94, 0.15);
    color: var(--lai-success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.lai-hw-tag.slow {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.lai-remember-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--lai-text-secondary);
    cursor: pointer;
    justify-content: center;
}

.lai-remember-choice input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--lai-accent);
    cursor: pointer;
}

.lai-remember-choice:hover {
    color: white;
}

/* Animation for options appearing */
.lai-hardware-option {
    animation: lai-slideInOption 0.4s ease-out backwards;
}

.lai-hardware-option:nth-child(1) {
    animation-delay: 0.1s;
}

.lai-hardware-option:nth-child(2) {
    animation-delay: 0.2s;
}

.lai-hardware-option:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes lai-slideInOption {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}