/* style.css v4.0 - 完美响应式版 */

/* --- 1. 全局基础 --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    margin: 0; padding: 0; background-color: #f2f4f8; color: #333; font-size: 14px; 
}

/* --- 2. 布局框架 (Mobile First) --- */
/* 导航栏 (默认手机底部) */
.main-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 60px;
    background: white; border-top: 1px solid #eee;
    display: flex; justify-content: space-around; align-items: center;
    z-index: 1000; padding-bottom: env(safe-area-inset-bottom);
}
.nav-brand { display: none; } /* 手机端不显示Logo */
.nav-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex: 1; height: 100%; border: none; background: transparent; color: #999;
    font-size: 10px; cursor: pointer; transition: 0.2s;
}
.nav-icon { font-size: 22px; margin-bottom: 2px; }
.nav-btn.active { color: #007bff; }
.pc-logout { display: none; } /* 手机端隐藏侧边栏退出 */

/* 主内容区 */
.main-content { padding-bottom: 70px; /* 避开底部导航 */ }
.container { max-width: 100%; padding: 10px; margin: 0 auto; }

/* 顶部Header */
.app-header {
    background: white; padding: 15px; display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 900; box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}
.page-title { font-size: 18px; font-weight: bold; }
.user-info { font-size: 12px; color: #666; }

/* --- 3. 组件样式 --- */
.view-section { display: none; animation: fadeIn 0.3s; }
.view-section.active { display: block; }
@keyframes fadeIn { from {opacity:0; transform:translateY(5px)} to {opacity:1; transform:translateY(0)} }

/* 搜索栏与工具栏 */
.toolbar { display: flex; gap: 10px; margin-bottom: 10px; }
.search-input { flex: 1; padding: 10px; border: 1px solid #eee; border-radius: 8px; background: white; }
.btn-pc-add { display: none; } /* 手机端隐藏顶部录入按钮 */

/* 卡片 */
.item-card { background: white; margin-bottom: 10px; border-radius: 10px; padding: 15px; box-shadow: 0 2px 6px rgba(0,0,0,0.03); border: 1px solid #fff; transition: transform 0.2s; }
.card-flex { display: flex; justify-content: space-between; align-items: center; }
.phone-card-flex { display: flex; gap: 12px; align-items: flex-start; }

/* 手机列表图片 */
.thumb-container { width: 70px; height: 70px; border-radius: 6px; overflow: hidden; background: #f8f9fa; border: 1px solid #eee; flex-shrink: 0; cursor: zoom-in; }
.thumb { width: 100%; height: 100%; object-fit: cover; }
.phone-info { flex: 1; min-width: 0; }

/* 标签 */
.tag { background: #f0f2f5; padding: 2px 6px; border-radius: 4px; font-size: 11px; color: #666; margin-right: 5px; display: inline-block; margin-top: 3px; }
.price-tag { color: #dc3545; font-weight: bold; font-size: 15px; }

/* 按钮 */
.btn-group { display: flex; gap: 8px; margin-top: 10px; }
.btn { border: none; padding: 8px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; color: white; transition: 0.2s; }
.btn-blue { background: #007bff; } .btn-blue:hover { background: #0056b3; }
.btn-green { background: #28a745; } .btn-green:hover { background: #218838; }
.btn-red { background: #fff; border: 1px solid #ffcccc; color: #dc3545; } .btn-red:hover { background: #dc3545; color: white; }
.btn-gray { background: #f8f9fa; border: 1px solid #eee; color: #666; }

/* 悬浮球 (手机专用) */
.fab { 
    position: fixed; bottom: 80px; right: 20px; 
    width: 55px; height: 55px; border-radius: 50%; 
    background: #007bff; color: white; font-size: 30px; 
    display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 4px 15px rgba(0,123,255,0.4); 
    z-index: 999; cursor: pointer; 
}
.stats-bar { background: white; padding: 8px; border-radius: 8px; font-size: 12px; color: #666; text-align: center; margin-bottom: 10px; }

/* --- 4. SweetAlert2 适配 --- */
.swal2-popup { border-radius: 12px !important; font-size: 14px !important; }
.swal2-input { font-size: 14px !important; margin: 10px auto !important; height: 40px !important; }

/* =================================================================
   💻 PC 端响应式布局 (当屏幕宽度大于 768px 时生效)
   ================================================================= */
@media (min-width: 768px) {
    
    /* 1. 导航栏变侧边栏 */
    .main-nav {
        width: 240px; height: 100vh;
        flex-direction: column; justify-content: flex-start; align-items: stretch;
        border-top: none; border-right: 1px solid #eee;
        padding: 0; top: 0; bottom: 0;
    }
    .nav-brand {
        display: flex; height: 64px; align-items: center; padding-left: 20px;
        font-size: 20px; font-weight: bold; color: #333; border-bottom: 1px solid #f0f0f0;
        background: #fff;
    }
    .nav-btn {
        flex: 0 0 50px; height: 50px; flex-direction: row; justify-content: flex-start;
        padding-left: 20px; gap: 15px; font-size: 14px;
    }
    .nav-btn.active { background: #e6f7ff; border-right: 3px solid #007bff; color: #007bff; }
    .nav-btn:hover { background: #f9f9f9; }
    
    /* 显示PC端退出按钮，隐藏手机退出按钮 */
    .pc-logout { display: flex; margin-top: auto; border-top: 1px solid #eee; color: #666; }
    .mobile-logout { display: none; }

    /* 2. 主内容区调整 */
    .main-content { margin-left: 240px; padding-bottom: 0; min-height: 100vh; background: #f2f4f8; }
    .app-header { padding: 0 30px; height: 64px; background: white; }
    .container { max-width: 1400px; padding: 20px 30px; }

    /* 3. 网格布局 (卡片变多列) */
    .grid-list {
        display: grid; 
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); /* 自动适应列数 */
        gap: 20px;
    }
    .item-card { margin-bottom: 0; height: 100%; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid #eee; }
    .item-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.08); }

    /* 4. 操作按钮调整 */
    .fab { display: none; } /* 隐藏悬浮球 */
    .btn-pc-add { display: inline-block; width: auto; padding: 10px 20px; } /* 显示顶部按钮 */
    .search-input { max-width: 400px; }

    /* style.css 新增样式 */

/* 顶栏用户信息区 */
.user-info { 
    display: flex; 
    align-items: center; 
    font-size: 13px; 
    color: #666; 
}

/* 顶栏退出按钮样式 */
.header-logout-btn {
    display: inline-block;
    background: #f1f3f5;
    color: #dc3545; /* 红色字体 */
    padding: 4px 10px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #e9ecef;
    transition: 0.2s;
}

.header-logout-btn:active {
    background: #dc3545;
    color: white;
}

/* style.css 新增样式 */

/* 顶栏按钮通用样式 */
.header-action-btn {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    margin-left: 5px;
    transition: 0.2s;
    border: 1px solid transparent;
}

/* 改密按钮 (蓝色) */
.btn-key {
    background: #e7f5ff;
    color: #007bff;
    border-color: #b3d7ff;
}
.btn-key:active { background: #007bff; color: white; }

/* 退出按钮 (红色) */
.btn-out {
    background: #fff5f5;
    color: #dc3545;
    border-color: #ffc9c9;
}
.btn-out:active { background: #dc3545; color: white; }
}