/* ============================================
   内部导航工作台 后台管理样式
   PC + 移动端响应式
   ============================================ */

:root {
    --primary: #4A90D9;
    --primary-dark: #357ABD;
    --primary-light: #E8F2FC;
    --success: #52C41A;
    --warning: #FAAD14;
    --danger: #FF4D4F;
    --text-main: #333;
    --text-secondary: #666;
    --text-hint: #999;
    --bg-page: #F0F2F7;
    --bg-card: #FFF;
    --border: #EBEBEB;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--text-main);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}

input, textarea, button, select { font-family: inherit; font-size: inherit; border: none; outline: none; }
a { text-decoration: none; color: inherit; }

/* ==================== Toast ==================== */
#toast-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    pointer-events: none;
}
.toast {
    background: rgba(0,0,0,0.78);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 300px;
    text-align: center;
    line-height: 1.5;
    animation: toastIn 0.3s ease;
    word-break: break-all;
}
@keyframes toastIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

/* ==================== 管理员登录页 ==================== */
.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(160deg, #4A90D9 0%, #357ABD 55%, #2B6499 100%);
}
.admin-login-box {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 16px;
    padding: 30px 26px 22px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.login-icon {
    width: 58px; height: 58px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-icon svg { width: 30px; height: 30px; }
.admin-login-box h1 { font-size: 18px; text-align: center; }
.admin-login-box .subtitle {
    text-align: center;
    color: var(--text-hint);
    font-size: 13px;
    margin: 6px 0 20px;
}
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.req { color: var(--danger); }
.form-input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
    background: #FAFBFC;
    transition: border-color .2s;
}
.form-input:focus { border-color: var(--primary); background: #fff; }
.form-textarea {
    width: 100%;
    min-height: 90px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #FAFBFC;
    resize: vertical;
    line-height: 1.6;
}
.form-textarea:focus { border-color: var(--primary); background: #fff; }
.code-group { display: flex; gap: 10px; }
.code-group .form-input { flex: 1; }
.btn-send-code {
    flex-shrink: 0;
    width: 108px;
    height: 42px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 13px;
    cursor: pointer;
}
.btn-send-code:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 4px;
}
.btn-primary:disabled { opacity: .6; }
.back-link { text-align: center; margin-top: 16px; font-size: 13px; }
.back-link a { color: var(--text-hint); }
.back-link a:hover { color: var(--primary); }

/* ==================== 后台布局 ==================== */
.admin-topbar {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(74,144,217,.25);
}
.admin-topbar .logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 600;
}
.admin-topbar .logo svg { width: 20px; height: 20px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.super-tag {
    font-style: normal;
    font-size: 11px;
    background: #FFD591;
    color: #874D00;
    border-radius: 6px;
    padding: 1px 6px;
    margin-right: 4px;
}
.btn-front {
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.2);
    color: #fff;
}
.btn-logout {
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
}

.admin-body { max-width: 1080px; margin: 0 auto; padding: 16px 14px 40px; }

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.admin-tab {
    padding: 9px 20px;
    border-radius: 10px;
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    box-shadow: var(--shadow);
    user-select: none;
}
.admin-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 500;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.btn-add {
    padding: 9px 18px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(74,144,217,.3);
}
.btn-add:active { opacity: .85; }
.toolbar-hint { font-size: 12px; color: var(--text-hint); }

/* ==================== 表格 ==================== */
.table-wrap {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th {
    text-align: left;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-hint);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: #FAFBFC;
}
.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #F2F3F7;
    font-size: 13px;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFCFF; }

.td-icon .menu-icon-cell {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: #F1F6FC;
    border: 1px solid #E3EDF8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 20px;
}
.td-icon img { width: 24px; height: 24px; object-fit: contain; border-radius: 4px; }

.td-title b { font-size: 14px; }
.td-sub { font-size: 12px; color: var(--text-hint); margin-top: 2px; }

.tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #F2F3F7;
    color: var(--text-secondary);
    margin: 2px 3px 2px 0;
    white-space: nowrap;
}
.tag-type { background: var(--primary-light); color: var(--primary-dark); }
.tag-super { background: #FFF1E0; color: #D46B08; }
.tag-admin { background: var(--primary-light); color: var(--primary-dark); }
.tag-staff { background: #F0F9EB; color: #389E0D; }
.tag-on { background: #F0F9EB; color: #389E0D; }
.tag-off { background: #FFF1F0; color: #CF1322; }
.tag-act { background: #FFF7E6; color: #D46B08; }

.op-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.op-btn {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    white-space: nowrap;
}
.op-btn:hover { border-color: var(--primary); color: var(--primary); }
.op-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.op-btn.primary { background: var(--primary-light); border-color: transparent; color: var(--primary-dark); }

/* ==================== 移动端卡片列表 ==================== */
.mobile-list { display: none; }
.m-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 13px 14px;
    margin-bottom: 10px;
}
.m-card-head { display: flex; align-items: center; gap: 10px; }
.m-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: #F1F6FC;
    border: 1px solid #E3EDF8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    flex-shrink: 0;
    overflow: hidden;
}
.m-icon img { width: 26px; height: 26px; object-fit: contain; }
.m-title { font-size: 15px; font-weight: 600; }
.m-sub { font-size: 12px; color: var(--text-hint); margin-top: 2px; }
.m-badges { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.m-fields { margin-top: 10px; font-size: 12px; color: var(--text-secondary); line-height: 1.9; }
.m-fields b { color: var(--text-hint); font-weight: 400; margin-right: 4px; }
.m-ops { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.m-ops .op-btn { flex: 1; text-align: center; padding: 7px 0; }

/* ==================== 分组卡片 ==================== */
.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.group-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.group-card-head { display: flex; align-items: center; gap: 8px; }
.group-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.group-name { font-size: 15px; font-weight: 600; word-break: break-all; }
.group-stats { font-size: 12px; color: var(--text-hint); }
.group-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.group-ops .op-btn { flex: 1; text-align: center; padding: 7px 0; }

/* ==================== 弹窗 ==================== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    animation: fadeIn .2s ease;
}
.modal-mask.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-dialog {
    width: 100%;
    max-width: 420px;
    max-height: 92vh;
    background: #fff;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    animation: popIn .22s ease;
    overflow: hidden;
}
.modal-lg { max-width: 480px; }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { font-size: 15px; color: var(--text-hint); cursor: pointer; padding: 4px 6px; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-footer {
    display: flex;
    gap: 10px;
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    justify-content: flex-end;
}
.btn-ghost {
    padding: 9px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
}
.btn-primary-sm {
    padding: 9px 24px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.form-row { display: flex; gap: 12px; }
.form-group.half { flex: 1; }

/* 分段选择器 */
.seg-group {
    display: flex;
    gap: 0;
    background: #F2F3F7;
    border-radius: 10px;
    padding: 3px;
    flex-wrap: wrap;
}
.seg-item {
    flex: 1;
    min-width: 72px;
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.seg-item.active {
    background: #fff;
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.field-hint { font-size: 12px; color: var(--text-hint); margin-top: 6px; line-height: 1.6; }

/* emoji 选择 */
.emoji-pick-row { display: flex; gap: 10px; }
.emoji-input { flex: 1; text-align: center; font-size: 18px; }
.emoji-panel {
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    margin-top: 10px;
    background: #F7F9FB;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    max-height: 180px;
    overflow-y: auto;
}
.emoji-panel.show { display: grid; }
.emoji-cell {
    font-size: 20px;
    text-align: center;
    padding: 5px 0;
    border-radius: 6px;
    cursor: pointer;
}
.emoji-cell:hover, .emoji-cell:active { background: #E8F2FC; }

/* 图标上传 */
.icon-upload-row { display: flex; align-items: center; gap: 12px; }
.icon-upload-box {
    width: 74px; height: 74px;
    border: 1.5px dashed #C4D3E8;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #F7FAFD;
    color: var(--text-hint);
    font-size: 12px;
    text-align: center;
    line-height: 1.5;
    flex-shrink: 0;
}
.icon-preview {
    width: 52px; height: 52px;
    object-fit: contain;
    border-radius: 8px;
    background: #F5F8FC;
    border: 1px solid var(--border);
    padding: 4px;
}

/* 分组/菜单复选列表 */
.group-check-list, .menu-check-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

/* ==================== Banner 管理 ==================== */
.banner-interval-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}
.interval-input {
    width: 72px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
    margin: 0 6px;
    background: #FAFBFC;
}
.banner-group { margin-bottom: 18px; }
.banner-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.banner-group-title::before {
    content: '';
    width: 3px; height: 13px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
}
.banner-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.banner-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.banner-thumb {
    width: 100%;
    aspect-ratio: 16 / 7;
    object-fit: cover;
    background: #F1F3F7;
    display: block;
}
.banner-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
}
.banner-meta { font-size: 12px; color: var(--text-secondary); word-break: break-all; line-height: 1.6; }
.banner-meta b { color: var(--text-hint); font-weight: 400; margin-right: 4px; }
.banner-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.banner-ops .op-btn { flex: 1; text-align: center; }

/* ==================== 分享设置 ==================== */
.share-form {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    max-width: 560px;
}
.share-desc { min-height: 64px; }
.share-save-btn {
    width: 100%;
    margin-top: 4px;
    border: none;
    cursor: pointer;
}
.share-link-box {
    margin-top: 16px;
    background: #F7F9FB;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}
.share-link-row {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}
.share-link-row .form-input { flex: 1; font-size: 12px; color: var(--text-secondary); }

/* 分组/菜单复选列表 */
.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: #F7F9FB;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}
.check-item:active { background: #EDF4FC; }
.check-item .ci-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #E3EDF8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}
.check-item img { width: 20px; height: 20px; object-fit: contain; }
.check-item input[type="checkbox"] {
    width: 17px; height: 17px;
    accent-color: var(--primary);
    margin-left: auto;
    flex-shrink: 0;
}
.check-empty { font-size: 13px; color: var(--text-hint); text-align: center; padding: 20px 0; }

/* 空状态 */
.list-empty { text-align: center; padding: 50px 0; color: var(--text-hint); font-size: 13px; }
.list-empty .empty-emoji { font-size: 40px; margin-bottom: 10px; }

/* ==================== 移动端适配 ==================== */
@media (max-width: 768px) {
    .table-wrap { display: none; }
    .mobile-list { display: block; }
    .admin-body { padding: 12px 10px 40px; }
    .admin-topbar { padding: 0 12px; }
    .admin-topbar .logo { font-size: 14px; }
    .form-row { flex-direction: column; gap: 0; }
    .emoji-panel { grid-template-columns: repeat(6, 1fr); }
}
@media (min-width: 769px) {
    .mobile-list { display: none; }
}
