/**
 * 主页面 - 手机版优化样式
 */

/* ==================== 手机版页面头部 ==================== */
@media (max-width: 768px) {
    .page-header {
        padding: 10px 16px !important;
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-primary);
    }

    .page-header-content {
        gap: 8px !important;
    }

    .page-header-title {
        font-size: 18px !important;
        font-weight: 600;
    }

    /* 隐藏帮助按钮，保留主题切换 */
    .page-header-actions .btn-ghost:first-child {
        display: none;
    }

    /* 主题切换按钮样式优化 - 增大触摸区域 */
    .theme-toggle {
        padding: 8px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .theme-toggle svg {
        width: 18px !important;
        height: 18px !important;
    }

    .user-menu .user-name {
        font-size: 14px;
        padding: 6px 10px;
    }
}

/* ==================== 手机版统计卡片 ==================== */
@media (max-width: 768px) {
    .stats-grid {
        display: flex !important;
        overflow-x: auto;
        gap: 8px !important;
        padding: 12px 16px !important;
        margin: 0 !important;
        -webkit-overflow-scrolling: touch;
    }

    .stat-card {
        min-width: 90px !important;
        padding: 14px 12px !important;
        flex-shrink: 0;
        border-radius: 12px !important;
    }

    .stat-card-value {
        font-size: 26px !important;
        font-weight: 700;
        line-height: 1;
        margin-bottom: 6px;
    }

    .stat-card-label {
        font-size: 11px !important;
        line-height: 1.3;
        color: var(--color-secondary);
    }

    /* 隐藏滚动条但保留功能 */
    .stats-grid::-webkit-scrollbar {
        display: none;
    }
    .stats-grid {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ==================== 手机版工具栏 ==================== */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .toolbar-left {
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        font-size: 14px;
        padding: 10px 12px 10px 36px;
    }

    .toolbar-right {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .toolbar-right .btn {
        flex: 1;
        justify-content: center;
        padding: 12px;
        font-size: 15px;
        font-weight: 500;
    }
}

/* ==================== 手机版客户卡片布局 ==================== */
@media (max-width: 768px) {
    /* 隐藏表格 */
    .table-container,
    .page-section table {
        display: none;
    }

    /* 显示卡片容器 */
    .customer-cards-container {
        display: block !important;
        padding: 0 16px 20px;
    }

    .customer-card {
        background: var(--bg-secondary);
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        border: 1px solid var(--border-color);
        position: relative;
    }

    /* 紧急状态 - 红色左边框 */
    .customer-card.urgent {
        border-left: 4px solid #ef4444;
    }

    /* 需联系状态 - 橙色左边框 */
    .customer-card.warning {
        border-left: 4px solid #f59e0b;
    }

    .customer-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
    }

    .customer-card-name {
        font-size: 16px;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 2px;
        flex: 1;
        min-width: 0;
    }

    .customer-card-name.truncated {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .customer-card-account {
        font-size: 12px;
        color: var(--text-secondary);
        margin-top: 2px;
    }

    .customer-card-days {
        flex-shrink: 0;
        margin-left: 12px;
        padding: 4px 10px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        text-align: center;
        min-width: 60px;
    }

    .customer-card-days.urgent {
        background: #fef2f2;
        color: #dc2626;
    }

    .customer-card-days.warning {
        background: #fffbeb;
        color: #d97706;
    }

    .customer-card-days.normal {
        background: #f0fdf4;
        color: #16a34a;
    }

    .customer-card-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }

    .customer-card-last-contact {
        font-size: 12px;
        color: var(--text-secondary);
        flex: 1;
    }

    .customer-card-actions {
        display: flex;
        gap: 8px;
    }

    .customer-card-actions .btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .customer-card-actions .btn-icon {
        padding: 6px 10px;
    }
}

/* ==================== 桌面版隐藏卡片 ==================== */
@media (min-width: 769px) {
    .customer-cards-container {
        display: none;
    }
}

/* ==================== 手机版页面标题 ==================== */
@media (max-width: 768px) {
    .page-section-title {
        font-size: 16px !important;
        padding: 12px 16px !important;
        margin: 0 !important;
    }
}

/* ==================== 手机版空状态 ==================== */
@media (max-width: 768px) {
    .empty-state {
        padding: 40px 20px;
        text-align: center;
        font-size: 14px;
        color: #9ca3af;
    }

    .empty-icon {
        font-size: 48px;
        margin-bottom: 12px;
    }
}

/* ==================== 手机版模态框 ==================== */
@media (max-width: 768px) {
    .modal-dialog {
        width: 95% !important;
        max-width: none !important;
        margin: 10px auto !important;
    }

    .modal-body {
        padding: 16px !important;
    }

    .modal-footer {
        padding: 12px 16px !important;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ==================== 手机版Toast提示 ==================== */
@media (max-width: 768px) {
    .toast {
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        width: 90%;
        max-width: 320px;
        bottom: 20px !important;
    }
}
