/* Amazon POM Manager - 手机端适配样式 */

/* ============================================
   手机端适配 (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    /* 基础布局调整 - 允许页面滚动 */
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    html {
        height: 100% !important;
        overflow-y: scroll !important;
        overflow-x: hidden !important;
    }
    
    body {
        height: auto !important;
        min-height: 100% !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        padding-bottom: 20px;
        position: static !important;
    }
    
    /* 隐藏右侧功能栏 */
    .top-function-bar {
        display: none !important;
    }
    
    /* 右上角按钮调整 - 缩小尺寸 */
    .top-right-controls {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1001;
    }
    
    .top-right-controls .btn {
        padding: 6px 12px;
        font-size: 12px;
        min-width: auto;
        height: 32px;
        width: auto;
    }
    
    /* 固定Banner区域改为相对定位 */
    .fixed-banner {
        position: relative;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        padding: 12px 10px;
        margin-bottom: 10px;
        border-radius: 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        z-index: 10;
    }
    
    .header {
        margin-bottom: 8px;
        padding: 3px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .header .subtitle {
        font-size: 11px;
        margin-top: 2px;
    }
    
    /* 统计卡片 - 居中显示 */
    .stats-bar {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        padding: 8px 0;
        margin-bottom: 10px;
        flex-wrap: nowrap;
    }
    
    .stat-card {
        flex: 1;
        max-width: 80px;
        padding: 10px 8px;
        border-radius: 8px;
        text-align: center;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
        margin-top: 2px;
    }
    
    /* 筛选栏调整 - 紧凑布局，按钮整体缩小 */
    .filter-bar {
        flex-direction: row;
        gap: 8px;
        align-items: center;
        margin-bottom: 8px;
    }
    
    .filter-group {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding: 3px 0;
        flex-wrap: nowrap;
        flex: 1;
    }
    
    .filter-group::-webkit-scrollbar {
        display: none;
    }
    
    .filter-btn {
        flex-shrink: 0;
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 15px;
        white-space: nowrap;
    }
    
    /* 搜索框缩小 */
    .search-box {
        flex: 0 0 auto;
        max-width: 110px;
    }
    
    .search-box input {
        width: 100%;
        padding: 5px 10px;
        border-radius: 12px;
        border: 1px solid var(--border-light);
        font-size: 11px;
    }
    
    /* 分类导航 - 手机端紧凑布局 */
    .category-nav {
        display: flex !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        padding: 5px 0;
        margin: 5px 0 15px 0;
        background: transparent;
        width: 100%;
        border-bottom: 1px solid var(--border-light);
        box-shadow: none !important;
        z-index: auto !important;
        overflow-x: auto;
        gap: 6px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .category-nav::-webkit-scrollbar {
        display: none;
    }
    
    /* 分类按钮统一样式 - 更紧凑 */
    .category-nav .category-btn {
        flex-shrink: 0;
        padding: 5px 10px;
        font-size: 11px;
        white-space: nowrap;
        background: var(--bg-gray);
        color: var(--text-primary);
        border: 1px solid var(--border-medium);
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s ease;
        line-height: 1.3;
    }
    
    .category-nav .category-btn.active {
        background: var(--btn-active-bg);
        color: var(--btn-active-text);
        border-color: var(--btn-active-bg);
    }
    
    /* 主内容区域 - 允许内容滚动 */
    .main-layout {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        width: 100%;
        padding: 15px;
        height: auto;
        overflow: visible;
        margin-top: 20px;
    }
    
    /* 表格容器 - 改为卡片布局 */
    .product-table-container {
        overflow-x: visible;
        margin: 0;
        padding: 0;
    }
    
    /* 隐藏表格头部 */
    .product-table thead {
        display: none;
    }
    
    /* 表格主体改为卡片布局 */
    .product-table {
        width: 100%;
        min-width: auto;
        font-size: 13px;
        display: block;
        border-collapse: collapse;
    }
    
    .product-table tbody {
        display: block;
    }
    
    .product-table tbody tr {
        display: block;
        background: var(--bg-primary);
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-light);
    }
    
    .product-table td {
        display: inline-block;
        padding: 4px 8px;
        white-space: normal;
        vertical-align: top;
        width: calc(33.333% - 16px);
        margin: 4px;
    }
    
    /* 商品图片 - 第一行全宽显示 */
    .product-table td.col-image {
        display: block;
        width: 100%;
        height: 200px;
        padding: 0;
        margin: 0 0 12px 0;
    }
    
    .product-table td.col-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 8px;
    }
    
    /* 商品名称 - 全宽显示 */
    .product-table td.col-name {
        display: block;
        width: 100%;
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 8px;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-light);
    }
    
    /* 收藏和类目 - 小标签样式 */
    .product-table td.col-favorite,
    .product-table td.col-category {
        width: auto;
        padding: 4px 8px;
        background: var(--bg-gray);
        border-radius: 12px;
        font-size: 11px;
    }
    
    /* 其他属性 - 带标签名显示 */
    .product-table td.col-subcategory::before,
    .product-table td.col-price::before,
    .product-table td.col-sales::before,
    .product-table td.col-revenue::before,
    .product-table td.col-profit-margin::before,
    .product-table td.col-launch-date::before,
    .product-table td.col-rating::before,
    .product-table td.col-review-count::before,
    .product-table td.col-children::before,
    .product-table td.col-dimensions::before,
    .product-table td.col-weight::before,
    .product-table td.col-fba::before,
    .product-table td.col-tasks::before,
    .product-table td.col-status::before {
        display: block;
        font-size: 10px;
        color: var(--text-muted);
        margin-bottom: 2px;
    }
    
    .product-table td.col-subcategory::before { content: "小类"; }
    .product-table td.col-price::before { content: "价格"; }
    .product-table td.col-sales::before { content: "月销量"; }
    .product-table td.col-revenue::before { content: "销售额"; }
    .product-table td.col-profit-margin::before { content: "毛利率"; }
    .product-table td.col-launch-date::before { content: "上架日期"; }
    .product-table td.col-rating::before { content: "评分"; }
    .product-table td.col-review-count::before { content: "评论数"; }
    .product-table td.col-children::before { content: "变体数"; }
    .product-table td.col-dimensions::before { content: "包装尺寸"; }
    .product-table td.col-weight::before { content: "重量"; }
    .product-table td.col-fba::before { content: "FBA运费"; }
    .product-table td.col-tasks::before { content: "今日运维"; }
    .product-table td.col-status::before { content: "状态"; }
    
    /* 操作按钮 */
    .product-table td.col-actions {
        display: block;
        width: 100%;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-light);
        text-align: right;
    }
    
    /* 侧边栏全屏 */
    .admin-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .admin-sidebar.open {
        right: 0;
    }
    
    /* 模态框调整 */
    .modal-content {
        width: 90%;
        max-height: 80vh;
        padding: 20px;
    }
}

/* ============================================
   小屏手机适配 (max-width: 375px)
   ============================================ */

@media (max-width: 375px) {
    .header h1 {
        font-size: 16px;
    }
    
    .header .subtitle {
        font-size: 10px;
    }
    
    .stat-card {
        flex: 1;
        max-width: 70px;
        padding: 8px 6px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    .filter-btn {
        padding: 5px 8px;
        font-size: 10px;
        border-radius: 12px;
    }
    
    .category-btn {
        padding: 4px 8px;
        font-size: 10px;
        border-radius: 10px;
    }
    
    .search-box {
        max-width: 90px;
    }
    
    .search-box input {
        padding: 4px 8px;
        font-size: 10px;
        border-radius: 10px;
    }
    
    .product-table {
        font-size: 12px;
    }
    
    .product-table th,
    .product-table td {
        padding: 8px 6px;
    }
}

/* ============================================
   触摸设备优化
   ============================================ */

@media (pointer: coarse) {
    .function-bubble:hover,
    .filter-btn:hover,
    .category-btn:hover {
        transform: none;
    }
    
    .product-table tbody tr {
        cursor: pointer;
    }
}

/* ============================================
   深色模式支持
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a2e;
        --bg-secondary: #16213e;
        --bg-gray: #0f3460;
        --text-primary: #eaeaea;
        --text-secondary: #a0a0a0;
    }
}
