/* ==========================================================================
   浩保行管理后台 - 样式表
   ========================================================================== */

:root {
    --bg-base: #0a0e1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-modal: #0f1525;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.3);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #0ea5e9;
    --accent-indigo: #6366f1;
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    --status-done: #10b981;
    --status-done-bg: rgba(16, 185, 129, 0.12);
    --status-pending: #f59e0b;
    --status-pending-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--border-hover);
    --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
        'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 800px 600px at 20% 0%, rgba(14, 165, 233, 0.08), transparent),
        radial-gradient(ellipse 600px 400px at 80% 100%, rgba(99, 102, 241, 0.06), transparent);
    pointer-events: none;
    z-index: 0;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ==========================================================================
   登录页
   ========================================================================== */
.login-page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-modal);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: var(--shadow-modal);
    text-align: center;
}

.login-logo {
    margin-bottom: 32px;
}

.login-logo svg {
    margin-bottom: 16px;
}

.login-logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.login-hint {
    text-align: center;
    font-size: 0.8rem;
    margin-top: 12px;
    min-height: 20px;
    color: var(--danger);
}

.back-link {
    display: inline-block;
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--accent-blue);
}

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   管理面板
   ========================================================================== */
.admin-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(13, 18, 32, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-header-right {
    display: flex;
    gap: 10px;
}

.admin-body {
    padding: 28px 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 统计卡片 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.admin-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    transition: all var(--transition);
}

.admin-stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-icon-blue { background: rgba(14, 165, 233, 0.12); color: var(--accent-blue); }
.stat-icon-green { background: var(--status-done-bg); color: var(--status-done); }
.stat-icon-amber { background: var(--status-pending-bg); color: var(--status-pending); }
.stat-icon-purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info .stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 模块面板 */
.modules-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.admin-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 管理模块卡片 */
.admin-module-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    transition: all var(--transition);
    animation: cardIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

.admin-module-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.admin-module-card:hover .module-icon {
    transform: scale(1.1) rotate(-5deg);
}

.admin-module-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.module-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.module-icon svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.module-icon.pending-icon {
    background: linear-gradient(135deg, #475569, #334155);
}

.module-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.module-badge.available {
    background: var(--status-done-bg);
    color: var(--status-done);
}

.module-badge.pending {
    background: var(--status-pending-bg);
    color: var(--status-pending);
}

.admin-module-code {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}

.admin-module-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.admin-module-subtitle {
    font-size: 0.78rem;
    color: var(--accent-blue);
    margin-bottom: 12px;
}

.admin-module-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.admin-module-videos {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-module-videos svg {
    width: 15px;
    height: 15px;
}

.admin-module-action {
    font-size: 0.78rem;
    color: var(--accent-blue);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.admin-module-action svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   详情弹窗
   ========================================================================== */
.detail-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.detail-modal.active {
    display: flex;
}

.detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.detail-container {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    background: var(--bg-modal);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: detailIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes detailIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.detail-title {
    flex: 1;
}

.detail-code {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--accent-blue);
    font-weight: 600;
    letter-spacing: 0.1em;
    background: rgba(14, 165, 233, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.detail-title h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-title p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.detail-close {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 16px;
}

.detail-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.detail-close svg {
    width: 20px;
    height: 20px;
}

.detail-body {
    overflow-y: auto;
    padding: 24px;
}

/* 上传区域 */
.upload-zone {
    border: 2px dashed var(--border-card);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-blue);
    background: rgba(14, 165, 233, 0.04);
}

.upload-icon {
    color: var(--accent-blue);
    margin-bottom: 12px;
}

.upload-icon svg {
    width: 40px;
    height: 40px;
}

.upload-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* 上传进度 */
.upload-progress {
    margin-top: 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 视频列表 */
.video-list-section {
    margin-top: 24px;
}

.video-list-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.video-list-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.video-count-badge {
    font-size: 0.75rem;
    color: var(--accent-blue);
    background: rgba(14, 165, 233, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.video-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    transition: all var(--transition);
}

.video-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.video-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-item-icon svg {
    width: 18px;
    height: 18px;
}

.video-item-info {
    flex: 1;
    min-width: 0;
}

.video-item-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.video-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.video-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   Bug管理 & 新增Bug表单
   ========================================================================== */
.admin-bug-stats {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.bug-stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.bug-stat-num {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bug-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.add-bug-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.add-bug-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.add-bug-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.add-bug-form label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.add-bug-form .required {
    color: #ef4444;
}

.add-bug-form textarea,
.add-bug-form input[type="text"],
.add-bug-form select {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all var(--transition);
    resize: vertical;
}

.add-bug-form textarea:focus,
.add-bug-form input:focus,
.add-bug-form select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.add-bug-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

@media (max-width: 600px) {
    .add-bug-form .form-row {
        grid-template-columns: 1fr;
    }
    .admin-bug-stats {
        flex-direction: column;
    }
}

/* 文件上传区 */
.bug-file-zone {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-input);
}

.bug-file-zone:hover,
.bug-file-zone.dragover {
    border-color: var(--accent-blue);
    background: rgba(14, 165, 233, 0.05);
}

.bug-file-icon {
    color: var(--text-muted);
    margin-bottom: 8px;
}

.bug-file-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.bug-file-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* 图片预览网格 */
.bug-file-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.bug-file-preview:empty {
    display: none;
}

.bug-image-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.bug-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bug-image-thumb .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

.bug-image-thumb .remove-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* 附件列表 */
.bug-file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.bug-file-list:empty {
    display: none;
}

.bug-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bug-file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bug-file-item .file-size {
    color: var(--text-muted);
    font-size: 0.72rem;
    flex-shrink: 0;
}

.bug-file-item .remove-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.bug-file-item .remove-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* 上传进度 */
.bug-upload-progress {
    font-size: 0.75rem;
    color: var(--accent-blue);
    padding: 4px 0;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-modal);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: var(--shadow-hover);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

.toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success svg { color: var(--status-done); }
.toast.warning svg { color: var(--status-pending); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--accent-blue); }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 768px) {
    .admin-header {
        padding: 14px 20px;
    }

    .admin-logo {
        font-size: 0.95rem;
    }

    .admin-body {
        padding: 20px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-modules-grid {
        grid-template-columns: 1fr;
    }

    .detail-modal {
        padding: 0;
    }

    .detail-container {
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .admin-header-right .btn {
        padding: 8px 12px;
        font-size: 0.78rem;
    }
}
