/* ============================================
   相册系统 - iOS风格样式
   ============================================ */

/* CSS变量 */
:root {
    --color-black: #000000;
    --color-white: #FFFFFF;
    --color-gray-1: #111111;
    --color-gray-2: #232323;
    --color-gray-3: #151515;
    --color-gray-4: #333333;
    --color-light-1: #E5E5E5;
    --color-light-2: #F5F5F5;
    --color-accent: #4A90E2;
    --color-accent-warm: #E2B84A;
    
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    
    --header-height: 64px;
    --glass-blur: 20px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
}

/* 重置 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--color-black);
    color: var(--color-white);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* 颗粒纹理叠加层 */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ============================================
   自定义光标
   ============================================ */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: difference;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--color-white);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
}

.cursor-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.15s var(--ease-expo);
}

.cursor-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-cursor.hover .cursor-ring {
    width: 60px;
    height: 60px;
    border-color: var(--color-accent);
}

.custom-cursor.view .cursor-text {
    opacity: 1;
    content: '查看';
}

/* 触摸设备隐藏自定义光标 */
@media (pointer: coarse) {
    .custom-cursor {
        display: none;
    }
}

/* ============================================
   毛玻璃头部导航
   ============================================ */
.glass-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s var(--ease-expo);
}

.glass-header.scrolled {
    background: rgba(0, 0, 0, 0.85);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.logo-dot {
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sort-control {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    padding: 4px;
    gap: 4px;
}

.sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s var(--ease-expo);
}

.sort-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.sort-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-white);
}

.sort-btn svg {
    transition: transform 0.3s var(--ease-elastic);
}

.sort-btn:hover svg {
    transform: scale(1.1);
}

.admin-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s var(--ease-expo);
}

.admin-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-white);
    transform: translateY(-2px);
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    padding-top: calc(var(--header-height) + 24px);
    padding-bottom: 48px;
    min-height: 100vh;
}

/* ============================================
   瀑布流画廊
   ============================================ */
.masonry-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    column-count: 4;
    column-gap: 16px;
}

@media (max-width: 1200px) {
    .masonry-container {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .masonry-container {
        column-count: 2;
        column-gap: 12px;
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .masonry-container {
        column-count: 2;
        column-gap: 8px;
        padding: 0 12px;
    }
}

/* 图片卡片 */
.photo-card {
    break-inside: avoid;
    margin-bottom: 16px;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--color-gray-2);
    cursor: pointer;
    transform: translateZ(0);
    transition: all 0.4s var(--ease-expo);
    opacity: 0;
    animation: fadeInUp 0.6s var(--ease-expo) forwards;
}

.photo-card:nth-child(1) { animation-delay: 0.05s; }
.photo-card:nth-child(2) { animation-delay: 0.1s; }
.photo-card:nth-child(3) { animation-delay: 0.15s; }
.photo-card:nth-child(4) { animation-delay: 0.2s; }
.photo-card:nth-child(5) { animation-delay: 0.25s; }
.photo-card:nth-child(6) { animation-delay: 0.3s; }
.photo-card:nth-child(7) { animation-delay: 0.35s; }
.photo-card:nth-child(8) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.photo-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.photo-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.6));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.photo-card:hover::before {
    opacity: 1;
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s var(--ease-expo);
}

.photo-card:hover img {
    transform: scale(1.05);
}

/* 图片信息覆盖层 */
.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    z-index: 2;
    transform: translateY(100%);
    transition: transform 0.4s var(--ease-expo);
}

.photo-card:hover .photo-overlay {
    transform: translateY(0);
}

.photo-title-small {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-meta-small {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

/* 加载更多 */
.load-more {
    display: flex;
    justify-content: center;
    padding: 48px 24px;
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 32px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-white);
    font-size: 14px;
    font-weight: 500;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s var(--ease-expo);
}

.load-more-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.load-more-btn.loading {
    pointer-events: none;
}

.load-more-btn.loading span {
    opacity: 0.5;
}

.load-more-btn .loading-spinner {
    display: none;
    width: 16px;
    height: 16px;
}

.load-more-btn.loading .loading-spinner {
    display: block;
}

/* 加载动画 */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 24px;
}

.empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
}

.empty-cta {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    background: var(--color-white);
    color: var(--color-black);
    font-size: 14px;
    font-weight: 600;
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.3s var(--ease-expo);
}

.empty-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.2);
}

/* ============================================
   图片详情模态框
   ============================================ */
.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.photo-modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.photo-modal.active .modal-backdrop {
    opacity: 1;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 关闭按钮 */
.modal-close {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--color-white);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s var(--ease-expo);
    opacity: 0;
    transform: scale(0.8);
}

.photo-modal.active .modal-close {
    opacity: 1;
    transform: scale(1);
    transition-delay: 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* 图片容器 */
.modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px 24px;
    position: relative;
    overflow: hidden;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s var(--ease-expo);
}

.photo-modal.active .modal-image {
    opacity: 1;
    transform: scale(1);
    transition-delay: 0.1s;
}

.image-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.modal-image.loaded + .image-loading {
    display: none;
}

/* ============================================
   EXIF信息面板 - 毛玻璃效果
   ============================================ */
.glass-panel {
    background: rgba(17, 17, 17, 0.85);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.exif-panel {
    padding: 24px;
    max-height: 45vh;
    overflow-y: auto;
    position: relative;
}

.exif-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.photo-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.photo-date {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* EXIF网格 */
.exif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.exif-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.3s var(--ease-expo);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.exif-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.exif-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
}

.exif-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-white);
    font-variant-numeric: tabular-nums;
}

.exif-item.has-value .exif-value {
    color: var(--color-accent);
}

/* 扫描线效果 */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    opacity: 0;
    animation: scanLine 4s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 90%, 100% {
        opacity: 0;
        transform: translateY(0);
    }
    5% {
        opacity: 0.3;
    }
    45% {
        opacity: 0.3;
        transform: translateY(200px);
    }
    50% {
        opacity: 0;
    }
}

/* ============================================
   Toast提示
   ============================================ */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 10000;
    opacity: 0;
    transition: all 0.4s var(--ease-expo);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-black);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon {
    background: #34C759;
}

.toast.error .toast-icon {
    background: #FF3B30;
}

/* ============================================
   滚动条样式
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   选择高亮
   ============================================ */
::selection {
    background: var(--color-accent);
    color: var(--color-white);
}

/* ============================================
   响应式调整
   ============================================ */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }
    
    .logo-text {
        font-size: 18px;
    }
    
    .sort-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .sort-btn span {
        display: none;
    }
    
    .exif-panel {
        padding: 16px;
        max-height: 50vh;
    }
    
    .exif-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .exif-item {
        padding: 12px;
    }
    
    .exif-value {
        font-size: 14px;
    }
    
    .modal-image-container {
        padding: 72px 16px 16px;
    }
    
    .modal-close {
        top: 16px;
        left: 16px;
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   动画工具类
   ============================================ */
.animate-fade-in {
    animation: fadeIn 0.5s var(--ease-expo) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-scale-in {
    animation: scaleIn 0.4s var(--ease-elastic) forwards;
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

/* 数字滚动动画 */
.number-roll {
    display: inline-block;
    animation: numberRoll 0.6s var(--ease-expo) forwards;
}

@keyframes numberRoll {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   分页样式
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--color-white);
    text-decoration: none;
    transition: all 0.3s var(--ease-expo);
}

.page-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.page-info {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    font-variant-numeric: tabular-nums;
}
