/* ========================================
   移动端优化样式
   ======================================== */

/* 移动端汉堡菜单按钮 */
.mobile-menu-toggle {
    display: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ========================================
   移动端适配 (最大宽度 768px)
   ======================================== */
@media (max-width: 768px) {
    /* 显示汉堡菜单按钮 */
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* 主内容区域 */
    .main-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    /* 侧边栏移动端样式 */
    .sidebar {
        width: 100%;
        border: none;
        border-radius: var(--radius-xl);
        padding: 0.5rem;
    }

    /* 内容区域 */
    .content {
        padding: 0;
    }

    .section h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.875rem;
        border-radius: var(--radius-lg);
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }

    .stat-info h3 {
        font-size: 1.25rem;
    }

    .stat-info p {
        font-size: 0.75rem;
    }

    .form-control {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
        border-radius: var(--radius-md);
    }

    textarea.form-control {
        min-height: 100px;
    }

    /* 按钮优化 */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
        border-radius: var(--radius-md);
    }

    /* 信息网格 */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .info-item {
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        border-radius: var(--radius-md);
        background: var(--bg-secondary);
    }

    .info-label {
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--text-secondary);
    }

    .info-value {
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    /* 账户卡片 */
    .accounts-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* 日志容器 */
    .logs-container {
        height: calc(100vh - 280px);
        min-height: 300px;
        font-size: 0.6875rem;
        line-height: 1.4;
        border-radius: var(--radius-sm);
    }

    /* Toast 通知 */
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        pointer-events: none;
    }

    /* 模态框 */
    .modal-content {
        max-width: 95%;
        max-height: 90vh;
        margin: 5vh auto;
        padding: 1rem;
        border-radius: var(--radius-xl);
    }

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

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

    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 0;
        max-height: calc(90vh - 140px);
    }

    /* Playground */
    .playground-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* 配置网格 */
    .config-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* ========================================
   小屏幕移动设备 (最大宽度 480px)
   ======================================== */
@media (max-width: 480px) {
    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .stat-info h3 {
        font-size: 1.125rem;
    }

    /* 表单控件 */
    .form-control {
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    select.form-control {
        font-size: 16px;
    }

    /* Section标题 */
    .section h2 {
        font-size: 1.125rem;
    }

    /* 日志 */
    .logs-container {
        font-size: 0.625rem;
        padding: 0.5rem;
        height: calc(100vh - 260px);
    }

    .log-entry {
        padding: 0.3125rem;
        font-size: 0.625rem;
    }

    /* Toast */
    .toast {
        font-size: 0.75rem;
        padding: 0.625rem 0.75rem;
    }

    /* 模态框进一步优化 */
    .modal {
        width: 98%;
        max-width: 98%;
        padding: 0.75rem;
    }

    .modal-header {
        padding: 0.75rem;
        margin: -0.75rem -0.75rem 0.75rem -0.75rem;
    }

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

    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
}

/* ========================================
   触摸优化
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* 增加可点击区域 */
    .btn {
        min-height: 44px;
        padding: 0.625rem 1rem;
    }

    .logs-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   打印样式
   ======================================== */
@media print {
    .mobile-menu-toggle,
    .theme-toggle,
    .btn,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        flex-direction: column;
    }

    .content {
        padding: 0;
    }

    .section {
        display: block !important;
        page-break-after: always;
    }
}

/* ========================================
   辅助功能优化
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
