/* 移动端适配样式 */

/* 平板设备 */
@media (max-width: 1024px) {
    .content-wrapper {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1rem;
    }
    
    .actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    
    .settings-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* 手机设备 */
@media (max-width: 768px) {
    /* 侧边栏移动端适配 */
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        max-width: 320px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* 显示移动端按钮 */
    .menu-toggle,
    .sidebar-toggle {
        display: block;
    }
    
    /* 顶部导航栏移动端适配 */
    .topbar {
        padding: 0 1rem;
        height: 60px;
    }
    
    .topbar-title h1 {
        font-size: 1.25rem;
    }
    
    .topbar-actions {
        gap: 0.5rem;
    }
    
    /* 内容区域移动端适配 */
    .content-wrapper {
        padding: 1rem;
    }
    
    /* 统计卡片移动端适配 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
        flex-direction: row;
        align-items: center;
    }
    
    .stat-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* 操作按钮移动端适配 */
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .action-card {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .action-card i {
        font-size: 1.25rem;
    }
    
    .action-card span {
        font-size: 0.875rem;
    }
    
    /* 文档移动端适配 */
    .docs-header h2,
    .chat-header h2,
    .models-header h2,
    .logs-header h2,
    .settings-header h2 {
        font-size: 1.5rem;
    }
    
    .docs-header p,
    .chat-header p {
        font-size: 1rem;
    }
    
    .endpoint-card {
        padding: 1rem;
    }
    
    .endpoint-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .path {
        word-break: break-all;
    }
    
    /* 聊天测试移动端适配 */
    .chat-config,
    .chat-response {
        padding: 1.5rem;
    }
    
    .response-area {
        font-size: 0.8rem;
        max-height: 300px;
    }
    
    /* 模型管理移动端适配 */
    .models-header,
    .logs-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .models-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .models-content,
    .logs-content {
        padding: 1.5rem;
    }
    
    /* 设置移动端适配 */
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .setting-card {
        padding: 1.5rem;
    }
    
    /* 模态框移动端适配 */
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    
    .modal-footer button {
        width: 100%;
        justify-content: center;
    }
    
    /* 消息提示移动端适配 */
    .toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
        font-size: 0.875rem;
    }
    
    /* 表单移动端适配 */
    .form-control {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 按钮移动端适配 */
    .btn-primary,
    .btn-secondary {
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* 小屏手机设备 */
@media (max-width: 480px) {
    /* 进一步优化小屏幕 */
    .content-wrapper {
        padding: 0.75rem;
    }
    
    /* 统计卡片小屏适配 */
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .stat-icon {
        align-self: center;
    }
    
    /* 操作按钮小屏适配 */
    .actions-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .action-card {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        padding: 1rem;
    }
    
    /* 侧边栏小屏适配 */
    .sidebar {
        max-width: 280px;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .logo {
        font-size: 1.125rem;
    }
    
    .menu-item {
        padding: 0.75rem 1rem;
    }
    
    /* 顶部导航栏小屏适配 */
    .topbar {
        height: 56px;
        padding: 0 0.75rem;
    }
    
    .topbar-title h1 {
        font-size: 1.125rem;
    }
    
    /* 文档小屏适配 */
    .docs-header h2,
    .chat-header h2,
    .models-header h2,
    .logs-header h2,
    .settings-header h2 {
        font-size: 1.375rem;
    }
    
    .endpoint-card {
        padding: 0.875rem;
    }
    
    .method {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* 聊天测试小屏适配 */
    .chat-config,
    .chat-response {
        padding: 1rem;
    }
    
    .response-area {
        padding: 1rem;
        font-size: 0.75rem;
        max-height: 250px;
    }
    
    /* 模型管理小屏适配 */
    .models-content,
    .logs-content {
        padding: 1rem;
        min-height: 200px;
    }
    
    /* 设置小屏适配 */
    .setting-card {
        padding: 1rem;
    }
    
    .setting-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        max-width: 280px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    .menu-item,
    .action-card,
    .btn-primary,
    .btn-secondary,
    .btn-outline {
        min-height: 44px;
    }
    
    /* 移除悬停效果 */
    .stat-card:hover,
    .action-card:hover,
    .setting-card:hover,
    .endpoint-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }
    
    /* 优化点击反馈 */
    .action-card:active,
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.98);
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
    }
    
    .status-indicator i {
        animation: none;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a202c;
        --bg-secondary: #2d3748;
        --text-primary: #f7fafc;
        --text-secondary: #a0aec0;
        --border-color: #4a5568;
    }
    
    .response-area {
        background: #0d1117;
        color: #f0f6fc;
    }
} 