/* ===== 赛博黄金主题 - MIFI/UFI助手 ===== */
:root {
    --gold-primary: #FFD700;
    --gold-secondary: #FFA500;
    --gold-dark: #B8860B;
    --gold-light: #FFE55C;
    --neon-gold: #FFD700;
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --bg-card-light: #1c1c1c;
    --border-gold: linear-gradient(135deg, #FFD700, #FFA500, #B8860B);
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-gold: #FFD700;
    --danger: #ff4444;
    --success: #00e676;
    --info: #29b6f6;
    --nav-height: 60px;
    --header-height: 48px;
    --statusbar-height: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-primary);
    overscroll-behavior: none;
}

/* ===== 加载页 ===== */
#loading-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out;
}

#loading-page.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    display: none;
}

.rainbow-loader {
    width: 120px;
    height: 120px;
    position: relative;
    margin-bottom: 50px;
}

.rainbow-loader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 400% 400%;
    animation: rainbowShift 2s linear infinite, rotateSquare 3s linear infinite;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.4), 0 0 100px rgba(255, 0, 0, 0.2);
}

.rainbow-loader::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border-radius: 12px;
    background: rgba(10, 10, 10, 0.85);
}

@keyframes rainbowShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes rotateSquare {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 20px;
    color: var(--gold-primary);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    letter-spacing: 3px;
    animation: pulse 1.5s ease-in-out infinite;
    margin-bottom: 12px;
}

.loading-sub {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.8;
    animation: pulse 2s ease-in-out infinite;
    max-width: 280px;
}

.loading-sub span {
    display: block;
    margin-bottom: 4px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== 主容器 ===== */
#app-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ===== 页面内容区 ===== */
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    padding-bottom: calc(var(--nav-height) + 16px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: relative;
    background: var(--bg-dark);
}

.page-content::-webkit-scrollbar {
    display: none;
}

/* ===== 页面进入/退出动画 ===== */
.page-enter {
    animation: pageEnter 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.page-content.exit-left {
    animation: exitLeft 0.18s ease-in forwards;
}

.page-content.exit-right {
    animation: exitRight 0.18s ease-in forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateX(0);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 左滑退出（当前页向左滑走） */
@keyframes exitLeft {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-40px); }
}

/* 右滑退出（当前页向右滑走） */
@keyframes exitRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

.page {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 卡片样式 ===== */
.card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-light));
    border: none;
    border-radius: 0;
    padding: 14px 0;
    margin-bottom: 8px;
    box-shadow: none;
}

.card:last-child {
    margin-bottom: 0;
}

.card-title {
    font-size: 14px;
    color: var(--gold-primary);
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.card-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--gold-primary), var(--gold-dark));
    border-radius: 2px;
}

/* ===== 信息行 ===== */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 14px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
    margin-left: 12px;
}

.info-value.gold {
    color: var(--gold-primary);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

/* ===== 连接状态标签 ===== */
.connect-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid rgba(0, 230, 118, 0.3);
    border-radius: 20px;
    color: var(--success);
    font-size: 12px;
}

.connect-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== 电池状态 ===== */
.battery-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.battery-big {
    width: 36px;
    height: 18px;
    border: 2px solid var(--gold-primary);
    border-radius: 4px;
    position: relative;
    padding: 2px;
}

.battery-big::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 8px;
    background: var(--gold-primary);
    border-radius: 0 2px 2px 0;
}

.battery-big-level {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary));
    border-radius: 2px;
    transition: width 0.5s;
}

/* ===== 按钮样式 ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,165,0,0.1));
    border: 1px solid rgba(255,215,0,0.4);
    color: var(--gold-primary);
}

.btn-primary:active {
    background: linear-gradient(135deg, rgba(255,215,0,0.3), rgba(255,165,0,0.2));
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
}

.btn-gold {
    background: linear-gradient(135deg, #B8860B, #FFD700, #FFA500);
    color: #000;
    font-weight: 600;
    border: none;
}

.btn-gold:active {
    transform: scale(0.97);
    filter: brightness(1.1);
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 12px;
    padding: 0 12px;
}

.btn-group .btn {
    flex: 1;
    min-width: 80px;
    max-width: 140px;
}

/* ===== 开关样式 ===== */
.switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
}

.switch {
    position: relative;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #333;
    border-radius: 28px;
    transition: 0.3s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .switch-slider {
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary));
}

.switch input:checked + .switch-slider::before {
    transform: translateX(22px);
}

/* ===== 输入框 ===== */
.input-field {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.input-field:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 10px rgba(255,215,0,0.1);
}

.input-field::placeholder {
    color: rgba(255,255,255,0.3);
}

select.input-field {
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(0,0,0,0.3);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23FFD700' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    color: var(--text-primary);
}

select.input-field option {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
    padding: 8px;
}


/* ===== 单选按钮组 ===== */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 0 12px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.radio-item input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,215,0,0.4);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
}

.radio-item input[type="radio"]:checked {
    border-color: var(--gold-primary);
}

.radio-item input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 9px;
    height: 9px;
    background: var(--gold-primary);
    border-radius: 50%;
}

/* ===== 多选框样式 ===== */
.radio-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,215,0,0.4);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.radio-item input[type="checkbox"]:checked {
    border-color: var(--gold-primary);
    background: var(--gold-primary);
}

.radio-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--nav-height);
    background: linear-gradient(180deg, rgba(20,20,20,0.95), rgba(10,10,10,0.98));
    border-top: 1px solid rgba(255,215,0,0.15);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    min-width: 0;
    flex: 1;
}

.nav-item.active {
    color: var(--gold-primary);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary), var(--gold-dark));
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item.active svg {
    filter: drop-shadow(0 0 5px rgba(255,215,0,0.5));
}

.nav-item span {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ===== 设备列表 ===== */
.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(255,215,0,0.08);
}

.device-info h4 {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.device-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.device-ip {
    font-size: 13px;
    color: var(--gold-primary);
    font-family: monospace;
}

/* ===== 功能按钮网格 ===== */
.func-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
    padding: 0 12px;
}

.func-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.func-btn {
    padding: 14px 8px;
    background: linear-gradient(135deg, rgba(255,215,0,0.08), rgba(255,165,0,0.05));
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.func-btn:active {
    background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,165,0,0.1));
    transform: scale(0.96);
    border-color: var(--gold-primary);
}

.func-btn-small {
    padding: 10px 6px;
    font-size: 12px;
}

/* ===== 芯片分类标题 ===== */
.chip-title {
    text-align: center;
    font-size: 14px;
    color: var(--gold-primary);
    margin: 16px 0 10px;
    position: relative;
}

.chip-title::before,
.chip-title::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.3));
}

.chip-title::before {
    left: 0;
}

.chip-title::after {
    right: 0;
    background: linear-gradient(90deg, rgba(255,215,0,0.3), transparent);
}

/* ===== Toast提示 ===== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    border: 1px solid rgba(255,215,0,0.3);
    color: var(--gold-primary);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    text-align: center;
    max-width: 80%;
}

.toast.show {
    opacity: 1;
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.75);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    background: linear-gradient(180deg, var(--bg-card), var(--bg-dark));
    border-radius: 20px;
    border: 1px solid rgba(255,215,0,0.2);
    padding: 24px;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.25s ease-out;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    opacity: 1;
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 16px;
    color: var(--gold-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

/* ===== 表格样式 ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(255,215,0,0.15);
}

.data-table th {
    background: rgba(255,215,0,0.08);
    color: var(--gold-primary);
    font-weight: 500;
}

.data-table td {
    color: var(--text-secondary);
}

/* ===== 运行时间显示 ===== */
.runtime-display {
    font-family: 'Courier New', monospace;
    color: var(--gold-primary);
    font-size: 15px;
    letter-spacing: 1px;
}

/* ===== 流量显示 ===== */
.traffic-display {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== 实时网速 ===== */
.speed-display {
    display: flex;
    justify-content: space-around;
    padding: 16px 12px;
}

.speed-item {
    text-align: center;
}

.speed-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--gold-primary);
    font-family: monospace;
}

.speed-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== 滑动提示 ===== */
.swipe-hint {
    position: fixed;
    bottom: calc(var(--nav-height) + 10px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 50;
    transition: opacity 1s ease;
    white-space: nowrap;
}

/* ===== 频段信息表 ===== */
.band-info-table {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.band-info-table.open {
    max-height: 500px;
}

/* ===== 关于页面 ===== */
.about-logo {
    width: 80px;
    height: 80px;
    margin: 20px auto;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: #000;
    box-shadow: 0 0 30px rgba(255,215,0,0.2);
}

.about-info {
    text-align: center;
    margin-bottom: 30px;
}

.about-info h2 {
    font-size: 20px;
    color: var(--gold-primary);
    margin-bottom: 8px;
}

.about-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== 全面屏适配 ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    /* 内容区顶部适配刘海屏 */
    .page-content {
        padding-top: env(safe-area-inset-top, 0px);
    }

    /* 底部导航栏适配 home indicator */
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    }

    /* 内容区底部留出导航栏+home indicator空间 */
    .page-content {
        padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px);
    }

    /* 模态框底部安全距离 */
    .modal-content {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    /* 加载页适配 */
    #loading-page {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* 滑动提示适配 */
    .swipe-hint {
        bottom: calc(var(--nav-height) + 10px + env(safe-area-inset-bottom));
    }
}

/* ===== 响应式 ===== */
@media (max-width: 360px) {
    .func-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-value {
        font-size: 13px;
    }

    .radio-group {
        gap: 10px;
    }
}

@media (min-width: 420px) {
    /* 全宽布局：内容区、导航栏均铺满屏幕 */
}

/* ===== 滚动条美化（桌面调试用） ===== */
.page-content::-webkit-scrollbar {
    width: 3px;
}

.page-content::-webkit-scrollbar-track {
    background: transparent;
}

.page-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 3px;
}
