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

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

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

/* 登录页面 */
.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    margin: 100px auto;
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

.logo {
    font-size: 60px;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

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

.login-box h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

.login-form input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-view {
    background: #4CAF50;
    color: white;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-upload {
    margin-top: 15px;
}

/* 头部 */
.header {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.header h2 {
    font-size: 24px;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #ff6b6b;
    color: white;
}

.badge-user {
    background: #4CAF50;
    color: white;
}

/* 内容区域 */
.content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

/* 上传切换标签 */
.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    background: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.tab-btn:hover,
.tab-btn:active {
    border-color: #667eea;
    color: #667eea;
    background: #f8f9ff;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.upload-panel {
    display: none !important;
}

.upload-panel.active {
    display: block !important;
}

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

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    border: 3px dashed #667eea;
    border-radius: 10px;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s;
}

.file-label:hover {
    background: #eef0ff;
    border-color: #764ba2;
}

.file-label .icon {
    font-size: 24px;
}

.file-label .text {
    font-size: 16px;
    color: #667eea;
    font-weight: 500;
}

/* 提示信息 */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 14px;
}

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

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

/* 图片区域 */
.images-section {
    margin-top: 20px;
}

.section-header {
    margin-bottom: 20px;
}

.section-header h3 {
    font-size: 20px;
    color: #333;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

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

.image-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

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

.image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #e9ecef;
    overflow: hidden;
    cursor: pointer;
}

.image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-wrapper:hover img {
    transform: scale(1.05);
}

/* 文件图标样式 */
.file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    position: relative;
}

.file-icon svg {
    width: 60px;
    height: 60px;
    stroke-width: 1.5;
    color: #495057;
    margin-bottom: 10px;
}

.file-icon .ext-label {
    font-size: 14px;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 不同文件类型颜色 */
.image-wrapper[data-type="document"] .file-icon {
    background: linear-gradient(135deg, #d4e4ff 0%, #b8d4ff 100%);
}

.image-wrapper[data-type="document"] .file-icon svg {
    color: #2563eb;
}

.image-wrapper[data-type="document"] .file-icon .ext-label {
    color: #2563eb;
}

.image-wrapper[data-type="pdf"] .file-icon {
    background: linear-gradient(135deg, #ffe4e4 0%, #ffc9c9 100%);
}

.image-wrapper[data-type="pdf"] .file-icon svg {
    color: #dc2626;
}

.image-wrapper[data-type="pdf"] .file-icon .ext-label {
    color: #dc2626;
}

.image-wrapper[data-type="archive"] .file-icon {
    background: linear-gradient(135deg, #fff4d4 0%, #ffe4a8 100%);
}

.image-wrapper[data-type="archive"] .file-icon svg {
    color: #d97706;
}

.image-wrapper[data-type="archive"] .file-icon .ext-label {
    color: #d97706;
}

.image-wrapper[data-type="design"] .file-icon {
    background: linear-gradient(135deg, #f3e5ff 0%, #e0ccff 100%);
}

.image-wrapper[data-type="design"] .file-icon svg {
    color: #7c3aed;
}

.image-wrapper[data-type="design"] .file-icon .ext-label {
    color: #7c3aed;
}

/* 文件图标悬停效果 */
.image-wrapper[data-type]:not([data-type="image"]):hover .file-icon {
    transform: scale(1.05);
    transition: transform 0.3s;
}

.image-wrapper[data-type]:not([data-type="image"]) {
    cursor: default;
}

.file-size {
    font-size: 11px;
    color: #999;
    margin-bottom: 5px;
}

.btn-download {
    background: #10b981;
    color: white;
}

.btn-download:hover {
    background: #059669;
}

.upload-hint {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 10px;
    line-height: 1.6;
}

.image-info {
    padding: 15px;
}

.image-name {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    word-break: break-all;
    line-height: 1.4;
}

.image-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 11px;
    color: #888;
    flex-wrap: wrap;
}

.image-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.image-actions {
    display: flex;
    gap: 8px;
}

.image-actions .btn {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 13px;
}

.image-actions form {
    flex: 1;
    display: flex;
}

.image-actions form button {
    width: 100%;
    flex: 1;
}

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 - 平板 */
@media (min-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 响应式设计 - 桌面 */
@media (min-width: 1024px) {
    body {
        padding: 40px;
    }
    
    .image-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
    
    .login-box {
        margin: 150px auto;
    }
    
    .content {
        padding: 35px;
    }
}

/* 图片预览浮窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    animation: fadeIn 0.3s ease;
    padding: 20px;
    overflow: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    width: 100%;
    height: auto;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
    background: white;
    padding: 5px;
}

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

.modal-close {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    line-height: 1;
    backdrop-filter: blur(10px);
}

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

.modal-close:active {
    transform: scale(0.95);
}

/* 移动端优化 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .login-box {
        padding: 30px 20px;
        margin: 50px auto;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h2 {
        font-size: 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    .image-grid {
        gap: 15px;
    }
    
    .image-info {
        padding: 12px;
    }
    
    .image-name {
        font-size: 11px;
    }
    
    .image-meta {
        font-size: 10px;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-close {
        top: 15px;
        right: 15px;
        font-size: 35px;
        width: 45px;
        height: 45px;
    }
    
    .modal-content {
        max-width: 100%;
    }
}