/* --- 全局样式 --- */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f0f2f5;
    color: #1c1e21;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

/* --- 屏幕管理 --- */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    flex-direction: column;
    background-color: white;
}

.screen.active {
    display: flex;
}

/* --- 通用布局 --- */
.header {
    display: flex;
    align-items: center;
    justify-content: center; /* 默认居中 */
    padding: 20px; /* 增大内边距，让 logo 更突出 */
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
    height: auto; /* 高度自适应，不再固定为 60px */
    flex-shrink: 0;
}

.header.with-back-button {
    justify-content: space-between; /* 让返回键和右侧内容（如果有的话）分布在两端 */
    padding: 0 10px; /* 带有返回键的 header，左右内边距小一些 */
    height: 60px; /* 带有返回键的，我们依然保持固定高度，更像 App */
}

.header h1 {
    font-size: 20px;
    font-weight: bold; /* 字体加粗 */
    margin: 0;
    flex-grow: 1; /* 允许标题伸展，占据可用空间 */
    padding: 0 10px; /* 为标题左右留出呼吸空间 */
}

.content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    width: 100%;
}

.nav-bar {
    display: flex;
    width: 100%;
    height: 60px;
    border-top: 1px solid #e0e0e0;
    background-color: white;
    flex-shrink: 0;
}

/* --- 组件样式 --- */
.logo {
    height: 40px;
}

.menu-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #f5f6f7;
    border: 1px solid #ddd;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
}

.menu-button .menu-icon {
    width: 30px;
    margin-right: 15px;
}

.menu-button .menu-arrow {
    width: 20px;
    margin-left: auto;
}

.nav-button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
}
.nav-button img { height: 24px; margin-bottom: 2px; }
.nav-button.active { color: #000000; /* 激活状态颜色 */ }

.nav-separator {
    width: 1px;
    background-color: #e0e0e0;
    height: 60%;
    align-self: center;
}

.back-button, .header-icon-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}
.back-button img, .header-icon-button img { height: 24px; }

.action-button {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: #FFA500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: auto; /* 将按钮推到底部 */
}

.warning-box {
    display: flex;
    align-items: center;
    background-color: #dc3545;
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.warning-box img { width: 24px; margin-right: 10px; }

.instruction-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}
.instruction-item img { width: 30px; margin-right: 15px; }

.list-container {
    padding: 0;
}

/* --- 动态生成的设备列表项样式 --- */
.device-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
}
.device-item:hover { background-color: #f0f2f5; }
.device-item img { width: 40px; margin-right: 15px; }
.device-item-info { flex-grow: 1; }
.device-item-info .name { font-weight: bold; }
.device-item-info .address { font-size: 14px; color: #65676b; }
.device-item-info .status { font-size: 12px; color: #FFA500; }

/* --- 状态栏 --- */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}
.status-bar.visible {
    transform: translateY(0);
}
.hidden { display: none !important; }
.info-grid {
    display: grid;
        /* 创建两列：第一列自动宽度，第二列占据所有剩余空间 */
    grid-template-columns: auto 1fr; 
    gap: 10px 20px; /* 行间距10px, 列间距20px */
    align-items: center; /* 垂直居中对齐 */
    margin-bottom: 30px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

    /* 指示所有奇数子元素 (标签) */
.info-grid > span:nth-child(odd) {
    font-weight: bold;
    color: #333;
}

    /* 指示所有偶数子元素 (数值) */
.info-grid > span:nth-child(even) {
    text-align: right; /* <-- 核心：让数值右对齐 */
    color: #65676b;
}
.device-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    background-color: white;
}

.device-item:hover {
    background-color: #f0f2f5;
}

.device-item .icon {
    width: 40px;
    height: 40px;
    margin-right: 15px;
}

.device-item .info {
    flex-grow: 1; /* 占据所有剩余空间 */
}

.device-item .info .name {
    font-weight: bold;
    font-size: 16px;
    color: #1c1e21;
}

.device-item .info .details {
    font-size: 14px;
    color: #65676b;
}

.device-item .info .status {
    font-size: 12px;
    color: #FFA500;
}

.device-item .arrow {
    width: 20px;
    height: 20px;
    margin-left: 15px;
}
.sub-header-text {
    padding: 10px 20px;
    font-size: 14px;
    color: #65676b;
    background-color: #f0f2f5;
    margin: 0;
}

.pair-mode-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 16px;
}

/* --- 滑动开关的核心样式 --- */
.switch-container {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

/* 隐藏原始的 checkbox */
.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* 开关的背景滑槽 */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

/* 开关的圆形滑块 */
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* 当 checkbox 被选中时，改变背景和滑块位置 */
input:checked + .slider {
    background-color: #2196F3; /* 蓝色 */
}

input:checked + .slider:before {
    transform: translateX(22px);
}
.test-result-item {
    display: flex;         /* 让内部的图片和文字并排显示 */
    align-items: center;   /* 让它们垂直居中对齐 */
    margin: 20px 0;      /* 上下留出 20px 的间距 */
}

    /* “测试结果”行内部的图片样式 */
.test-result-item img {
    width: 30px;           /* 固定图片宽度 */
    margin-right: 15px;  /* 在图片和文字之间留出间距 */
}


    /* ====================================================== */
    /* ==     新添加的、用于“数据传输页”页脚的样式     == */
    /* ====================================================== */

    /* 页脚容器的样式 */
.footer-bar {
    padding: 20px;       /* 为内部的按钮提供一些呼吸空间 */
    background-color: white; /* 确保它有背景色 */
    border-top: 1px solid #e0e0e0; /* 在顶部加一条分割线 */
}
    /* 需求 1: 优化主页 Logo 样式 */
#home-screen .logo {
    width: 70%;       /* 宽度占屏幕的 70% */
    max-width: 300px;   /* 最大宽度增加到 300px */
    height: auto;
}

    /* 需求 2, 3, 4: 让带有“返回按钮”的标题左对齐 */
.header.with-back-button h1 {
    text-align: left;
}

    /* 需求 5: 让没有“返回按钮”的特定页面标题也左对齐 */
#data-transfer-screen .header,
#update-complete-screen .header {
    justify-content: flex-start; /* 让内部所有元素都从左侧开始排列 */
}
#home-screen .header {
    background-color: #FFA500; /* <-- 在这里替换成您 Logo 的真实背景色！ */
    border-bottom: none;       /* 移除底部的分割线，实现无边界效果 */
    padding-top: 40px;         /* 增加顶部内边距，让 Logo 下移 */
    padding-bottom: 40px;      /* 增加底部内边距 */
}
   
#btn-update {
    background-color: #e4e6eb; /* 一个标准的灰色 */
    color: #bcc0c4;        /* 更浅的灰色文字 */
    cursor: not-allowed;     /* 显示“禁止”鼠标指针 */
    border: none;
    padding: 12px;
    border-radius: 8px;
    flex: 1; /* 确保它在 button-group 中能正常伸展 */
}

    /* 当 "Update" 按钮【不处于】:disabled 状态时，应用这些样式 */
#btn-update:not(:disabled) {
    background-color: #FFA500; /* 您期望的蓝色 */
    color: white;        /* 白色文字 */
    cursor: pointer;       /* 显示“手形”鼠标指针 */
}

.event-card {
    background-color: #f5f6f7;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 0 20px 15px 20px; /* 左右留出 20px 边距，下方留出 15px */
}

.event-card-header {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.event-card-body {
    font-size: 14px;
    color: #65676b;
}
.progress-text {
    font-size: 60px; /* 大号的百分比数字 */
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.progress-bar-container {
    width: 80%;
    max-width: 400px;
    height: 10px;
    background-color: #e0e0e0; /* 灰色的背景轨道 */
    border-radius: 5px;
    overflow: hidden; /* 隐藏溢出的部分，形成圆角效果 */
}

.progress-bar {
    width: 0%; /* 初始宽度为 0 */
    height: 100%;
    background-color: #FFA500; /* 蓝色的进度条 */
    border-radius: 5px;
    transition: width 0.2s ease-in-out; /* 让宽度的变化产生平滑的动画效果 */
}

.progress-details {
    margin-top: 10px;
    color: #65676b;
}

.log-box {
    font-family: monospace;
    white-space: pre-wrap; /* 自动换行 */
    background: #f5f6f7;
    padding: 10px;
    border-radius: 5px;
    margin-top: 30px;
    width: 80%;
    max-width: 400px;
    height: 100px; /* 给一个固定高度 */
    overflow-y: scroll; /* 内容过多时可以滚动 */
    font-size: 10px;
    border: 1px solid #e0e0e0;
}
#ymodem-status-log {
    display: none !important;
}
.version-dropdown {
    width: 100%; padding: 15px; font-size: 16px; border: 1px solid #ccc;
    border-radius: 8px; background-color: white; margin-bottom: 20px;
    appearance: auto; color: #333; outline: none; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}