* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #171717;
    --card: #1e1e1e;
    --card-hover: #252525;
    --text: #cccccc;
    --text-bright: #ffffff;
    --text-dim: #808080;
    --border: #2a2a2a;
    --accent: #f97316;
    --accent-dark: #ea580c;
    --header-h: 60px;
    --cat-nav-h: 48px;
}

body {
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

/* Header */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 2px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.brand-icon i { color: #fff; font-size: 18px; }
.header-brand h1 { font-size: 16px; color: var(--text-bright); font-weight: 600; }
.header-brand p { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.header-admin {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: var(--card-hover);
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-dim);
    font-size: 13px;
    transition: all 0.2s;
}
.header-admin:hover { color: var(--accent); border-color: var(--accent); }

/* Category Nav */
.category-nav {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-h);
    z-index: 99;
}
.category-tabs {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--cat-nav-h);
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}
.category-tabs::-webkit-scrollbar { height: 3px; }
.category-tabs::-webkit-scrollbar-thumb { background: var(--border); }
.cat-tab {
    padding: 6px 16px;
    color: var(--text-dim);
    font-size: 13px;
    border-radius: 2px;
    transition: all 0.15s;
    border: 1px solid transparent;
    flex-shrink: 0;
}
.cat-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.cat-tab.active {
    color: var(--text-bright);
    background: var(--accent);
    border-color: var(--accent);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}

/* Masonry */
.masonry {
    position: relative;
    width: 100%;
}
.masonry-item {
    position: absolute;
    transition: all 0.2s;
}

/* Group Card */
.group-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}
.group-card:hover {
    border-color: var(--card-accent, var(--accent));
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.group-cover { position: relative; overflow: hidden; }
.group-card:hover .group-cover img { transform: scale(1.05); }
.group-overlay {
    position: absolute;
    top: 8px; left: 8px; right: 8px;
    display: flex; justify-content: space-between; align-items: flex-start;
}
.group-cat-badge {
    background: var(--card-accent, var(--accent));
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 2px;
}
.group-count {
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 2px;
    backdrop-filter: blur(4px);
}
.group-info {
    padding: 12px 14px;
    border-left: 3px solid var(--card-accent, var(--accent));
    background: linear-gradient(90deg, rgba(249,115,22,0.05), transparent 60%);
}
.group-title {
    font-size: 15px;
    color: var(--text-bright);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.group-time {
    font-size: 12px;
    color: var(--card-accent, var(--accent));
    margin-top: 5px;
    font-weight: 500;
}
.group-time i { margin-right: 4px; }

/* Load More */
.load-more {
    text-align: center;
    margin-top: 30px;
}
.btn-load-more {
    padding: 10px 30px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-load-more:hover { border-color: var(--accent); color: var(--accent); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-dim);
}
.empty-state i { font-size: 64px; display: block; margin-bottom: 12px; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
}

/* Group Modal */
.group-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92);
    z-index: 200;
    overflow-y: auto;
    animation: fadeIn 0.2s;
}
.group-modal.show { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.group-modal-header {
    position: sticky;
    top: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}
.group-modal-info { flex: 1; min-width: 0; }
.group-modal-info h3 {
    font-size: 16px;
    color: var(--text-bright);
    font-weight: 600;
    margin-top: 4px;
}
.modal-cat-badge {
    display: inline-block;
    color: #fff;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 2px;
}
.modal-time { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.modal-time i { margin-right: 3px; }
.modal-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 36px; height: 36px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.modal-close:hover { color: #fff; border-color: var(--error); }
.group-modal-body { padding: 20px 24px; }
.group-images-loading {
    text-align: center;
    padding: 60px 0;
    color: var(--text-dim);
}
.group-images-loading i { display: block; margin-bottom: 12px; }

/* Group Images Grid */
.group-images-grid {
    display: grid;
    gap: 8px;
    align-items: start;
}
.group-image-item {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
}
.group-image-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.group-image-item:hover img { transform: scale(1.05); }
.image-size {
    position: absolute;
    top: 0; left: 0; right: 0;
    background: linear-gradient(rgba(0,0,0,0.6), transparent);
    color: #fff;
    font-size: 11px;
    padding: 6px 8px;
    opacity: 0;
    transition: opacity 0.2s;
}
.group-image-item:hover .image-size { opacity: 1; }

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.96);
    z-index: 300;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}
.lightbox.show { display: flex; }
.lightbox-close {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 16px;
    z-index: 10;
    transition: all 0.2s;
}
.lightbox-close:hover { background: rgba(249,115,22,0.8); border-color: var(--accent); }
.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 20px;
    z-index: 10;
    transition: all 0.2s;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(249,115,22,0.8); border-color: var(--accent); }
.lightbox-container {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lightbox-container img {
    max-width: 100%;
    max-height: calc(100vh - 100px);
    object-fit: contain;
    display: block;
}
.lightbox-info {
    margin-top: 12px;
    text-align: center;
    display: flex;
    gap: 16px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-brand h1 { font-size: 14px; }
    .header-brand p { display: none; }
    .main-content { padding: 12px; }
    .group-images-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; }
    .lightbox-prev, .lightbox-next { width: 36px; height: 36px; font-size: 18px; }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
    .lightbox-info { flex-direction: column; gap: 4px; }
}

/* ========== Search Box ========== */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.search-box i {
    position: absolute;
    left: 10px;
    color: var(--text-dim);
    font-size: 13px;
    pointer-events: none;
}
.search-box input {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 30px 8px 30px;
    color: var(--text);
    font-size: 13px;
    width: 220px;
    transition: all 0.2s;
}
.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    width: 280px;
}

/* ========== Sort Tabs ========== */
.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.sort-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sort-label {
    font-size: 13px;
    color: var(--text-dim);
    margin-right: 2px;
}
.sort-tab {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.sort-tab:hover { color: var(--text); border-color: var(--accent); }
.sort-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ========== Tag Cloud ========== */
.tag-cloud {
    padding: 8px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.tag-item {
    display: inline-block;
    padding: 3px 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}
.tag-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.tag-item em {
    font-style: normal;
    font-size: 10px;
    opacity: 0.6;
}

/* ========== Image Tags ========== */
.image-tags {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.image-tag {
    font-size: 10px;
    padding: 1px 6px;
    background: rgba(249,115,22,0.3);
    color: #f97316;
    border-radius: 3px;
    white-space: nowrap;
}

/* ========== Modal Actions ========== */
.modal-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}
.modal-action-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.modal-action-btn:hover {
    color: var(--accent);
    background: rgba(249,115,22,0.1);
}

/* ========== Share Modal ========== */
.share-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}
.share-modal.show { display: flex; }
.share-modal-content {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
}
.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.share-modal-header h3 { font-size: 16px; color: var(--text-bright); }
.share-modal-header button {
    background: none; border: none; color: var(--text-dim);
    font-size: 18px; cursor: pointer;
}
.share-modal-body { text-align: center; }
.share-qr-box {
    margin: 0 auto 16px;
    width: 200px; height: 200px;
    background: #fff;
    border-radius: 8px;
    padding: 8px;
}
.share-qr-box img { width: 100%; height: 100%; border-radius: 4px; }
.share-link-box {
    display: flex;
    gap: 8px;
}
.share-link-box input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 12px;
}
.share-link-box button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
}

/* ========== Lightbox Toolbar ========== */
.lightbox-toolbar {
    position: absolute;
    top: 16px;
    right: 60px;
    display: flex;
    gap: 8px;
    z-index: 10;
}
.lightbox-tool-btn {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}
.lightbox-tool-btn:hover {
    background: rgba(249,115,22,0.8);
    border-color: var(--accent);
}

/* ========== Search Loading ========== */
.search-loading {
    text-align: center;
    padding: 60px 0;
    color: var(--text-dim);
    grid-column: 1 / -1;
}
.search-loading i { display: block; margin-bottom: 12px; }

/* ========== Light Theme ========== */
[data-theme="light"] {
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-dim: #888888;
    --text-bright: #111111;
    --accent: #f97316;
    --border: #e0e0e0;
}
[data-theme="light"] .group-card { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
[data-theme="light"] .group-overlay { background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.6)); }

/* ========== Theme Toggle ========== */
.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ========== Lightbox EXIF & Description ========== */
.lightbox-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-top: 4px;
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lightbox-exif {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
    font-family: monospace;
}

/* ========== Footer Pages ========== */
.footer-pages {
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
}
.footer-pages a {
    color: var(--text-dim);
    margin: 0 6px;
    text-decoration: none;
}
.footer-pages a:hover { color: var(--accent); }

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
    grid-column: 1 / -1;
}
.empty-state i { font-size: 48px; display: block; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 14px; }
