/* ==================== 响应式设计 - 手机端和电脑端完全分离 ==================== */

/* ==================== 设备检测变量 ==================== */
:root {
    /* 电脑端变量 */
    --sidebar-width: 240px;
    --header-height: 60px;
    --card-padding: 24px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==================== 电脑端样式 (默认) ==================== */
/* 屏幕宽度大于 1024px 时显示电脑端界面 */
@media screen and (min-width: 1025px) {
    /* 电脑端：显示侧边栏，隐藏底部导航 */
    .mobile-nav {
        display: none !important;
    }
    
    .sidebar {
        display: flex !important;
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
        margin-bottom: 0;
    }
    
    /* 电脑端：表格显示 */
    .desktop-table {
        display: table;
    }
    
    .mobile-list {
        display: none;
    }
    
    /* 电脑端：多列布局 */
    .form-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .form-row-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* 电脑端：卡片网格 */
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 24px;
    }
    
    /* 电脑端：统计卡片 */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
    
    /* 电脑端：模态框 */
    .modal-dialog {
        max-width: 600px;
        margin: 50px auto;
    }
    
    .modal-lg {
        max-width: 900px;
    }
    
    /* 电脑端：按钮组 */
    .btn-group {
        display: flex;
        gap: 8px;
    }
    
    /* 电脑端：搜索区域 */
    .search-area {
        display: flex;
        gap: 16px;
        align-items: center;
    }
    
    .search-area input {
        width: 300px;
    }
}

/* ==================== 平板端样式 (768px - 1024px) ==================== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .mobile-nav {
        display: none !important;
    }
    
    .sidebar {
        display: flex !important;
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== 手机端样式 (小于 768px) ==================== */
@media screen and (max-width: 768px) {
    /* 手机端：隐藏侧边栏，显示底部导航 */
    .sidebar {
        display: none !important;
    }
    
    .mobile-nav {
        display: flex !important;
    }
    
    .main-content {
        margin-left: 0;
        margin-bottom: 60px; /* 为底部导航留出空间 */
        padding: 12px;
    }
    
    /* 手机端：顶部标题栏 */
    .mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: var(--primary);
        color: white;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .mobile-header h1 {
        font-size: 18px;
        font-weight: 500;
    }
    
    .mobile-header .actions {
        display: flex;
        gap: 16px;
    }
    
    .mobile-header .actions i {
        font-size: 20px;
    }
    
    /* 手机端：隐藏电脑端表格，显示卡片列表 */
    .desktop-table {
        display: none !important;
    }
    
    .mobile-list {
        display: block;
    }
    
    /* 手机端：客户卡片 */
    .customer-card {
        background: white;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    .customer-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }
    
    .customer-card-title {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .customer-card-title h3 {
        font-size: 16px;
        font-weight: 600;
    }
    
    .customer-card-body {
        display: grid;
        gap: 8px;
        color: var(--text-secondary);
        font-size: 14px;
    }
    
    .customer-card-body .info-row {
        display: flex;
        justify-content: space-between;
    }
    
    .customer-card-footer {
        display: flex;
        gap: 8px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }
    
    .customer-card-footer button {
        flex: 1;
        padding: 10px;
        border-radius: 8px;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    /* 手机端：底部导航 */
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--border);
        display: flex;
        justify-content: space-around;
        padding: 8px 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 4px 12px;
        color: var(--text-secondary);
        font-size: 12px;
        border: none;
        background: none;
    }
    
    .mobile-nav-item i {
        font-size: 22px;
    }
    
    .mobile-nav-item.active {
        color: var(--primary);
    }
    
    /* 手机端：表单单列布局 */
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    /* 手机端：全宽按钮 */
    .btn-block-mobile {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }
    
    /* 手机端：浮动操作按钮 */
    .fab {
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
        z-index: 999;
    }
    
    /* 手机端：模态框全屏 */
    .modal-dialog {
        max-width: 100%;
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }
    
    .modal-content {
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
    }
    
    /* 手机端：搜索栏 */
    .mobile-search {
        display: flex;
        gap: 12px;
        padding: 12px;
        background: white;
        margin-bottom: 12px;
        border-radius: 12px;
    }
    
    .mobile-search input {
        flex: 1;
        padding: 12px 16px;
        border: 1px solid var(--border);
        border-radius: 8px;
        font-size: 16px;
    }
    
    /* 手机端：统计卡片横向滚动 */
    .stats-grid {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .stat-card {
        min-width: 140px;
        flex-shrink: 0;
    }
    
    /* 手机端：标签横向滚动 */
    .tag-scroll {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 8px 0;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 手机端：快捷操作网格 */
    .quick-actions {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        padding: 16px;
        background: white;
        border-radius: 12px;
        margin-bottom: 12px;
    }
    
    .quick-action-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 12px 8px;
        border-radius: 12px;
        background: var(--bg);
    }
    
    .quick-action-item i {
        font-size: 24px;
        color: var(--primary);
    }
    
    .quick-action-item span {
        font-size: 12px;
        color: var(--text-secondary);
    }
    
    /* 手机端：时间线样式 */
    .mobile-timeline {
        padding-left: 24px;
        border-left: 2px solid var(--border);
    }
    
    .timeline-item {
        position: relative;
        padding-bottom: 20px;
    }
    
    .timeline-item::before {
        content: '';
        position: absolute;
        left: -29px;
        top: 4px;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: var(--primary);
    }
    
    /* 手机端：登录页面 */
    .login-box {
        padding: 24px;
        margin: 16px;
    }
    
    .login-logo {
        width: 60px;
        height: 60px;
    }
    
    .login-logo i {
        font-size: 28px;
    }
    
    .login-header h1 {
        font-size: 20px;
    }
}

/* ==================== 小屏手机适配 (小于 375px) ==================== */
@media screen and (max-width: 375px) {
    .mobile-nav-item span {
        font-size: 10px;
    }
    
    .mobile-nav-item i {
        font-size: 20px;
    }
    
    .customer-card {
        padding: 12px;
    }
    
    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 12px;
    }
}

/* ==================== 横屏手机适配 ==================== */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .mobile-nav {
        display: none !important;
    }
    
    .main-content {
        margin-bottom: 0;
    }
    
    .fab {
        bottom: 20px;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .sidebar,
    .mobile-nav,
    .mobile-header,
    .fab,
    .btn-group {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 20px;
    }
}
