/* ===== 后台管理样式 ===== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #faf7f8;
    color: #333;
    line-height: 1.6;
}

a { color: #e8415f; text-decoration: none; }
a:hover { color: #d63355; }

/* ===== 登录页 ===== */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #ff8598 0%, #e8415f 100%);
}

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px 32px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: #888;
    margin-bottom: 28px;
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: #bbb;
    margin-top: 20px;
}

/* ===== 后台布局 ===== */

.admin-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #222;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ===== 按钮 ===== */

.btn {
    display: inline-block;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover { opacity: 0.88; }

.btn-primary {
    background: linear-gradient(135deg, #ff8598, #e8415f);
    color: #fff;
    border-color: transparent;
}
.btn-primary:hover { color: #fff; background: linear-gradient(135deg, #ff7590, #d63355); border-color: transparent; }

.btn-secondary {
    background: #fff;
    color: #555;
    border-color: #eee0e4;
}
.btn-secondary:hover { color: #e8415f; border-color: #ff9aac; background: #fff; }

.btn-danger {
    background: #ff4d4f;
    color: #fff;
    border-color: #ff4d4f;
}
.btn-danger:hover { background: #ff7875; color: #fff; }

.btn-warning {
    background: #fa8c16;
    color: #fff;
    border-color: #fa8c16;
}
.btn-warning:hover { background: #ffa940; color: #fff; }

.btn-success {
    background: #52c41a;
    color: #fff;
    border-color: #52c41a;
}
.btn-success:hover { background: #73d13d; color: #fff; }

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 10px 28px;
    font-size: 15px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ===== 提示信息 ===== */

.alert-success, .alert-error {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.alert-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
}

/* ===== 顶部悬浮 Toast 通知 ===== */

.toast-container {
    position: fixed;
    /* 从顶部 banner 下方 12px 处向下展示；左侧偏移 110px 使其在内容区水平居中（侧边栏 220px 的一半） */
    top: 70px;
    left: calc(50% + 110px);
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    white-space: nowrap;
}

.toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.toast-success svg { fill: #16a34a; }

.toast-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.toast-error svg { fill: #dc2626; }

.toast-info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.toast-info svg { fill: #2563eb; }

.toast.toast-out {
    animation: toastOut 0.35s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

/* ===== 表格 ===== */

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
}

.table thead {
    background: #fafafa;
}

.table th {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-align: center;
    border-bottom: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
}

.table th:last-child {
    border-right: none;
}

.table td {
    padding: 12px 16px;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
    vertical-align: middle;
}

.table td:last-child {
    border-right: none;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: #fafafa;
}

/* 分享链接列居左 */
.table td:nth-child(7),
.table th:nth-child(7) {
    text-align: left;
}

.table code {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #d4380d;
}

.table .actions {
    white-space: nowrap;
}

.table .actions .btn + .btn {
    margin-left: 6px;
}

/* ===== 分享链接输入框 ===== */

.link-input {
    width: 220px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    color: #666;
    background: #fafafa;
    margin-right: 6px;
    vertical-align: middle;
}

.link-input:focus {
    outline: none;
    border-color: #e8415f;
}

/* ===== 空状态 ===== */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.empty-state p {
    font-size: 15px;
    color: #999;
}

/* ===== 编辑表单 ===== */

.edit-form fieldset {
    background: #fff;
    border: none;
    border-radius: 8px;
    padding: 24px 24px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.edit-form legend {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding: 0 8px;
    margin-left: -8px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e8415f;
    padding-bottom: 6px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 4px;
}

.form-row-2 .form-group { flex: 1; }
.form-row-3 .form-group { flex: 1; }

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e8415f;
    box-shadow: 0 0 0 3px rgba(232,65,95,0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-group small {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.form-check label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #e8415f;
}

/* ===== 图片上传区域 ===== */

.upload-area {
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    position: relative;
    transition: border-color 0.2s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-area:hover {
    border-color: #e8415f;
}

.upload-area-sm {
    min-height: 80px;
    max-width: 200px;
}

.upload-area input[type="file"] {
    font-size: 12px;
    max-width: 100%;
}

.upload-preview {
    max-width: 100%;
    max-height: 160px;
    border-radius: 4px;
    object-fit: cover;
}

.upload-preview-sm {
    max-height: 80px;
}

/* ===== 表单操作栏 ===== */

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 8px;
}

/* ===== 响应式 ===== */

@media (max-width: 768px) {
    /* 移动端侧边栏隐藏，Toast 居中即可 */
    .toast-container { left: 50%; }
}

@media (max-width: 768px) {
    .admin-container {
        padding: 16px 12px 40px;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .link-input {
        width: 160px;
    }

    .edit-form fieldset {
        padding: 16px 14px 14px;
    }

    .login-box {
        padding: 32px 24px 24px;
    }
}

@media (max-width: 480px) {
    .admin-header h1 {
        font-size: 18px;
    }

    .link-input {
        width: 120px;
    }

    .table th, .table td {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* ===== 启用/禁用状态按钮 ===== */

.btn-toggle-active {
    background: #52c41a;
    color: #fff;
    border-color: #52c41a;
}
.btn-toggle-active:hover {
    background: #73d13d;
    color: #fff;
}

.btn-toggle-inactive {
    background: #d9d9d9;
    color: #666;
    border-color: #d9d9d9;
}
.btn-toggle-inactive:hover {
    background: #bfbfbf;
    color: #666;
}

.row-inactive {
    opacity: 0.5;
}

.row-inactive code {
    text-decoration: line-through;
}

/* ===== 访问量显示 ===== */

.view-count {
    font-weight: 600;
    color: #d6336c;
}

/* ===== 二维码弹窗 ===== */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    width: 90%;
    max-width: 420px;
    text-align: left;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    animation: modalSlideIn 0.22s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-24px); }
    to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}
.modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #222;
}
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #bbb;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.modal-close:hover { color: #666; }
.modal-box .form-group {
    margin-bottom: 16px;
}
.modal-box .form-group label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}
.modal-box .form-group label em {
    color: #ff4d4f;
    font-style: normal;
}
.modal-box .form-group input,
.modal-box .form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
}
.modal-box .form-group input:focus,
.modal-box .form-group select:focus {
    border-color: #e8415f;
    outline: none;
    box-shadow: 0 0 0 3px rgba(232,65,95,0.08);
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}

/* ===== 账号管理页 ===== */

/* 统计卡片 */
.user-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.user-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-left: 4px solid #d9d9d9;
    transition: transform 0.15s;
}
.user-stat-card:hover { transform: translateY(-2px); }
.user-stat-num {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}
.user-stat-label {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}
.user-stat-active  { border-left-color: #52c41a; }
.user-stat-active .user-stat-num  { color: #52c41a; }
.user-stat-disabled { border-left-color: #ff4d4f; }
.user-stat-disabled .user-stat-num { color: #ff4d4f; }
.user-stat-super   { border-left-color: #fa8c16; }
.user-stat-super .user-stat-num    { color: #fa8c16; }

/* 表格包装 */
.user-table-wrap {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}
.user-table { box-shadow: none; border-radius: 0; }

/* “我”标记 */
.user-me-tag {
    display: inline-block;
    background: #fdf2f4;
    color: #d6336c;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 500;
    border: 1px solid #ffd8e0;
}

/* 状态徽章（带圆点） */
.user-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.user-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    font-style: normal;
}
.user-status-active {
    background: #f6ffed;
    color: #52c41a;
}
.user-status-active .user-status-dot { background: #52c41a; }
.user-status-disabled {
    background: #fff2f0;
    color: #ff4d4f;
}
.user-status-disabled .user-status-dot { background: #ff4d4f; }

/* 操作按钮 */
.user-actions {
    white-space: nowrap;
}
.btn-action {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
    margin: 0 2px;
}
.btn-action-edit {
    background: #fdf2f4;
    color: #d6336c;
}
.btn-action-edit:hover { background: #ffdce3; }
.btn-action-reset {
    background: #fff7e6;
    color: #fa8c16;
}
.btn-action-reset:hover { background: #ffe7ba; }
.btn-action-disable {
    background: #fff2f0;
    color: #ff4d4f;
}
.btn-action-disable:hover { background: #ffccc7; }
.btn-action-enable {
    background: #f6ffed;
    color: #52c41a;
}
.btn-action-enable:hover { background: #d9f7be; }

/* 当前账号提示 */
.user-current-hint {
    font-size: 12px;
    color: #bbb;
}

/* 停用行变灰 */
.row-disabled td {
    opacity: 0.55;
}

@media (max-width: 600px) {
    .user-stats { grid-template-columns: repeat(2, 1fr); }
    .user-actions .btn-action { display: block; margin: 3px 0; }
}

.qr-card {
    width: 320px;
    background: linear-gradient(170deg, #fff9f5 0%, #fff0e8 40%, #ffe8db 100%);
    border-radius: 20px;
    padding: 28px 24px 20px;
    text-align: center;
    box-shadow: 0 12px 48px rgba(180,80,40,0.18);
    position: relative;
    overflow: hidden;
}
.qr-card::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    background: radial-gradient(circle, rgba(198,40,40,0.08) 0%, transparent 70%);
    border-radius: 50%;
}
.qr-card::after {
    content: '';
    position: absolute;
    bottom: -20px; left: -20px;
    width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(255,152,0,0.08) 0%, transparent 70%);
    border-radius: 50%;
}
.qr-card-top {
    position: relative;
    margin-bottom: 10px;
}
.qr-card-xi {
    font-size: 52px;
    color: #c62828;
    font-weight: 400;
    line-height: 1;
    font-family: 'STKaiti', 'KaiTi', 'Ma Shan Zheng', cursive;
    text-shadow: 2px 2px 8px rgba(198,40,40,0.15);
}
.qr-card-label {
    font-size: 10px;
    letter-spacing: 4px;
    color: #c6856e;
    margin-top: 4px;
    font-weight: 500;
}
.qr-card-names {
    font-size: 20px;
    font-weight: 700;
    color: #8b3a2a;
    margin-bottom: 4px;
    letter-spacing: 1px;
}
.qr-card-date {
    font-size: 13px;
    color: #b07060;
    margin-bottom: 10px;
}
.qr-card-divider {
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d4a08a, transparent);
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-card-divider span {
    font-size: 10px;
    color: #d4a08a;
    background: #fff5ef;
    padding: 0 6px;
}
.qr-card-qr {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 160px;
    height: 160px;
    margin: 0 auto 12px;
    position: relative;
    z-index: 1;
}
.qr-card-qr img,
.qr-card-qr canvas {
    border-radius: 10px;
    border: 4px solid #fff;
    box-shadow: 0 3px 12px rgba(139,58,42,0.12), 0 0 0 1px rgba(139,58,42,0.06);
}
/* 二维码中心囍字 logo */
.qr-center-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #c62828, #a01010);
    color: #fff;
    font-size: 20px;
    font-family: 'STKaiti', 'KaiTi', 'Ma Shan Zheng', cursive;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(198,40,40,0.3);
    border: 2px solid #fff;
    line-height: 1;
    z-index: 2;
}
.qr-card-scan {
    font-size: 12px;
    color: #a07060;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}
.qr-card-footer {
    font-size: 11px;
    color: #c8a090;
    padding-top: 10px;
    border-top: 1px dashed #e8c8b8;
    position: relative;
    z-index: 1;
}
/* 弹窗包装器（垂直居中） */
.qr-modal-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.qr-modal-btns {
    display: flex;
    gap: 12px;
}
.qr-btn-save {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: linear-gradient(135deg, #ff8598, #e8415f);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(232,65,95,0.3);
}
.qr-btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232,65,95,0.4);
}
.qr-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.qr-btn-close {
    padding: 8px 20px;
    background: rgba(255,255,255,0.9);
    color: #888;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.qr-btn-close:hover {
    background: #fff;
    color: #555;
    border-color: #bbb;
}

/* ===== 角色标记 ===== */

.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.role-super {
    background: #fff7e6;
    color: #d46b08;
    border: 1px solid #ffd591;
}

.role-admin {
    background: #f0f5ff;
    color: #2f54eb;
    border: 1px solid #adc6ff;
}

.text-muted {
    color: #bbb;
    font-size: 12px;
}

/* ===== 账号管理 - 旧表单（已废弃） ===== */

