/* ========================================
   index.html 专用样式
   从 HTML 中提取的内联样式
   ======================================== */

/* ========== 图片上传按钮样式 ========== */
.upload-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
    flex-shrink: 0;
}

.upload-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.5);
}

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

.upload-icon {
    font-size: 20px;
    color: white;
}

.upload-icon::before {
    content: '📷';
}

.mic-icon::before {
    content: '🎤';
}

/* ========== 图片预览样式 ========== */
.image-preview {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-message img {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.image-message img:hover {
    transform: scale(1.02);
}

/* ==========  图片识别模式选择器样式 ========== */
.vision-mode-selector {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 8px;
    animation: fadeInSlide 0.3s ease-out;
}

.vision-mode-select,
.vision-response-length-select {
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    border: 2px solid #667eea;
    border-radius: 20px;
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    min-width: 140px;
}

.vision-mode-select:hover,
.vision-response-length-select:hover {
    border-color: #764ba2;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.vision-mode-select:focus,
.vision-response-length-select:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.vision-mode-select option,
.vision-response-length-select option {
    padding: 8px 12px;
    font-size: 13px;
}

/* 深色模式支持 */
body.dark-theme .vision-mode-select,
body.dark-theme .vision-response-length-select {
    background: linear-gradient(135deg, #2d2d3e 0%, #3a3a4e 100%);
    border-color: #667eea;
    color: #e0e0e0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

body.dark-theme .vision-mode-select option,
body.dark-theme .vision-response-length-select option {
    background: #2d2d3e;
    color: #e0e0e0;
}

/* 动画 */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式支持 */
@media (max-width: 768px) {
    .vision-mode-selector {
        margin: 4px 0;
        width: 100%;
    }
    
    .vision-mode-select {
        width: 100%;
        min-width: unset;
        font-size: 12px;
        padding: 6px 28px 6px 10px;
    }
}

/* ========== 指令卡片样式 ========== */
.command-card {
    animation: cardSlideIn 0.3s ease-out;
    transition: transform 0.2s, box-shadow 0.2s;
}

.command-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.command-card button {
    transition: all 0.2s ease;
    white-space: nowrap;
}

.command-card button:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.command-card button:active {
    transform: scale(0.95);
}

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

/* ========== 摄像头按钮样式 ========== */
.camera-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.camera-btn:hover {
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.5);
}

/* ========== 智能指令卡片样式 ========== */
.command-hint-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
    background: white;
}

.command-hint-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.command-hint-card:active {
    transform: scale(0.97);
}

/* ========== 摄像头弹窗样式 ========== */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.camera-modal-content {
    background: white;
    border-radius: 16px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ========================================
   📱 移动端全面优化 - 所有手机适配
   ======================================== */

/* 全局触控优化 */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 允许文本框选择复制 */
input, textarea, [contenteditable] {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

/* iOS 滚动优化 */
.chat-messages, .panel-content, .settings-content {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

/* 禁止双击放大 */
html {
    touch-action: manipulation;
}

/* 修复 iOS 输入框字体缩放 */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
    font-size: 16px !important;
}

/* PWA 独立模式优化 */
body.standalone-mode {
    padding-top: env(safe-area-inset-top);
}

body.standalone-mode .chat-container {
    height: 100dvh;
    min-height: 100dvh;
}

body.standalone-mode .quick-access-bar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

/* 快捷操作栏安全区域 */
.quick-access-bar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

/* 状态栏安全区域 */
.status-bar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 版本标识避开安全区 */
#code-version {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ========== 移动端快捷操作栏优化 ========== */
@media (max-width: 768px) {
    .quick-access-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 12px;
        justify-content: center;
    }
    
    .quick-access-btn {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 16px;
        min-height: 36px;
    }
    
    /* 指令卡片移动端优化 */
    .command-hint-cards {
        gap: 6px !important;
    }
    
    .cmd-hint-card {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    
    /* 录音/播放指示器优化 */
    #recording-indicator,
    #speaking-indicator {
        top: 60px !important;
        font-size: 14px !important;
        padding: 8px 16px !important;
        max-width: 80vw;
    }
    
    /* 摄像头弹窗移动端 */
    #camera-modal .modal-content {
        width: 95% !important;
        max-width: none !important;
        margin: 10px;
    }
    
    /* 输入区底部安全区 */
    .input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    
    /* 唤醒按钮优化 */
    #wake-word-btn {
        padding: 8px 16px;
        font-size: 13px;
        min-height: 36px;
    }
}

/* ========== 超小屏幕手机 (< 375px) ========== */
@media (max-width: 374px) {
    .chat-header h1 {
        font-size: 0.9rem;
    }
    
    .quick-access-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .cmd-hint-card {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
    
    .input-controls {
        gap: 4px;
    }
    
    .voice-btn, .send-btn, .upload-btn {
        width: 36px;
        height: 36px;
    }
}

/* ========== 横屏模式优化 ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-container {
        height: 100vh;
        height: 100dvh;
    }
    
    .chat-header {
        padding: 6px 12px !important;
    }
    
    .chat-messages {
        max-height: calc(100dvh - 140px) !important;
    }
    
    .welcome-message {
        padding: 10px !important;
    }
    
    .side-panel {
        height: 85vh;
        max-height: 85vh;
    }
    
    .quick-access-bar {
        display: none;
    }
    
    .status-bar {
        display: none;
    }
}

/* ========== 平板优化 (768px - 1024px) ========== */
@media (min-width: 769px) and (max-width: 1024px) {
    .chat-container {
        max-width: 96%;
    }
    
    .quick-access-bar {
        justify-content: center;
    }
}

/* ========== 大屏幕优化 (> 1024px) ========== */
@media (min-width: 1025px) {
    .chat-container {
        max-width: 900px;
    }
    
    .pwa-install-banner {
        max-width: 900px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
}

/* ========== 深色模式全局适配 ========== */
@media (prefers-color-scheme: dark) {
    body:not(.light-theme) .pwa-install-banner {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }
}

/* ========== 打印样式 ========== */
@media print {
    .pwa-install-banner,
    .quick-access-bar,
    .status-bar,
    #code-version,
    .input-area,
    .chat-header {
        display: none !important;
    }
    
    .chat-container {
        box-shadow: none;
        height: auto;
    }
}
