/* public/css/style.css - Modern Clean SaaS Theme (Merged & Unified) */

:root {
    /* 核心色板 (Tech Blue) */
    --primary-color: #2563eb;       /* 亮蓝 */
    --primary-hover: #1d4ed8;       /* 深蓝 */
    --primary-light: #eff6ff;       /* 极浅蓝背景 */
    
    /* 语义色 */
    --success-color: #10b981;       /* 翠绿 */
    --danger-color: #ef4444;        /* 赤红 */
    --warning-color: #f59e0b;       /* 琥珀 */
    --info-color: #64748b;          /* 蓝灰 */

    /* 中性色 */
    --bg-body: #f8fafc;             /* 页面背景（冷灰） */
    --bg-card: #ffffff;             /* 卡片背景 */
    --text-main: #1e293b;           /* 主要文字 */
    --text-secondary: #64748b;      /* 次要文字 */
    --border-color: #e2e8f0;        /* 边框色 */
    
    /* 尺寸与阴影 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --header-height: 64px;
}

/* --- 1. 全局重置 --- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding-top: calc(var(--header-height) + 30px); /* 留出头部空间 */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h2, h3, h4, h1 { margin: 0 0 1rem 0; color: var(--text-main); font-weight: 700; }
a { text-decoration: none; color: inherit; transition: color 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }

/* --- 2. 布局容器 --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

/* 新增：通用主容器 (用于 Edit/Upload 等单页应用场景) */
.main-container {
    max-width: 1200px;
    margin: 0 auto; /* 移除顶部 margin，由 body padding 控制 */
    padding: 0 20px;
}

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); font-size: 0.9em; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }

/* 新增：通用页面标题头 */
.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

/* --- 3. 导航栏 (Glassmorphism 风格) --- */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.header-brand span { font-weight: 800; letter-spacing: -0.5px; color: var(--primary-color); font-size: 1.3rem; }
.header-nav { display: flex; gap: 20px; align-items: center; }
.nav-link { 
    font-weight: 500; color: var(--text-secondary); padding: 8px 12px; border-radius: var(--radius-sm); 
    font-size: 0.95rem; 
}
.nav-link:hover, .nav-link.active { color: var(--primary-color); background: var(--primary-light); }
.nav-divider { width: 1px; height: 24px; background: var(--border-color); margin: 0 10px; }

/* --- 4. 按钮体系 --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 500; font-size: 0.95rem;
    cursor: pointer; border: 1px solid transparent;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background-color: var(--primary-color); color: white; border-color: transparent; }
.btn-primary:hover { background-color: var(--primary-hover); box-shadow: var(--shadow-md); }

.btn-secondary { background-color: #fff; color: var(--text-main); border-color: var(--border-color); }
.btn-secondary:hover { background-color: #f9fafb; border-color: #cbd5e1; }

.btn-danger { background-color: #fff; color: var(--danger-color); border-color: #fecaca; }
.btn-danger:hover { background-color: #fef2f2; border-color: var(--danger-color); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-lg { padding: 10px 24px; font-size: 1rem; }

/* 表格操作列按钮组 */
.action-buttons {
    display: flex; gap: 8px; align-items: center; justify-content: flex-start; flex-wrap: nowrap;
}
.action-buttons .btn-sm { white-space: nowrap; padding: 4px 10px; }

/* --- 5. 表单控件 (Modern Inputs) --- */
.form-group { margin-bottom: 20px; }
.form-label, .modern-label { display: block; font-weight: 600; margin-bottom: 8px; color: #475569; font-size: 0.9rem; }

.form-control, .form-input, .form-textarea, .modern-input, .modern-select, .modern-textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: #f8fafc; /* 统一浅灰背景 */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    font-family: inherit;
}

.modern-textarea { resize: vertical; line-height: 1.6; min-height: 100px; }

.form-control:focus, .modern-input:focus, .modern-select:focus, .modern-textarea:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.required-star { color: #ef4444; margin-left: 4px; }

/* 新增：通用表单网格 */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 768px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* --- 6. Checkbox Card (通用) --- */
.checkbox-card {
    display: flex; align-items: center;
    padding: 16px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.checkbox-card:hover { background-color: #f1f5f9; border-color: #cbd5e1; }
.checkbox-card input[type="checkbox"] { width: 20px; height: 20px; margin-right: 12px; accent-color: var(--primary-color); cursor: pointer; }
.checkbox-text { font-weight: 500; color: #334155; }
.checkbox-subtext { font-size: 0.85rem; color: #64748b; margin-left: 8px; font-weight: normal; }

/* --- 7. 表格 (Clean Table) --- */
.table-responsive {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}
td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.9rem;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover { background-color: #f8fafc; }

/* --- 8. 卡片组件 --- */
/* 基础卡片样式 */
.upload-area, .config-card, .file-card, .meta-pane, .series-header, .comment-area, .edit-card, .content-card {
    background: var(--bg-card);
    border-radius: 16px; /* 统一圆角 */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* 通用内容卡片 (Unified Card for Forms) */
.content-card {
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 24px;
}
.card-header {
    padding: 20px 32px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 32px; background-color: #ffffff; }

/* 旧版配置标题 (保留兼容性) */
.config-title {
    font-size: 1.1rem; font-weight: 600; color: #333;
    margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

/* --- 9. 拖拽上传 (Modern Dropzone) --- */
.modern-dropzone, .upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    background-color: #f8fafc;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin-bottom: 24px;
}
.modern-dropzone:hover, .modern-dropzone.drag-over, .upload-dropzone:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.15);
}
.drop-icon, .dropzone-icon {
    font-size: 48px; color: #94a3b8; margin-bottom: 16px; display: inline-block;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}
.drop-btn {
    background: white; border: 1px solid #e2e8f0; padding: 8px 16px; border-radius: 6px;
    font-size: 0.9rem; font-weight: 500; color: var(--text-main); margin-top: 16px; display: inline-block;
    transition: all 0.2s;
}
.modern-dropzone:hover .drop-btn { border-color: var(--primary-color); color: var(--primary-color); }

/* --- 10. 文件列表卡片 (File Item Card - Upload Page) --- */
.file-card {
    display: flex; flex-direction: column; /* 确保是垂直布局 */
    padding: 20px; margin-bottom: 16px; transition: all 0.2s;
}
.file-card:hover { border-color: #e2e8f0; box-shadow: 0 8px 16px -4px rgba(0,0,0,0.08); transform: translateY(-2px); }

.file-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.file-meta { display: flex; align-items: center; gap: 16px; }
.file-thumb {
    width: 48px; height: 48px; background: #f1f5f9; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.file-details h4 { margin: 0 0 4px 0; font-size: 1rem; font-weight: 600; color: var(--text-main); word-break: break-all; }
.file-details span, .file-size {
    font-size: 0.85rem; color: var(--text-secondary); background: #f8fafc; padding: 2px 8px; border-radius: 4px;
}
.btn-icon-delete {
    background: none; border: none; color: #ef4444; cursor: pointer; padding: 4px;
    border-radius: 50%; transition: background 0.2s; font-size: 1.1rem; line-height: 1;
}
.btn-icon-delete:hover { background-color: #fee2e2; }

/* --- 11. 进度条 (Modern) --- */
.modern-progress-bg, .upload-progress-track { height: 6px; background: #f1f5f9; border-radius: 10px; overflow: hidden; margin-top: 10px; }
.modern-progress-bar, .upload-progress-fill { height: 100%; background: var(--primary-color); width: 0%; border-radius: 10px; transition: width 0.3s ease; }

/* --- 12. 画廊网格 (Gallery) --- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; margin-top: 24px; }
.gallery-item {
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; box-shadow: var(--shadow-sm);
}
.gallery-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.thumb-box { height: 180px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.gallery-item:hover .thumb-box img { transform: scale(1.05); }
.item-info { padding: 16px; }
.item-name { font-weight: 600; font-size: 1rem; color: var(--text-main); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-date { font-size: 0.8rem; color: var(--text-secondary); }

/* --- 13. 状态标签 (Badge) --- */
.status-badge, .tag-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.status-success { background: #dcfce7; color: #166534; }
.status-pending { background: #f3f4f6; color: #4b5563; }
.status-error { background: #fee2e2; color: #991b1b; }
.tag-badge { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; margin-right: 5px; }

/* --- 14. 模态框 (Modal) --- */
.modal-overlay {
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: all 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
    background: #fff; border-radius: var(--radius-lg); width: 600px; max-width: 90%; padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95); transition: transform 0.3s;
}
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.modal-close { font-size: 1.5rem; color: var(--text-secondary); cursor: pointer; transition: color 0.2s; }
.modal-close:hover { color: var(--danger-color); }

/* --- 15. 批量操作栏 --- */
.batch-toolbar {
    background: var(--primary-light); border: 1px solid #dbeafe; color: var(--primary-hover);
    padding: 12px 20px; border-radius: var(--radius-md); margin-bottom: 20px;
    display: none; align-items: center; justify-content: space-between; animation: slideDown 0.3s ease;
}
.batch-toolbar.active { display: flex; }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- 16. 图片详情页导航按钮 --- */
.nav-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px;
    background: rgba(255, 255, 255, 0.8); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.5rem; color: #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); transition: all 0.2s; user-select: none; z-index: 10; text-decoration: none;
}
.nav-arrow:hover { background: white; box-shadow: 0 6px 15px rgba(0,0,0,0.2); transform: translateY(-50%) scale(1.1); }
.nav-prev { left: 20px; } .nav-next { right: 20px; }
@media (max-width: 768px) { .nav-arrow { width: 40px; height: 40px; font-size: 1.2rem; } .nav-prev { left: 10px; } .nav-next { right: 10px; } }

/* --- 17. 编辑页面专用样式 (Series Edit) --- */
.edit-container { max-width: 800px; margin: 40px auto; padding: 0 20px; }
.edit-card {
    background: #ffffff; border-radius: 16px; box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    border: 1px solid #eef2f6; overflow: hidden;
}
.edit-header {
    padding: 30px 40px; border-bottom: 1px solid #f1f5f9; background: #ffffff;
    display: flex; justify-content: space-between; align-items: center;
}
.edit-title { margin: 0; font-size: 1.5rem; color: #1e293b; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.edit-body { padding: 40px; background-color: #ffffff; }
.edit-footer, .bottom-actions {
    padding: 20px 40px; background-color: #f8fafc; border-top: 1px solid #e2e8f0;
    display: flex; justify-content: flex-end; gap: 12px;
}

/* --- 用户下拉菜单 (User Dropdown) --- */

.header-user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

/* 头像样式 */
.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    user-select: none;
}

.user-avatar:hover {
    background-color: #dbeafe;
    border-color: #bfdbfe;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* 下拉菜单容器 */
.dropdown-menu {
    position: absolute;
    top: 55px; /* 在头像下方 */
    right: 0;
    width: 220px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 8px 0;
    z-index: 1100;
    
    /* 默认隐藏 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 激活状态：显示 */
.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 菜单头部 (显示用户名) */
.dropdown-header-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.dropdown-username {
    display: block;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

.dropdown-role {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 菜单项链接 */
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.dropdown-item.danger {
    color: var(--danger-color);
}

.dropdown-item.danger:hover {
    background-color: #fef2f2;
}

.dropdown-icon {
    margin-right: 10px;
    width: 16px;
    text-align: center;
    font-size: 1rem;
}