/* Poppins 由 index.html 的 <link> 统一预加载，utility.css 不重复拉取 */

/* ── CSS Variables ─────────────────────────────────── */
:root {
    --bg-base:        #f4faf6;
    --bg-gradient:    linear-gradient(135deg, #f4faf6 0%, #e8f5ee 40%, #f0fdf4 70%, #f4faf6 100%);
    --accent:         #4a7c59;
    --accent-light:   #6db89a;
    --accent-pale:    #a8d5b5;
    --accent-grad:    linear-gradient(135deg, #4a7c59 0%, #6db89a 100%);
    --upload-grad:    linear-gradient(135deg, #4a7c59 0%, #38a169 60%, #6db89a 100%);
    --text-primary:   #2d4a38;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;
    --card-bg:        rgba(255, 255, 255, 0.88);
    --card-border:    rgba(255, 255, 255, 0.5);
    --card-shadow:    0 8px 32px rgba(74, 124, 89, 0.10);
    --success-bg:     rgba(40, 167, 69, 0.95);
    --danger-bg:      rgba(220, 53, 69, 0.95);
    --hover-bg:       rgba(74, 124, 89, 0.06);
    --active-bg:      rgba(74, 124, 89, 0.12);
    --focus-ring:     rgba(74, 124, 89, 0.3);
    --neutral-bg:     #f0f7f2;
    --neutral-border: #d4e8da;
    --nav-home-bg:    linear-gradient(135deg, #e8f5ee 0%, #d4e8da 100%);
}

/* ── Reset ─────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ── Body ──────────────────────────────────────────── */
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-gradient);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    color: var(--text-primary);
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Layout ────────────────────────────────────────── */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 15px;
    padding-bottom: 80px;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    padding-bottom: 80px;
}

/* ── Card ──────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Page Header ───────────────────────────────────── */
.header {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
}

.header.centered { text-align: center; }

.header h1,
.header-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p,
.header-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* gradient text utility */
.grad-text {
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-grad);
    color: white;
    box-shadow: 0 4px 15px var(--focus-ring);
}
.btn-primary:hover    { transform: translateY(-2px); box-shadow: 0 6px 20px var(--focus-ring); }
.btn-primary:active   { transform: scale(0.95); }

.btn-cancel {
    background: var(--neutral-bg);
    color: var(--text-secondary);
}
.btn-cancel:active    { background: var(--neutral-border); }

.btn-danger {
    background: #fff0f0;
    color: #dc3545;
    border: 1px solid rgba(220,53,69,0.2);
}
.btn-danger:active    { background: #ffe0e0; }

/* icon round button (back, action) */
.back-btn,
.action-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--neutral-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    flex-shrink: 0;
}
.back-btn:active,
.action-icon-btn:active { transform: scale(0.95); }

.btn-delete-icon {
    background: #fff5f5;
    color: #dc3545;
}

/* full-width action button */
.action-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-grad);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 15px var(--focus-ring);
    font-family: inherit;
}
.action-btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px var(--focus-ring); }
.action-btn:active { transform: scale(0.95); }

/* select-all toggle */
.select-all-btn {
    padding: 10px 20px;
    border: 2px solid var(--accent);
    background: white;
    color: var(--accent);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-family: inherit;
}
.select-all-btn.active {
    background: var(--accent-grad);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--focus-ring);
}
.select-all-btn:hover:not(.active) { background: var(--hover-bg); border-color: var(--accent-light); }
.select-all-btn:active             { transform: scale(0.95); }

/* ── Form ──────────────────────────────────────────── */
.form-group  { margin-bottom: 15px; }

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

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--neutral-border);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
    background: white;
    color: var(--text-primary);
}
.form-input:focus,
.form-textarea:focus { outline: none; border-color: var(--accent-light); }

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Modal ─────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    animation: fadeIn 0.3s;
}
.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 25px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
    box-shadow: 0 8px 40px rgba(74, 124, 89, 0.18);
    border: 1px solid var(--card-border);
}

.modal-header {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ── Toast ─────────────────────────────────────────── */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(45, 74, 56, 0.92);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    z-index: 2000;
    display: none;
    animation: slideDown 0.3s;
    white-space: nowrap;
}
.toast.show    { display: block; }
.toast.success { background: var(--success-bg); }
.toast.error   { background: var(--danger-bg); }

/* ── Bottom Nav ────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(74, 124, 89, 0.08);
    border-top: 1px solid var(--neutral-border);
    display: flex;
    gap: 10px;
}

.nav-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: inherit;
}
.nav-btn:active { transform: scale(0.95); }

.nav-btn-home {
    background: var(--nav-home-bg);
    color: var(--accent);
}
.nav-btn-primary {
    background: var(--accent-grad);
    color: white;
}

/* ── Progress ──────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--neutral-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-fill {
    height: 100%;
    background: var(--upload-grad);
    width: 0%;
    transition: width 0.3s;
}
.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ── Spinner ───────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244, 250, 246, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--accent-pale);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-text {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Photo Card & Checkbox ─────────────────────────── */
.photo-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.10);
    cursor: pointer;
    transition: all 0.2s;
}
.photo-card:active  { transform: scale(0.98); }
.photo-card.selected { box-shadow: 0 0 0 3px var(--accent); }

.photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--neutral-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}
.photo-card.selected .photo-checkbox {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: bold;
}

/* ── Empty State ───────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
}
.empty-icon { font-size: 4rem; margin-bottom: 20px; }
.empty-text { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 10px; }
.empty-hint { font-size: 0.9rem; color: var(--text-muted); }

/* ── Keyframes ─────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes slideDown {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to   { transform: translate(-50%, 0);     opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
