/**
 * Solis AI Chat Panel Styles
 * Slide-out panel for AI assistant chat functionality
 */

/* =====================================================
   AI Chat Panel Container
   ===================================================== */
.ai-chat-panel {
    position: fixed;
    top: 60px;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px); /* Dynamic viewport height for iOS Safari */
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease-in-out;
    border-top-left-radius: 8px;
}

.ai-chat-panel.open {
    right: 0;
}

/* Overlay */
.ai-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.ai-chat-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   Header
   ===================================================== */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    flex-shrink: 0;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.ai-chat-title svg {
    opacity: 0.9;
}

.ai-chat-actions {
    display: flex;
    gap: 8px;
}

.ai-chat-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ai-chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.ai-chat-action-btn i {
    font-size: 1rem;
}

/* =====================================================
   Messages Container
   ===================================================== */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom scrollbar */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Welcome Message */
.ai-chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.ai-welcome-icon {
    margin-bottom: 16px;
    color: #8b5cf6;
}

.ai-chat-welcome h4 {
    color: #374151;
    margin-bottom: 12px;
    font-weight: 600;
}

.ai-chat-welcome p {
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 280px;
    margin: 0 auto;
}

/* =====================================================
   Chat Messages
   ===================================================== */
.ai-message {
    display: flex;
    gap: 12px;
    max-width: 100%;
}

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

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.ai-message.assistant .ai-message-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
}

.ai-message.user .ai-message-avatar {
    background: #e5e7eb;
    color: #374151;
}

.ai-message-content {
    flex: 1;
    min-width: 0;
}

.ai-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-message.assistant .ai-message-bubble {
    background: #f3f4f6;
    color: #374151;
    border-bottom-left-radius: 4px;
}

.ai-message.user .ai-message-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.ai-message-time {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

.ai-message.user .ai-message-time {
    text-align: right;
}

/* Markdown content in messages */
.ai-message-bubble h1,
.ai-message-bubble h2,
.ai-message-bubble h3,
.ai-message-bubble h4,
.ai-message-bubble h5,
.ai-message-bubble h6 {
    margin-top: 0.5em;
    margin-bottom: 0.25em;
    font-weight: 600;
}

.ai-message-bubble h1 { font-size: 1.2em; }
.ai-message-bubble h2 { font-size: 1.1em; }
.ai-message-bubble h3 { font-size: 1em; }

.ai-message-bubble p {
    margin: 0 0 0.5em 0;
}

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

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

.ai-message-bubble li {
    margin: 0.25em 0;
}

.ai-message-bubble code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.85em;
}

.ai-message-bubble pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.ai-message-bubble pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.ai-message-bubble a {
    color: #6366f1;
    text-decoration: underline;
}

.ai-message.user .ai-message-bubble a {
    color: #c7d2fe;
}

/* Typing indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: ai-typing 1.4s infinite ease-in-out both;
}

.ai-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes ai-typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Error message */
.ai-message-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-message-error i {
    font-size: 1.1rem;
}

/* =====================================================
   Input Container
   ===================================================== */
.ai-chat-input-container {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ai-chat-context-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 10px;
    padding: 6px 10px;
    background: #f3f4f6;
    border-radius: 6px;
}

.ai-chat-context-indicator i {
    color: #8b5cf6;
}

.ai-chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-chat-input-wrapper:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ai-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
    padding: 4px 0;
    font-family: inherit;
}

.ai-chat-input:focus {
    outline: none;
}

.ai-chat-input::placeholder {
    color: #9ca3af;
}

/* Web Search Toggle */
.ai-chat-search-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    background: #f3f4f6;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.ai-chat-search-toggle i {
    font-size: 0.85rem;
    color: #6b7280;
    transition: color 0.2s ease;
}

.ai-chat-search-toggle.active {
    background: rgba(16, 185, 129, 0.15);
}

.ai-chat-search-toggle.active i {
    color: #10b981;
}

/* Toggle Switch */
.ai-toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin: 0;
}

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

.ai-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 20px;
}

.ai-toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ai-toggle-switch input:checked + .ai-toggle-slider {
    background-color: #10b981;
}

.ai-toggle-switch input:checked + .ai-toggle-slider:before {
    transform: translateX(16px);
}

.ai-toggle-switch input:disabled + .ai-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Search active animation */
.ai-chat-search-toggle.searching .ai-toggle-slider {
    animation: search-pulse 1.5s infinite;
}

@keyframes search-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Vision Toggle (same style as search toggle) */
.ai-chat-vision-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    background: #f3f4f6;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.ai-chat-vision-toggle i {
    font-size: 0.85rem;
    color: #6b7280;
    transition: color 0.2s ease;
}

.ai-chat-vision-toggle.active {
    background: rgba(99, 102, 241, 0.15);
}

.ai-chat-vision-toggle.active i {
    color: #6366f1;
}

.ai-chat-vision-toggle.analyzing .ai-toggle-slider {
    animation: search-pulse 1.5s infinite;
}

/* Image Analysis Overlay - for clickable image selection */
.ai-image-analyze-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1060;
    display: none;
}

.ai-image-analyze-overlay.active {
    display: block;
}

.ai-image-analyze-hint {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    z-index: 1061;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-image-analyze-hint i {
    font-size: 1.2rem;
}

.ai-image-analyze-cancel {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    margin-left: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-image-analyze-cancel:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Image button overlay - appears on each image */
.ai-image-btn-overlay {
    border: 3px solid rgba(99, 102, 241, 0.5);
    transition: border-color 0.2s, background 0.2s;
}

.ai-image-btn-overlay:hover {
    border-color: #6366f1;
    background: rgba(0, 0, 0, 0.4) !important;
}

.ai-image-btn-overlay.selected {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2) !important;
}

/* Analyze button on image */
.ai-image-analyze-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-image-analyze-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.ai-image-analyze-btn i {
    font-size: 1.1rem;
}

.ai-image-btn-overlay.selected .ai-image-analyze-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.ai-image-btn-overlay.selected .ai-image-analyze-btn:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Image preview in chat input */
.ai-selected-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.ai-selected-image-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.ai-selected-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-selected-image-item .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* Document item preview (PDF, Office files) */
.ai-selected-doc-item {
    width: auto;
    min-width: 80px;
    max-width: 150px;
    height: auto;
    padding: 8px 12px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-selected-doc-item .doc-icon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ai-selected-doc-item .doc-icon-wrapper i {
    font-size: 1.5rem;
    color: #6366f1;
}

.ai-selected-doc-item .doc-icon-wrapper .doc-name {
    font-size: 0.65rem;
    color: #4b5563;
    text-align: center;
    word-break: break-word;
    line-height: 1.2;
}

/* Document analyze button styles */
.ai-doc-analyze-btn,
.ai-iframe-analyze-btn {
    background: rgba(99, 102, 241, 0.9) !important;
    color: white !important;
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
}

.ai-doc-analyze-btn:hover,
.ai-iframe-analyze-btn:hover {
    background: rgba(99, 102, 241, 1) !important;
}

.ai-iframe-btn-overlay {
    border: 2px dashed rgba(99, 102, 241, 0.5);
}

/* =====================================================
   Pin State
   ===================================================== */
.ai-chat-panel.pinned {
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.08);
}

.ai-chat-action-btn.pinned {
    background: rgba(251, 191, 36, 0.15);
    border-radius: 6px;
}

.ai-chat-action-btn.pinned i {
    color: #f59e0b;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

/* Shift quick menu sidebar left when AI panel is pinned */
body.ai-panel-pinned .shortcuts-sidebar {
    right: 400px;
    transition: right 0.3s ease-in-out, width 0.15s ease, top 0.2s ease;
}

/* Page content offset when panel is pinned — wide screens only (>1200px) */
/* Below 1200px, the AI panel overlays content to preserve content width */
@media (min-width: 1201px) {
    body.ai-panel-pinned main > .container,
    body.ai-panel-pinned main > .container-fluid {
        max-width: none;
        width: auto;
        margin-left: 0;
        padding-right: 478px; /* 400px AI panel + 48px sidebar + 30px gap */
        transition: padding-right 0.3s ease-in-out;
    }

    /* When both AI panel pinned and sidebar expanded */
    body.ai-panel-pinned.sidebar-expanded main > .container,
    body.ai-panel-pinned.sidebar-expanded main > .container-fluid {
        padding-right: 630px; /* 400px AI panel + 200px sidebar + 30px gap */
    }
}

@media (max-width: 768px) {
    body.ai-panel-pinned .shortcuts-sidebar {
        right: 0;
    }
}

/* Context change indicator animation */
.ai-chat-context-indicator.context-updated {
    animation: context-flash 0.5s ease-in-out 2;
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid #6366f1;
}

@keyframes context-flash {
    0%, 100% { background: rgba(99, 102, 241, 0.12); }
    50% { background: rgba(99, 102, 241, 0.25); }
}

/* Context change notice in chat */
.ai-context-change-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #4338ca;
    margin: 4px 0;
}

.ai-context-change-notice i {
    font-size: 0.85rem;
    flex-shrink: 0;
    animation: context-spin 0.6s ease-in-out;
}

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

.ai-context-change-notice span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Send Button */
.ai-chat-send-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
}

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

.ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-chat-send-btn i {
    font-size: 0.9rem;
}

/* =====================================================
   Dark Mode
   ===================================================== */
[data-theme="dark"] .ai-chat-panel {
    background: #1e1e1e;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .ai-chat-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

[data-theme="dark"] .ai-chat-messages::-webkit-scrollbar-thumb {
    background: #4b5563;
}

[data-theme="dark"] .ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

[data-theme="dark"] .ai-chat-welcome {
    color: #9ca3af;
}

[data-theme="dark"] .ai-chat-welcome h4 {
    color: #e5e7eb;
}

[data-theme="dark"] .ai-welcome-icon {
    color: #a78bfa;
}

[data-theme="dark"] .ai-message.assistant .ai-message-bubble {
    background: #2d2d2d;
    color: #e5e7eb;
}

[data-theme="dark"] .ai-message.user .ai-message-avatar {
    background: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .ai-message-bubble code {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ai-message-bubble pre {
    background: #111827;
}

[data-theme="dark"] .ai-message-bubble a {
    color: #a78bfa;
}

[data-theme="dark"] .ai-message-time {
    color: #6b7280;
}

[data-theme="dark"] .ai-message-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

[data-theme="dark"] .ai-chat-input-container {
    background: #1e1e1e;
    border-top-color: #333;
}

[data-theme="dark"] .ai-chat-context-indicator {
    background: #2d2d2d;
    color: #9ca3af;
}

[data-theme="dark"] .ai-chat-input-wrapper {
    background: #2d2d2d;
    border-color: #444;
}

[data-theme="dark"] .ai-chat-input-wrapper:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

[data-theme="dark"] .ai-chat-input {
    color: #e5e7eb;
}

[data-theme="dark"] .ai-chat-input::placeholder {
    color: #6b7280;
}

[data-theme="dark"] .ai-chat-search-toggle {
    background: #3a3a3a;
}

[data-theme="dark"] .ai-chat-search-toggle i {
    color: #9ca3af;
}

[data-theme="dark"] .ai-chat-search-toggle.active {
    background: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .ai-chat-search-toggle.active i {
    color: #34d399;
}

[data-theme="dark"] .ai-toggle-slider {
    background-color: #4b5563;
}

[data-theme="dark"] .ai-toggle-switch input:checked + .ai-toggle-slider {
    background-color: #10b981;
}

[data-theme="dark"] .ai-chat-vision-toggle {
    background: #3a3a3a;
}

[data-theme="dark"] .ai-chat-vision-toggle i {
    color: #9ca3af;
}

[data-theme="dark"] .ai-chat-vision-toggle.active {
    background: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .ai-chat-vision-toggle.active i {
    color: #a78bfa;
}

[data-theme="dark"] .ai-image-analyze-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .ai-image-btn-overlay {
    border-color: rgba(167, 139, 250, 0.5);
}

[data-theme="dark"] .ai-image-btn-overlay:hover {
    border-color: #a78bfa;
}

[data-theme="dark"] .ai-selected-image-item {
    border-color: #444;
}

[data-theme="dark"] .ai-selected-doc-item {
    background: #2d2d2d;
}

[data-theme="dark"] .ai-selected-doc-item .doc-icon-wrapper i {
    color: #a78bfa;
}

[data-theme="dark"] .ai-selected-doc-item .doc-icon-wrapper .doc-name {
    color: #9ca3af;
}

[data-theme="dark"] .ai-chat-overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .ai-chat-panel.pinned {
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ai-chat-action-btn.pinned {
    background: rgba(251, 191, 36, 0.2);
}

[data-theme="dark"] .ai-chat-action-btn.pinned i {
    color: #fbbf24;
}

[data-theme="dark"] .ai-chat-context-indicator.context-updated {
    background: rgba(167, 139, 250, 0.15);
    border-left-color: #a78bfa;
}

[data-theme="dark"] .ai-context-change-notice {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

/* =====================================================
   Mobile & Tablet Responsive
   ===================================================== */

/* iPad and tablet specific fixes */
@media (max-width: 1024px) {
    .ai-chat-panel {
        /* Use safe area inset for devices with notch/home indicator */
        padding-bottom: env(safe-area-inset-bottom, 0);
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
    }

    .ai-chat-input-container {
        /* Add extra padding at bottom for iOS safe area */
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    }
}

@media (max-width: 480px) {
    .ai-chat-panel {
        width: 100%;
        right: -100%;
    }

    .ai-chat-header {
        padding: 12px 16px;
    }

    .ai-chat-messages {
        padding: 16px;
    }

    .ai-chat-input-container {
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    }

    .ai-chat-welcome {
        padding: 30px 15px;
    }
}

/* iOS Safari specific - handle virtual keyboard */
@supports (-webkit-touch-callout: none) {
    .ai-chat-panel {
        height: calc(-webkit-fill-available - 60px);
    }

    .ai-chat-input-container {
        position: sticky;
        bottom: 0;
    }
}

/* =====================================================
   Shortcut Icon Animation
   ===================================================== */
#ai-chat-shortcut .shortcut-icon {
    transition: transform 0.2s ease;
}

#ai-chat-shortcut:hover .shortcut-icon {
    transform: scale(1.1);
}

#ai-chat-shortcut.active .shortcut-icon {
    color: #8b5cf6;
}

[data-theme="dark"] #ai-chat-shortcut.active .shortcut-icon {
    color: #a78bfa;
}

/* =====================================================
   Web Search Badge
   ===================================================== */
.ai-web-search-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #059669;
    background: #d1fae5;
    padding: 3px 8px;
    border-radius: 12px;
    margin-bottom: 6px;
}

.ai-web-search-badge i {
    font-size: 0.65rem;
}

[data-theme="dark"] .ai-web-search-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}
