/* ===== 管理后台侧边栏折叠菜单 / 门户编辑器（admin.css） ===== */

/* 侧边栏分组容器 */
.admin-sidebar-group {
    border-bottom: 1px solid #e8eaef;
}
.admin-sidebar-group:last-child { border-bottom: none; }

.admin-sidebar-group-title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    font-size: 12px; font-weight: 700; color: #6b7280;
    letter-spacing: .04em;
    cursor: pointer; user-select: none;
    background: #fafbfc;
    transition: background .15s;
}
.admin-sidebar-group-title:hover { background: #f3f4f6; }
.admin-sidebar-group-title .icon {
    width: 18px; height: 18px; flex-shrink: 0; margin-right: 8px;
    display: inline-flex; align-items: center; justify-content: center;
}
.admin-sidebar-group-title .caret {
    font-size: 10px; color: #9ca3af;
    transition: transform .2s;
}
.admin-sidebar-group.collapsed .caret { transform: rotate(-90deg); }

.admin-sidebar-group-items {
    overflow: hidden; max-height: 2000px;
    transition: max-height .25s ease;
}
.admin-sidebar-group.collapsed .admin-sidebar-group-items {
    max-height: 0;
}

/* 侧边栏菜单项保持原来 .menu-item 样式，仅自定义分隔 */
.admin-sidebar-group + .menu-item { border-top: 0; }

/* ===== 门户内容编辑器（admin_homepage.html） ===== */
.homepage-builder { display: flex; gap: 20px; min-height: calc(100vh - 140px); }
.homepage-builder .nav-rail {
    flex: 0 0 240px; background: #fff; border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 16px 8px;
    align-self: flex-start;
    position: sticky; top: 86px;
}
.homepage-builder .nav-rail .nav-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: 8px; cursor: pointer;
    font-size: 14px; color: #4b5563; font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.homepage-builder .nav-rail .nav-item:hover { background: #f3f4f6; color: #4f46e5; }
.homepage-builder .nav-rail .nav-item.active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.2);
}
.homepage-builder .nav-rail .nav-item .nav-icon {
    width: 18px; height: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
}

.homepage-builder .editor-pane {
    flex: 1; background: #fff; border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 24px 28px;
}
.homepage-builder .editor-pane .pane-header {
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #e5e7eb; padding-bottom: 16px; margin-bottom: 24px;
}
.homepage-builder .editor-pane .pane-title { font-size: 18px; font-weight: 700; color: #111827; }
.homepage-builder .editor-pane .pane-sub { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* 表单 */
.hp-form-row { margin-bottom: 18px; }
.hp-form-row label {
    display: block; font-size: 13px; font-weight: 600; color: #374151;
    margin-bottom: 6px;
}
.hp-form-row label .required { color: #ef4444; }
.hp-form-row label .hint { color: #9ca3af; font-weight: 400; margin-left: 6px; font-size: 12px; }
.hp-form-row input[type="text"],
.hp-form-row input[type="number"],
.hp-form-row textarea,
.hp-form-row select {
    width: 100%; padding: 9px 12px; border: 1px solid #d1d5db;
    border-radius: 8px; font-size: 14px; color: #111827;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
.hp-form-row textarea { min-height: 120px; line-height: 1.7; resize: vertical; }
.hp-form-row input:focus, .hp-form-row textarea:focus, .hp-form-row select:focus {
    outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

/* 按钮 */
.hp-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; border: none; transition: opacity .15s, transform .1s;
}
.hp-btn-primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; }
.hp-btn-primary:hover:not(:disabled) { opacity: .92; }
.hp-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.hp-btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.hp-btn-secondary:hover { background: #e5e7eb; }
.hp-btn-danger { background: #fee2e2; color: #b91c1c; }
.hp-btn-danger:hover { background: #fecaca; }

/* 列表编辑器（特色项 / 校园图片 / 新闻 / 公告）*/
.hp-list { display: flex; flex-direction: column; gap: 12px; }
.hp-list .item {
    border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 14px 16px; background: #fafbfc;
    position: relative;
}
.hp-list .item .item-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.hp-list .item .item-head .title { font-weight: 600; color: #111827; font-size: 14px; }
.hp-list .item .item-head .remove {
    background: #fee2e2; color: #b91c1c; border: none;
    padding: 4px 10px; font-size: 12px; border-radius: 6px; cursor: pointer;
}
.hp-list .item .item-head .remove:hover { background: #fecaca; }
.hp-list .add-btn {
    align-self: flex-start; background: #eef2ff; color: #4f46e5;
    border: 1px dashed #818cf8; padding: 8px 16px; border-radius: 8px;
    cursor: pointer; font-size: 13px; font-weight: 600;
}
.hp-list .add-btn:hover { background: #e0e7ff; }

/* 图片上传 */
.hp-image-uploader {
    display: flex; flex-direction: column; gap: 8px;
}
.hp-image-uploader .preview {
    width: 100%; max-width: 320px; aspect-ratio: 16/9;
    background-color: #f3f4f6;     /* 关键修复：用 background-color 不要 background 简写，
                                     否则会清掉行内 style="background-image:url(...)"。 */
    background-position: center;
    background-size: cover;        /* 注意：background-size 必须单独声明，因为它依赖 background-image 才会生效 */
    background-repeat: no-repeat;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af; font-size: 13px;
    overflow: hidden;
}
.hp-image-uploader .preview.has-cover {
    /* 当预览框有封面图时（行内 style 会带 background-image），不需要显示占位文字 */
    color: transparent;
}
.hp-image-uploader .preview img { width: 100%; height: 100%; object-fit: cover; }
.hp-image-uploader .controls { display: flex; gap: 8px; }

/* Toast */
.hp-toast {
    position: fixed; top: 88px; right: 24px; z-index: 9999;
    padding: 10px 16px; border-radius: 8px; font-size: 14px;
    background: #10b981; color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,.2);
    animation: hpToast .25s ease-out;
}
.hp-toast.error { background: #ef4444; box-shadow: 0 4px 12px rgba(239,68,68,.2); }
@keyframes hpToast {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 顶部工具栏 */
.homepage-toolbar {
    background: #fff; padding: 12px 24px; border-radius: 8px;
    margin-bottom: 16px; display: flex; justify-content: space-between;
    align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.homepage-toolbar .left { font-size: 14px; color: #4b5563; }
.homepage-toolbar .left strong { color: #111827; }
.homepage-toolbar .actions { display: flex; gap: 8px; }

/* 响应式 */
@media (max-width: 900px) {
    .homepage-builder { flex-direction: column; }
    .homepage-builder .nav-rail {
        flex: none; width: 100%; position: static;
        display: flex; gap: 4px; overflow-x: auto; padding: 8px;
    }
    .homepage-builder .nav-rail .nav-item {
        white-space: nowrap; padding: 8px 12px; margin-bottom: 0;
    }
}

/* ===== V6.0 跨平台配置卡片（小程序/支付、短信、推送、登录安全） ===== */
.v6-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 18px 20px; margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.v6-card-head {
    font-size: 15px; font-weight: 700; color: #111827;
    margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #f0f2f5;
}
.v6-hint { font-size: 12px; color: #9ca3af; margin-top: 4px; line-height: 1.5; }
.v6-card-note {
    font-size: 12px; color: #6b7280; background: #f9fafb;
    border-left: 3px solid #cbd5e1; border-radius: 0 6px 6px 0;
    padding: 8px 12px; margin: 0 0 14px; line-height: 1.6;
}
.v6-notes {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 12px 16px; margin-bottom: 16px;
}
.v6-notes code {
    background: #eef2f7; border-radius: 3px; padding: 1px 5px;
    font-size: 11px; color: #334155; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.v6-err { font-size: 12px; color: #e53e3e; margin-top: 4px; min-height: 16px; }
.v6-set {
    font-size: 11px; color: #16a34a; background: #f0fdf4;
    border: 1px solid #bbf7d0; border-radius: 4px; padding: 1px 6px; margin-left: 6px;
    vertical-align: middle;
}
.v6-secret-wrap { display: flex; align-items: center; gap: 6px; }
.v6-secret-wrap .form-control { flex: 1; }
.v6-eye, .v6-clear {
    flex-shrink: 0; padding: 6px 10px; font-size: 12px; border: 1px solid #d1d5db;
    border-radius: 6px; background: #f9fafb; color: #374151; cursor: pointer; white-space: nowrap;
}
.v6-eye:hover, .v6-clear:hover { background: #f3f4f6; }
.v6-clear { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.v6-clear:hover { background: #fee2e2; }

/* 表单行在小屏下自动堆叠 */
@media (max-width: 640px) {
    .v6-card .form-row { flex-direction: column; }
    .v6-card .form-row .form-group { margin-right: 0; }
}

/* ===== 通用图片上传组件（本地上传 / 图床链接 双模式） ===== */
.iu-root {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    background: #fafbfc;
}
.iu-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.iu-preview:hover { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.iu-preview .iu-img {
    position: absolute; inset: 0;
    background-position: center; background-size: cover; background-repeat: no-repeat;
}
.iu-preview .iu-ph { color: #9ca3af; font-size: 13px; pointer-events: none; padding: 0 12px; text-align: center; }
.iu-preview.has-img .iu-ph { display: none; }
/* 方形预览（学校 Logo 等 1:1 图）：覆盖默认 16:9 宽屏，避免预览框异常巨大 */
.iu-preview.iu-preview-square {
    aspect-ratio: 1 / 1;
    width: 200px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}
.iu-tabs { display: flex; gap: 6px; margin: 10px 0 8px; }
.iu-tab {
    flex: 1;
    padding: 7px 10px;
    font-size: 13px; font-weight: 600;
    border: 1px solid #d1d5db; border-radius: 8px;
    background: #fff; color: #6b7280; cursor: pointer;
    transition: all .15s;
}
.iu-tab.active { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.iu-panel { margin-bottom: 8px; }
.iu-drop {
    border: 1px dashed #c7d2fe;
    border-radius: 8px;
    background: #eef2ff;
    padding: 14px;
    text-align: center;
    transition: background .15s, border-color .15s;
}
.iu-drop.over { background: #e0e7ff; border-color: #4f46e5; }
.iu-pick {
    display: inline-block;
    padding: 8px 16px;
    background: #4f46e5; color: #fff;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.iu-pick:hover { background: #4338ca; }
.iu-tip { margin-top: 6px; font-size: 12px; color: #9ca3af; }
.iu-url-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.iu-url {
    width: 100%; padding: 9px 12px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; font-family: inherit; box-sizing: border-box;
}
.iu-url:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.iu-preview-btn {
    padding: 0 16px;
    background: #4f46e5; color: #fff;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.iu-preview-btn:hover { background: #4338ca; }
.iu-confirm {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-top: 8px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 8px 12px;
}
.iu-confirm[hidden] { display: none; }
.iu-confirm-hint { flex: 1; font-size: 12px; color: #065f46; min-width: 120px; }
.iu-ok {
    padding: 5px 14px;
    background: #16a34a; color: #fff;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.iu-ok:hover { background: #15803d; }
.iu-cancel {
    padding: 5px 14px;
    background: #fff; color: #6b7280;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; cursor: pointer;
    transition: all .15s;
}
.iu-cancel:hover { background: #f3f4f6; }
/* 预览中角标：表示当前展示的是「待确认」的候选图 */
.iu-previewing::after {
    content: '预览中';
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(79, 70, 229, .9);
    color: #fff;
    font-size: 11px; font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    z-index: 2;
}
.iu-actions { display: flex; align-items: center; gap: 10px; }
.iu-clear {
    padding: 6px 14px;
    background: #fff; border: 1px solid #fca5a5; color: #ef4444;
    border-radius: 8px; font-size: 13px; cursor: pointer;
}
.iu-clear:hover { background: #fee2e2; }
.iu-msg { font-size: 12px; }
.iu-msg.ok { color: #16a34a; }
.iu-msg.err { color: #ef4444; }
.iu-msg.warn { color: #d97706; }
