/**
 * 用户门户样式
 * @author:chendejue
 *
 * 功能说明：
 * - 基于 admin.css，调整品牌色和侧栏样式来区分门户与后台
 * - 门户使用绿色系品牌色（区别于后台的蓝色系）
 * - 包含登录页独有样式
 */

/* 导入管理后台基础样式 */
@import url('/admin/assets/css/admin.css');

/* 门户品牌色覆盖：绿色系 */
:root {
    --accent: #10b981;
    --accent-dim: rgba(16, 185, 129, 0.12);
    --accent-glow: rgba(16, 185, 129, 0.3);
    --border-focus: #10b981;
    --border-glow: rgba(16, 185, 129, 0.15);
}

[data-theme="light"] {
    --accent: #059669;
    --accent-dim: rgba(5, 150, 105, 0.08);
    --accent-glow: rgba(5, 150, 105, 0.2);
    --border-focus: #059669;
    --border-glow: rgba(5, 150, 105, 0.15);
}

[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .btn-primary:hover { color: #fff; background: #047857; border-color: #047857; box-shadow: 0 0 20px rgba(5,150,105,0.15); }
[data-theme="light"] .pagination .current { color: #fff; }

/* 侧栏品牌色区分 */
.sidebar-brand .brand-sub { color: var(--accent); }

/* 门户用户头像渐变（绿色系） */
.admin-avatar {
    background: linear-gradient(135deg, var(--accent), #34d399);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
[data-theme="light"] .admin-avatar {
    background: linear-gradient(135deg, #059669, #34d399);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

/* 登录页样式 */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 30px;
}

.login-brand h1 {
    font-size: 22px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

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

.login-card .form-group {
    margin-bottom: 16px;
}

.login-card label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.login-card .form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-ui);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card .form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--border-glow);
}

/* 悬浮客服组件 */
.support-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    font-family: var(--font-ui);
}

.support-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.support-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}

.support-fab.active {
    background: var(--text-secondary);
}

.support-panel {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: supportPanelIn 0.2s ease;
}

.support-panel.show {
    display: flex;
}

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

.support-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.support-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.support-close:hover { opacity: 1; }

.support-panel-body {
    padding: 16px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.8;
    max-height: 380px;
    overflow-y: auto;
}

.support-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px 0;
}

.support-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.support-item:last-child { border-bottom: none; }

.support-item-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--accent);
    margin-top: 2px;
}

.support-item-label {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 2px;
}

.support-item-value {
    color: var(--text-primary);
    font-size: 13px;
    word-break: break-all;
}

.support-item-value a {
    color: var(--accent);
    text-decoration: none;
}

.support-item-value a:hover {
    text-decoration: underline;
}

.support-qrcode {
    text-align: center;
    padding: 12px 0;
}

.support-qrcode img {
    max-width: 160px;
    max-height: 160px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.support-qrcode-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.support-desc {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .support-widget {
        bottom: 18px;
        right: 18px;
    }
    .support-panel {
        width: calc(100vw - 36px);
        right: 0;
    }
}

/* ============================================
   用户门户扩展样式
   ============================================ */

/* 完整 Key 展示框（重新生成后一次性展示） */
.key-reveal {
    background: var(--accent);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    word-break: break-all;
    margin: 10px 0;
    position: relative;
}

.key-reveal small {
    display: block;
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.8;
    font-family: var(--font-ui);
}

.key-reveal .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.key-reveal .copy-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* 小型操作按钮（更换、重新生成等） */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.action-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.action-btn.danger {
    color: var(--danger);
    border-color: var(--danger);
    opacity: 0.7;
}

.action-btn.danger:hover {
    opacity: 1;
    background: rgba(220, 53, 69, 0.08);
}

/* 模型权限标签 */
.model-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    background: var(--accent);
    color: #fff;
    white-space: nowrap;
    margin: 2px 2px;
}

.model-tag.all {
    background: var(--text-secondary);
}

/* 模态框（更换域名等） */
.portal-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.portal-modal.show {
    display: flex;
}

.portal-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.portal-modal-content h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: var(--text-primary);
}

.portal-modal-content .form-group {
    margin-bottom: 16px;
}

.portal-modal-content .form-control {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.portal-modal-content .form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--border-glow);
}

.portal-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
