/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 移动端优化 */
html {
    -webkit-text-size-adjust: 100%; /* 防止文字自动调整 */
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none; /* 禁用长按菜单（选择性） */
}

/* 允许文本选择 */
p, span, div, h1, h2, h3, h4, h5, h6 {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* iOS 弹性滚动 */
body {
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* 头部样式 */
header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 a {
    color: #667eea;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: bold;
}

nav a {
    margin-left: 2rem;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: #667eea;
}

/* 主内容区域 */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* 提示消息 */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

/* 筛选区域 */
.filter-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.filter-section h2 {
    margin-bottom: 1.5rem;
    color: #667eea;
}

.filter-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.filter-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
    font-size: 1.2rem;
    padding: 1rem 2rem;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

/* 图片网格 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.image-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.image-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.image-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.image-info {
    padding: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag-style {
    background: #e3f2fd;
    color: #1976d2;
}

.tag-scene {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* 图片详情 */
.detail-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.image-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.image-preview img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-quality {
    text-align: center;
    margin-top: 1rem;
    font-weight: 500;
    color: #667eea;
}

.image-meta h2 {
    color: #333;
    margin-bottom: 1rem;
}

.description {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.tags {
    margin-bottom: 1.5rem;
}

.upload-time {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.download-section {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.download-section h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.notice {
    color: #ff6b6b;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.ad-container {
    margin: 1.5rem 0;
}

.ad-placeholder {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border: 2px dashed #e17055;
    padding: 3rem;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.ad-placeholder:hover {
    background: linear-gradient(135deg, #fdcb6e 0%, #ffeaa7 100%);
    transform: scale(1.02);
}

.ad-placeholder p {
    font-size: 1.2rem;
    color: #d63031;
    font-weight: bold;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.page-number {
    color: white;
    font-weight: 500;
}

/* 登录页面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.hint {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* 管理面板 */
.admin-panel {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.admin-panel h2 {
    color: #667eea;
    margin-bottom: 2rem;
}

.admin-actions {
    margin-bottom: 2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #667eea;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

.admin-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

/* 上传页面 */
.upload-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.upload-container h2 {
    color: #667eea;
    margin-bottom: 2rem;
}

.upload-form .form-group {
    margin-bottom: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.preview-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.preview-container h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.preview-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 3rem;
    color: white;
    font-size: 1.2rem;
}

/* 底部 */
footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

footer p {
    color: #666;
}

/* 响应式设计 */

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }

    .image-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    .preview-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* 移动设备 (最大 768px) */
@media (max-width: 768px) {
    /* 全局字体调整 */
    body {
        font-size: 14px;
    }

    /* 头部适配 */
    header h1 a {
        font-size: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    nav {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    nav a {
        margin-left: 0;
        padding: 0.5rem 1rem;
        background: #f0f0f0;
        border-radius: 20px;
        font-size: 0.9rem;
    }

    /* 主内容区域 */
    main {
        padding: 1rem 0;
    }

    /* 筛选区域 */
    .filter-section {
        padding: 1.5rem;
    }

    .filter-section h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .filter-form {
        flex-direction: column;
        gap: 1rem;
    }

    .filter-group {
        width: 100%;
        min-width: auto;
    }

    .filter-group select,
    .filter-group input {
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }

    /* 图片网格 */
    .image-grid {
        grid-template-columns: repeat(2, 1fr); /* 移动端两列 */
        gap: 0.8rem;
    }

    .image-card img {
        height: 180px;
    }

    .image-info {
        padding: 0.75rem;
    }

    .tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }

    /* 图片详情 */
    .detail-container {
        padding: 1rem;
    }

    .image-detail {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .image-meta h2 {
        font-size: 1.3rem;
    }

    .download-section {
        padding: 1.5rem;
    }

    .download-section h3 {
        font-size: 1.1rem;
    }

    .ad-placeholder {
        padding: 2rem 1rem;
    }

    .ad-placeholder p {
        font-size: 1rem;
    }

    /* 按钮 */
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
        width: 100%; /* 移动端按钮全宽 */
        text-align: center;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.8rem;
    }

    .btn-success {
        font-size: 1.1rem;
        padding: 0.9rem 1.5rem;
    }

    /* 分页 */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .pagination .btn {
        width: auto;
        padding: 0.5rem 1rem;
    }

    .page-number {
        font-size: 0.9rem;
    }

    /* 登录页面 */
    .login-box {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .login-box h2 {
        font-size: 1.5rem;
    }

    /* 管理面板 */
    .admin-panel {
        padding: 1rem;
    }

    .admin-panel h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    /* 表格优化 - 卡片式显示 */
    .admin-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.8rem;
    }

    .admin-table thead {
        display: none; /* 隐藏表头 */
    }

    .admin-table tbody {
        display: block;
    }

    .admin-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 0.8rem;
        background: white;
    }

    .admin-table td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 80px;
        color: #667eea;
    }

    .admin-thumbnail {
        width: 100%;
        max-width: 200px;
        height: auto;
        margin-top: 0.5rem;
    }

    /* 上传页面 */
    .preview-container {
        padding: 1.5rem;
        margin: 1rem;
    }

    .upload-container h2 {
        font-size: 1.3rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* 防止 iOS 缩放 */
    }

    .preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .preview-thumb {
        height: 90px;
    }

    /* 底部 */
    footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }

    footer p {
        font-size: 0.85rem;
    }
}

/* 小屏手机 (最大 480px) */
@media (max-width: 480px) {
    /* 头部 */
    header h1 a {
        font-size: 1.3rem;
    }

    nav a {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    /* 图片网格 - 单列 */
    .image-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .image-card img {
        height: 250px;
    }

    /* 筛选区域 */
    .filter-section {
        padding: 1rem;
    }

    .filter-section h2 {
        font-size: 1.2rem;
    }

    /* 详情页 */
    .image-meta h2 {
        font-size: 1.1rem;
    }

    .description {
        font-size: 0.9rem;
    }

    .download-section {
        padding: 1rem;
    }

    .ad-placeholder {
        padding: 1.5rem 0.8rem;
    }

    .ad-placeholder p {
        font-size: 0.9rem;
    }

    /* 按钮 */
    .btn {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
    }

    .btn-success {
        font-size: 1rem;
        padding: 0.8rem 1.2rem;
    }

    /* 表单 */
    .login-box {
        padding: 1.5rem 1rem;
    }

    .upload-container {
        padding: 1rem;
    }

    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .preview-thumb {
        height: 80px;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    .btn,
    nav a,
    .image-card {
        min-height: 44px; /* iOS 推荐的最小触摸目标 */
    }

    /* 移除悬停效果，使用点击效果 */
    .image-card:active {
        transform: scale(0.98);
    }

    .btn:active {
        transform: translateY(0);
        opacity: 0.8;
    }

    .ad-placeholder:active {
        transform: scale(0.98);
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .image-card img {
        height: 150px;
    }
}
