/* ============================================
   后台管理 - iOS风格样式
   ============================================ */

: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;
    --color-success: #34C759;
    --color-error: #FF3B30;
    
    --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: 20px;
    --border-radius-sm: 12px;
}

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

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

body {
    font-family: var(--font-body);
    background: var(--color-black);
    color: var(--color-white);
    min-height: 100vh;
    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");
}

/* ============================================
   头部导航
   ============================================ */
.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);
}

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

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s var(--ease-expo);
}

.back-link:hover {
    color: var(--color-white);
    transform: translateX(-4px);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-spacer {
    width: 100px;
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    padding-top: calc(var(--header-height) + 32px);
    padding-bottom: 48px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* ============================================
   上传区域 - 变形球体效果
   ============================================ */
.upload-section {
    margin-bottom: 48px;
}

.upload-zone {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--color-gray-2);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    transition: all 0.4s var(--ease-expo);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--color-gray-3);
}

.upload-zone.dragover {
    border-color: var(--color-accent);
    background: rgba(74, 144, 226, 0.1);
    transform: scale(1.02);
}

.upload-zone.uploading {
    border-style: solid;
    border-color: var(--color-accent);
}

.upload-zone-inner {
    position: relative;
    padding: 64px 32px;
    text-align: center;
    z-index: 2;
}

.upload-icon {
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 24px;
    transition: all 0.4s var(--ease-expo);
}

.upload-zone:hover .upload-icon {
    color: rgba(255, 255, 255, 0.5);
    transform: translateY(-4px);
}

.upload-zone.dragover .upload-icon {
    color: var(--color-accent);
    animation: bounce 0.6s var(--ease-elastic);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.upload-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-white);
}

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

.upload-btn {
    display: inline-flex;
    align-items: center;
    padding: 14px 32px;
    background: var(--color-white);
    color: var(--color-black);
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s var(--ease-expo);
    position: relative;
    overflow: hidden;
}

.upload-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.upload-btn:hover::before {
    transform: translateX(100%);
}

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

.upload-btn:active {
    transform: scale(0.98);
}

/* 变形背景 */
.morph-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(74, 144, 226, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.6s var(--ease-expo);
    pointer-events: none;
    filter: blur(40px);
}

.upload-zone.dragover .morph-bg {
    opacity: 1;
    width: 300px;
    height: 300px;
    animation: morphPulse 2s ease-in-out infinite;
}

@keyframes morphPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        border-radius: 50%;
    }
    33% {
        transform: translate(-50%, -50%) scale(1.1);
        border-radius: 45% 55% 50% 50%;
    }
    66% {
        transform: translate(-50%, -50%) scale(0.95);
        border-radius: 50% 50% 55% 45%;
    }
}

/* ============================================
   上传队列
   ============================================ */
.upload-queue {
    margin-bottom: 48px;
    display: none;
}

.upload-queue.has-items {
    display: block;
    animation: slideDown 0.4s var(--ease-expo);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.queue-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.8);
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--color-gray-2);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s var(--ease-expo);
}

.queue-item:hover {
    background: var(--color-gray-3);
    border-color: rgba(255, 255, 255, 0.1);
}

.queue-item.success {
    border-color: var(--color-success);
}

.queue-item.error {
    border-color: var(--color-error);
}

.queue-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--color-gray-4);
}

.queue-info {
    flex: 1;
    min-width: 0;
}

.queue-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.queue-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.queue-progress {
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.queue-progress-bar {
    height: 100%;
    background: var(--color-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.queue-item.success .queue-progress-bar {
    background: var(--color-success);
    width: 100%;
}

.queue-item.error .queue-progress-bar {
    background: var(--color-error);
}

.queue-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-status-icon {
    width: 20px;
    height: 20px;
}

.queue-item.success .queue-status-icon {
    color: var(--color-success);
}

.queue-item.error .queue-status-icon {
    color: var(--color-error);
}

.queue-item.processing .queue-status {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   已上传照片
   ============================================ */
.uploaded-section {
    margin-top: 48px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.8);
}

.uploaded-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.uploaded-item {
    position: relative;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background: var(--color-gray-2);
    aspect-ratio: 1;
    cursor: pointer;
    transition: all 0.4s var(--ease-expo);
}

.uploaded-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.uploaded-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-expo);
}

.uploaded-item:hover img {
    transform: scale(1.05);
}

.uploaded-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

.uploaded-item:hover .uploaded-item-overlay {
    opacity: 1;
}

.uploaded-item-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uploaded-item-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 59, 48, 0.9);
    border: none;
    border-radius: 50%;
    color: var(--color-white);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s var(--ease-expo);
}

.uploaded-item:hover .delete-btn {
    opacity: 1;
    transform: scale(1);
}

.delete-btn:hover {
    background: var(--color-error);
    transform: scale(1.1);
}

/* 空状态 */
.uploaded-empty {
    text-align: center;
    padding: 48px;
    color: rgba(255, 255, 255, 0.4);
}

.uploaded-empty svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ============================================
   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: var(--color-success);
}

.toast.error .toast-icon {
    background: var(--color-error);
}

/* ============================================
   加载动画
   ============================================ */
.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;
}

/* ============================================
   滚动条
   ============================================ */
::-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);
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }
    
    .header-content {
        padding: 0 16px;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .back-link span {
        display: none;
    }
    
    .main-content {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .upload-zone-inner {
        padding: 48px 24px;
    }
    
    .upload-title {
        font-size: 20px;
    }
    
    .uploaded-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .queue-progress {
        width: 80px;
    }
}

/* ============================================
   动画工具
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s var(--ease-expo) forwards;
}

.animate-slide-up {
    animation: slideUp 0.4s var(--ease-expo) forwards;
}
