* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Vue 挂载前隐藏未编译的模板（含默认关闭的对话框），避免刷新瞬间闪现 */
[v-cloak] {
    display: none !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    min-height: 100vh;
    padding: 20px;
    scrollbar-gutter: stable;
    overflow-y: scroll;
    /* 顶部工具栏使用 100vw 全宽出血，裁剪掉滚动条宽度造成的横向溢出 */
    overflow-x: clip;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

/* ===== 全站统一页面外壳（上传页 / 图片库 / 轮播图管理共用） =====
 * 三页顶部工具栏的位置与宽度由 .main-content 的 20px 内边距统一决定，
 * 避免因各页容器 padding 不同导致顶部栏出现高低/宽窄偏差
 */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    min-height: 80vh;
}

/* 页面内容区：统一 20px 内边距（各页面可用媒体查询在窄屏覆盖为更小值） */
.main-content {
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
}

/* 双栏布局 */
.upload-layout {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    justify-content: center;
    margin: 0 auto;
}

.upload-sidebar {
    width: 360px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}

.upload-main {
    flex: 1;
    min-width: 0;
}

.global-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #999;
}

/* 上传区域 */
.upload-area {
    margin-bottom: 20px;
}

/* 统一附加值输入区域 */
.global-input-section {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.global-input-label {
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.global-additional-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.global-additional-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.drop-zone:hover {
    border-color: #667eea;
    background-color: #f0f4ff;
}

.drop-zone.dragover {
    border-color: #667eea;
    background-color: #e6eeff;
    transform: scale(1.02);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.drop-zone p {
    margin-bottom: 20px;
    font-size: 18px;
    color: #666;
}

.select-btn {
    display: inline-block;
    background-color: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.3s ease;
}

.select-btn:hover {
    background-color: #5a6fd8;
}

.drop-zone .multi-hint {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 13px;
    color: #999;
}

/* 图片列表 */
.image-list {
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    max-height: calc(100vh - 220px);
}

.image-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.image-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

.image-preview {
    width: 100%;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
}

.image-info {
    margin-bottom: 10px;
}

.image-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-size {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.additional-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.additional-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 表单分组（名称/分类/取图密钥） */
.input-group {
    margin-bottom: 10px;
}

.mini-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.name-input,
.category-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

.name-input:focus,
.category-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.image-actions {
    display: flex;
    justify-content: space-between;
}

.remove-btn {
    background-color: #ff4757;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.remove-btn:hover {
    background-color: #ff3742;
}

.upload-btn {
    background-color: #2ed573;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.upload-btn:hover {
    background-color: #27ae60;
}

.upload-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 已上传项样式 */
.image-item.uploaded {
    border-color: #c3e6cb;
    background-color: #f0fff4;
}

.image-item.uploaded .image-preview {
    opacity: 0.7;
}

/* 上传操作 */
.upload-actions {
    text-align: center;
    margin-bottom: 20px;
}

.upload-sidebar .upload-all-btn {
    width: 100%;
}

.upload-all-btn {
    background-color: #667eea;
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-all-btn:hover:not(:disabled) {
    background-color: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.upload-all-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 上传结果标题栏：左侧标题 + 右上角清空按钮 */
.upload-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 30px;
}

.upload-results-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.clear-results-btn {
    padding: 4px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #fff;
    color: #6c757d;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.clear-results-btn:hover {
    color: #dc3545;
    border-color: #dc3545;
    background-color: #fff5f5;
}

/* 有结果时才与标题栏拉开间距；无结果时标题栏仍保持原 30px 间距 */
.upload-results {
    margin-top: 12px;
}

.result-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 14px;
}

.result-item.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.result-item.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 响应式设计 */
@media (max-width: 992px) {
    /* 双栏改单栏 */
    .upload-layout {
        flex-direction: column;
    }

    .upload-sidebar {
        width: 100%;
        position: static;
    }

    .image-list {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .image-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .drop-zone {
        padding: 40px 20px;
    }

    .upload-all-btn {
        padding: 12px 24px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .image-list {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 24px;
    }
}

/* ===== 全站统一顶部工具栏（上传页 / 图片库 / 轮播图管理 / 用户列表共用） =====
 * 工具栏为页面最顶层的全宽横条：贴住视口顶部吸附，直角无圆角，
 * 毛玻璃半透明背景，宽度撑满整个视口（不受内容卡片 1400px 宽度限制） */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px max(20px, calc(50vw - 700px + 20px));
    /* 全宽出血：抵消 .gallery-container 的居中约束，左右顶到视口边缘 */
    width: 100vw;
    margin: -20px 0 20px calc(50% - 50vw);
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(233, 236, 239, 0.9);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    /* 吸附在视口最顶部 */
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 与右侧 .app-topbar-actions .btn（min-height:40px）严格等高 */
    min-height: 40px;
    padding: 0 16px;
    background-color: #f8f9fa;
    color: #667eea;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.app-nav-link:hover {
    background-color: #e9ecef;
}

/* 当前所在页对应的导航项：高亮填充且不可点 */
.app-nav-link.active {
    background-color: #667eea;
    border-color: #667eea;
    color: #fff;
    cursor: default;
    pointer-events: none;
}

/* 工具栏右侧页面级操作按钮（如“添加图片”） */
.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-topbar-actions .btn {
    min-height: 40px;
    padding: 10px 18px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .app-topbar {
        gap: 8px;
    }

    .app-nav {
        width: 100%;
    }

    .app-nav-link {
        flex: 1 1 0;
        text-align: center;
        padding: 0 10px;
    }

    .app-topbar-actions {
        width: 100%;
    }

    .app-topbar-actions .btn {
        flex: 1 1 0;
    }
}
