/* ========== CSS 变量 ========== */
:root {
    --neon-blue: #0ff0fc;
    --neon-purple: #bc13fe;
    --primary-blue: #1890ff;
}

/* ========== Reset & Base ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { width: 100%; overflow-y: auto; overflow-x: hidden; }
body {
    font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
    background: linear-gradient(135deg, #e0f7ff 0%, #f0e6ff 100%);
    color: #333; min-height: 100vh; display: flex; flex-direction: column;
    width: 100%;
    position: relative;
    overflow-x: hidden;  /* 锁定整页不允许横向滚动 */
}

/* 绚丽旋转背景效果 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 30%, rgba(15, 240, 252, 0.15) 0%, transparent 30%),
        radial-gradient(circle at 80% 70%, rgba(188, 19, 254, 0.15) 0%, transparent 30%),
        radial-gradient(circle at 40% 80%, rgba(255, 44, 237, 0.15) 0%, transparent 30%);
    animation: rotate 30s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== 桌面端主内容缩放（模拟150%放大） ========== */
.main-wrap {
    flex: 1; display: flex; flex-direction: column;
    width: 100%; max-width: 100vw;
}
@media (min-width: 769px) {
    .main-wrap {
        zoom: 1.35;
        min-height: 74vh;
    }
    body { justify-content: center; }
}

/* ========== 顶部导航（悬浮磨砂） ========== */
.topbar {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    height: 56px; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: sticky; top: 0; z-index: 100;
    width: 100%; flex-shrink: 0;
}
.topbar h1 { font-size: 17px; font-weight: 700; color: #1a1a1a; letter-spacing: .5px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* 登录按钮 */
.btn-login {
    background: #4a6cf7; color: #fff; border: none;
    padding: 7px 20px; border-radius: 6px; font-size: 13px; cursor: pointer;
    transition: background .2s;
}
.btn-login:hover { background: #3a5ce5; }

/* 用户区域 */
.user-area { display: flex; align-items: center; gap: 8px; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
    border: 2px solid #e8e8e8; transition: border-color .2s;
}
.user-avatar:hover { border-color: #4a6cf7; }
.user-name { font-size: 13px; color: #333; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge {
    font-size: 10px; padding: 2px 6px; border-radius: 8px;
    font-weight: 600; letter-spacing: .3px;
}
.role-badge.admin { background: #fff3e0; color: #e65100; }
.role-badge.user { background: #e3f2fd; color: #1565c0; }

/* 管理员操作按钮（顶栏右侧） */
.admin-btns { display: flex; align-items: center; gap: 6px; margin-left: 6px; }
.admin-btns .btn { font-size: 12px; padding: 4px 10px; white-space: nowrap; }
.admin-sep { width: 1px; height: 20px; background: #e0e0e0; margin: 0 4px; }

/* ========== 遮罩 ========== */
.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 999; opacity: 0; visibility: hidden;
    transition: opacity .2s, visibility .2s; backdrop-filter: blur(2px);
}
.overlay.show { opacity: 1; visibility: visible; }

/* ========== 统一弹窗 ========== */
.modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.95);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 14px; z-index: 1001;
    opacity: 0; visibility: hidden; transition: all .25s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
    display: flex; flex-direction: column;
}
.modal.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-sm { width: 420px; max-width: 92vw; }
.modal-md { width: 540px; max-width: 94vw; }
.modal-lg { width: 700px; max-width: 96vw; }
@media (min-width: 769px) {
    .modal {
        /* zoom=1.35 下，vh 需除以 zoom 才能正确约束实际渲染高度 */
        --zh: calc(1vh / 1.35);
        max-height: calc(85 * var(--zh));
    }
    .modal-body { overflow-y: auto; }
}
.modal-body.scroll { max-height: calc(85 * var(--zh, 1vh) - 120px); overflow-y: auto; }
.modal-header {
    padding: 18px 22px; border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.modal-close {
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: #f5f5f5; cursor: pointer; font-size: 16px; color: #999;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.modal-close:hover { background: #eee; color: #333; }
.modal-body { padding: 20px 22px; flex: 1; min-height: 0; }
.modal-body.scroll { max-height: calc(80vh - 60px); overflow-y: auto; }
.modal-footer {
    padding: 14px 22px; border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex; gap: 10px; justify-content: flex-end;
}

/* ========== 表单 ========== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; margin-bottom: 5px; color: #888; font-weight: 500; }
.form-input {
    width: 100%; border: 1px solid #e0e0e0; padding: 8px 12px; border-radius: 6px;
    font-size: 13px; font-family: inherit; transition: border-color .2s;
}
.form-input:focus { border-color: #4a6cf7; outline: none; box-shadow: 0 0 0 3px rgba(74,108,247,.08); }
.form-input:disabled { background: #f8f8f8; color: #999; }
.form-input.input-error { border-color: #e74c3c; box-shadow: 0 0 0 3px rgba(231,76,60,.1); }
.form-input.input-error:focus { border-color: #e74c3c; box-shadow: 0 0 0 3px rgba(231,76,60,.15); }
textarea.form-input { resize: vertical; min-height: 72px; }
select.form-input { cursor: pointer; }
.form-hint { font-size: 11px; color: #999; margin-top: 3px; }

/* ========== 按钮 ========== */
.btn {
    padding: 7px 16px; border: 1px solid #e0e0e0; border-radius: 6px;
    background: #fff; cursor: pointer; font-size: 13px; color: #333;
    transition: all .15s; white-space: nowrap; font-family: inherit;
}
.btn:hover { border-color: #4a6cf7; color: #4a6cf7; }
.btn-primary { background: #4a6cf7; color: #fff; border-color: #4a6cf7; }
.btn-primary:hover { background: #3a5ce5; }
.btn-danger { color: #e74c3c; border-color: #e74c3c; }
.btn-danger:hover { background: #e74c3c; color: #fff; }
.btn-success { background: #27ae60; color: #fff; border-color: #27ae60; }
.btn-success:hover { background: #219a52; }
.btn-ghost { border: none; background: none; color: #666; padding: 4px 8px; }
.btn-ghost:hover { color: #4a6cf7; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* ========== 主数据表格容器 ========== */
.table-container {
    max-width: 1100px; margin: 24px auto; padding: 0 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: thin;
}
.table-container::-webkit-scrollbar { height: 4px; }

/* 手机端：让 table-container 突破祖先 overflow-x:hidden 的裁剪边界，独立横向滚动 */
@media (max-width: 768px) {
    .table-container {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        padding: 0 12px;
        box-sizing: border-box;
    }
}
.data-table {
    width: 100%; border-collapse: collapse;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    min-width: 700px;
}
.data-table thead { background: rgba(255, 255, 255, 0.5); }
.data-table th {
    text-align: left; padding: 12px 14px; font-size: 12px; font-weight: 600;
    color: #888; border-bottom: 1px solid #f0f0f0; white-space: nowrap;
}
.data-table td {
    padding: 12px 14px; border-bottom: 1px solid #f8f8f8; font-size: 13px;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(74, 108, 247, 0.06); }

/* 验证码单元格 */
.code-cell { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.code-value {
    font-family: "Courier New", monospace; font-size: 18px; font-weight: 700;
    letter-spacing: 2px; color: #1a1a1a; cursor: pointer;
    padding: 2px 4px; border-radius: 4px; transition: background .15s;
}
.code-value:hover { background: #f0f2ff; }
.code-value.copied { color: #27ae60; }
.code-expired { font-size: 12px; color: #e74c3c; font-weight: 400; }
.no-code { font-size: 12px; color: #bbb; }

/* 进度条 */
.progress-bar {
    width: 80px; height: 5px; background: #f0f0f0; border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle;
}
.progress-fill {
    height: 100%; border-radius: 3px; transition: width 1s linear;
    background: linear-gradient(90deg, #4a6cf7, #6d8cff);
}
.progress-fill.warn { background: linear-gradient(90deg, #e74c3c, #ff6b6b); }
.time-label { font-size: 11px; color: #999; margin-left: 4px; vertical-align: middle; }
.time-label.warn { color: #e74c3c; font-weight: 500; }

/* 密码单元格 */
.pwd-cell { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.pwd-value {
    font-size: 13px; color: #666; cursor: pointer; padding: 2px 4px;
    border-radius: 4px; transition: all .15s;
}
.pwd-value:hover { color: #4a6cf7; }
.pwd-value.showing { color: #27ae60; font-weight: 600; }
.pwd-timer { font-size: 11px; color: #999; }
.pwd-timer.warn { color: #e74c3c; }

/* 无权限 */
.no-perm { display: flex; align-items: center; gap: 6px; }
.no-perm-text { font-size: 12px; color: #bbb; }
.btn-apply {
    padding: 3px 8px; font-size: 11px; border-radius: 4px;
    background: #ff9800; color: #fff; border: none; cursor: pointer;
    transition: background .15s;
}
.btn-apply:hover { background: #f57c00; }

/* 操作列 */
.action-cell { display: flex; gap: 4px; align-items: center; }

/* ========== 管理面板内表格 ========== */
.panel-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.panel-table th {
    text-align: left; padding: 8px 10px; border-bottom: 1px solid #f0f0f0;
    color: #888; font-weight: 600; font-size: 12px;
}
.panel-table td { padding: 8px 10px; border-bottom: 1px solid #fafafa; vertical-align: middle; }
.panel-table tr:last-child td { border-bottom: none; }
.panel-input {
    border: 1px solid #e8e8e8; padding: 5px 8px; border-radius: 4px;
    font-size: 12px; width: 100%; transition: border-color .2s; font-family: inherit;
}
.panel-input:focus { border-color: #4a6cf7; outline: none; box-shadow: 0 0 0 2px rgba(74,108,247,.08); }
.panel-select {
    border: 1px solid #e8e8e8; padding: 4px 8px; border-radius: 4px; font-size: 12px;
    font-family: inherit; cursor: pointer;
}

/* 状态标签 */
.status { font-size: 12px; font-weight: 500; }
.status-pending { color: #e65100; }
.status-approved { color: #2e7d32; }
.status-rejected { color: #c62828; }

/* 添加店铺行 */
.add-row { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.add-row .panel-input { flex: 1; min-width: 80px; }

/* ========== Toast通知 ========== */
.toast-container {
    position: fixed; top: 70px; right: 20px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 18px; border-radius: 8px; font-size: 13px; color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    animation: toastIn .3s ease;
    max-width: 340px;
}
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }
.toast.info { background: #4a6cf7; }
.toast.fadeout { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(40px); } }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 40px 20px; color: #bbb; }
.empty-state p { font-size: 14px; }

/* ========== 底部 Footer（磨砂） ========== */
.footer {
    text-align: center; padding: 24px 16px; font-size: 12px; color: #999;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    margin-top: auto; flex-shrink: 0; width: 100%;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .topbar-title { display: none; }
    .topbar { padding: 0 12px; height: 50px; }
    .topbar h1 { font-size: 14px; }
    .table-container { margin: 12px auto; padding: 0 8px; }
    .user-name { display: none; }
    .role-badge { display: none; }
    .admin-btns .btn { font-size: 11px; padding: 3px 6px; }
    .admin-btns { gap: 3px; }
    .admin-sep { margin: 0 2px; }
    .data-table th, .data-table td { padding: 8px 8px; font-size: 12px; }
    .code-value { font-size: 15px; }
    .btn-sm { padding: 4px 8px; font-size: 11px; }
    .progress-bar { width: 50px; }
    .modal { border-radius: 10px; }
    .modal-header { padding: 14px 16px; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 10px 16px; }
    .toast-container { top: 60px; right: 10px; }
    .toast { font-size: 12px; padding: 10px 14px; max-width: 260px; }
}

/* ========== 粒子效果 ========== */
.particle {
    position: fixed;
    border-radius: 50%;
    opacity: 0.3;
    animation: floatUp 15s infinite linear;
    pointer-events: none;
    z-index: 0;
}

@keyframes floatUp {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    50% { opacity: 0.5; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 480px) {
    .topbar h1 { font-size: 13px; }
    .user-area { gap: 4px; }
    .user-avatar { width: 28px; height: 28px; }
    .admin-btns { flex-wrap: wrap; gap: 2px; }
    .admin-btns .btn { font-size: 10px; padding: 2px 5px; }
    .btn-login { padding: 5px 12px; font-size: 12px; }
    .table-container { margin: 8px auto; padding: 0 4px; }
    .data-table th, .data-table td { padding: 6px 6px; font-size: 11px; }
    .code-value { font-size: 14px; letter-spacing: 1px; }
    .modal-sm { width: 95vw; }
    .modal-md { width: 95vw; }
    .modal-lg { width: 96vw; }
}
