/* ═══ Reset & Base ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}
a { color: #4a90d9; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══ Auth ═══ */
.auth-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-card {
    background: #fff; border-radius: 16px; padding: 40px;
    width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.auth-logo { text-align: center; font-size: 28px; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: #999; margin-bottom: 28px; }
.auth-card h2 { text-align: center; margin-bottom: 20px; color: #444; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #666; font-weight: 500; }
.form-group input {
    width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 15px; transition: border-color 0.2s; outline: none;
}
.form-group input:focus { border-color: #4a90d9; box-shadow: 0 0 0 3px rgba(74,144,217,0.1); }
.error-msg { color: #e74c3c; font-size: 13px; margin-bottom: 12px; min-height: 20px; }
.form-footer { text-align: center; margin-top: 16px; font-size: 14px; color: #888; }

/* ═══ Buttons ═══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 24px; border: none; border-radius: 8px; cursor: pointer;
    font-size: 15px; font-weight: 500; transition: all 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: #4a90d9; color: #fff; width: 100%; }
.btn-primary:hover { background: #357abd; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-outline { background: transparent; border: 1px solid #ddd; color: #555; }
.btn-outline:hover { border-color: #4a90d9; color: #4a90d9; }
.btn-danger { background: transparent; border: 1px solid #e74c3c; color: #e74c3c; }
.btn-danger:hover { background: #e74c3c; color: #fff; }

/* ═══ Header ═══ */
.app-header {
    background: #fff; border-bottom: 1px solid #e8e8e8;
    padding: 0 24px; height: 60px;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 20px; }
.welcome-user { color: #888; font-size: 14px; }
.header-right { display: flex; align-items: center; gap: 10px; position: relative; }

/* 移动端菜单折叠 */
.header-nav-desktop { display: flex; align-items: center; gap: 10px; }
.header-menu-btn { display: none; }
.btn-logout-mobile { display: none; }
.header-menu-dropdown {
    display: none; position: absolute; top: 100%; right: 0; z-index: 200;
    flex-direction: column; background: #fff; border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15); overflow: hidden; min-width: 150px;
    margin-top: 6px;
}
.header-menu-dropdown .menu-item {
    display: block; width: 100%; padding: 12px 20px; border: none; background: none;
    text-align: left; font-size: 14px; color: #333; cursor: pointer; text-decoration: none;
    transition: background 0.15s;
}
.header-menu-dropdown .menu-item:hover { background: #f5f5f5; }
.header-menu-dropdown .menu-item + .menu-item { border-top: 1px solid #eee; }

/* ═══ Container ═══ */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ═══ Section Header ═══ */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.section-header .album-detail-title { font-size: 22px; font-weight: 600; }
.section-header .album-detail-desc { color: #888; font-size: 14px; margin-left: 8px; }
.header-actions { display: flex; gap: 8px; }

/* ═══ Album Grid ═══ */
.album-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px;
}
.album-card {
    background: #fff; border-radius: 12px; padding: 20px;
    cursor: pointer; transition: all 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}
.album-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); border-color: #4a90d9; }
.album-card h3 { font-size: 18px; margin-bottom: 6px; }
.album-card p { color: #888; font-size: 14px; margin-bottom: 12px; line-height: 1.4; }
.album-meta { display: flex; justify-content: space-between; font-size: 12px; color: #aaa; }

/* ═══ Empty State ═══ */
.empty-state {
    text-align: center; padding: 60px 20px; color: #999;
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: #666; }
.empty-state p { font-size: 14px; }

/* ═══ 相册导航行（上一个 | 上传 | 下一个）═══ */
.album-nav-row { display: flex; align-items: stretch; gap: 10px; margin-bottom: 24px; }
.album-nav-row .upload-area { flex: 1; padding: 8px 16px; margin-bottom: 0; min-width: 0; display: flex; align-items: center; }
.album-nav-row .upload-trigger { flex-direction: row; gap: 8px; }
.album-nav-row .upload-icon { font-size: 22px; }
.album-nav-row .upload-hint { display: none; }
.album-nav-row .btn { flex-shrink: 0; white-space: nowrap; display: flex; align-items: center; }

/* ═══ Upload Area ═══ */
.upload-area {
    background: #fff; border: 2px dashed #ddd; border-radius: 12px;
    padding: 30px; margin-bottom: 24px; transition: all 0.2s; cursor: pointer;
}
.upload-area:hover { border-color: #4a90d9; background: #fafbff; }
.upload-trigger { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.upload-icon { font-size: 36px; }
.upload-hint { font-size: 12px; color: #bbb; }

/* ═══ Photo Grid ═══ */
.photo-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px;
}
.photo-card {
    position: relative; border-radius: 10px; overflow: hidden;
    background: #111; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    aspect-ratio: 1; cursor: pointer; transition: transform 0.2s;
}
.photo-card:hover { transform: scale(1.02); }
.photo-card img, .photo-card video {
    width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: auto;
}
.play-badge {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 48px; height: 48px; background: rgba(0,0,0,0.6);
    border: 3px solid rgba(255,255,255,0.8); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 20px; pointer-events: none;
}

/* ═══ 上传进度条 ═══ */
.upload-progress {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 10px;
    margin-bottom: 16px; font-size: 14px; color: #555;
}
.upload-progress-bar { flex: 1; height: 8px; background: #e8e8e8; border-radius: 4px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: #4a90d9; border-radius: 4px; transition: width 0.3s ease; }
.photo-check {
    position: absolute; top: 8px; left: 8px; z-index: 5;
    width: 24px; height: 24px; border-radius: 50%;
    background: rgba(0,0,0,0.45); border: 2px solid rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; font-weight: bold;
}
.photo-card.selected { outline: 3px solid #4a90d9; outline-offset: -3px; border-radius: 10px; }
.batch-delete-bar {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    background: #fff; border: 1px solid #e8e8e8; border-radius: 10px;
    margin-bottom: 16px; font-size: 14px; color: #666;
}
.batch-delete-bar .btn { flex-shrink: 0; }
/* ═══ Modal ═══ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; padding: 20px;
}
.modal-content {
    background: #fff; border-radius: 14px; padding: 30px;
    width: 100%; max-width: 440px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-close {
    position: absolute; top: 12px; right: 16px; font-size: 28px;
    cursor: pointer; color: #999; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-content h2 { margin-bottom: 20px; color: #444; }

/* ═══ Toast ═══ */
.toast {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    padding: 12px 28px; border-radius: 8px; color: #fff; font-size: 14px;
    z-index: 2000; opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }

/* ═══ Photo Preview Modal ═══ */

.modal-content.preview-modal {
    background: transparent; box-shadow: none;
    border-radius: 0; padding: 0;
    width: auto; max-width: 95vw;
    height: 95vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: flex-start;
    position: relative;
}
.preview-image-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; width: 100%; }
.preview-image-wrap .photo-preview {
    max-width: 85vw; max-height: 80vh; border-radius: 8px; user-select: none;
    margin: auto; aspect-ratio: auto;
}
.preview-image-wrap video.photo-preview { object-fit: contain; background: #000; }

/* 预览信息栏（在图片下方） */
.preview-info {
    display: flex; flex-direction: column;
    width: 100%; padding: 6px 12px; color: rgba(255,255,255,0.85);
    font-size: 13px; flex-shrink: 0;
}
.preview-info-row {
    display: flex; justify-content: space-between; align-items: center;
}
.preview-filename { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.preview-counter { flex-shrink: 0; }
.preview-takenat { font-size: 12px; opacity: 0.7; margin-top: 2px; }

/* 固定在屏幕底部的导航条 */
#previewNavbarFixed {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; align-items: stretch; height: 58px;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
    z-index: 1001;
}
#previewNavbarFixed .preview-nav-half {
    flex: 1; display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 500; color: rgba(255,255,255,0.9);
    cursor: pointer; user-select: none; transition: background 0.15s;
}
#previewNavbarFixed .preview-nav-half:hover { background: rgba(255,255,255,0.12); }
#previewNavbarFixed .preview-nav-half.disabled { opacity: 0.2; cursor: default; }
#previewNavbarFixed .preview-nav-half.disabled:hover { background: transparent; }
#previewNavbarFixed .preview-nav-divider { width: 1px; background: rgba(255,255,255,0.15); }
.preview-modal .modal-close { color: rgba(255,255,255,0.8); }

/* ═══ Loading ═══ */
.loading { text-align: center; padding: 40px; color: #999; }

/* ═══ Responsive ═══ */
@media (max-width: 600px) {
    .auth-card { padding: 28px 20px; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .header-actions { width: 100%; }
    .album-grid { grid-template-columns: 1fr; }
    .photo-grid { grid-template-columns: repeat(2, 1fr); }
    .header-nav-desktop { display: none; }
    .header-menu-btn { display: inline-flex; }
    .btn-logout-mobile { display: inline-flex; }
    .album-nav-row { gap: 6px; }
    .album-nav-row .btn { font-size: 12px; padding: 6px 10px; }
}
