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

.spinner {
    display: none;
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: block;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f7;
}

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

h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #1d1d1f;
}

/* 图片网格样式 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

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

.image-item:hover {
    transform: translateY(-5px);
}

.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* 图片预览样式 */
.image-item img.image-preview {
    object-fit: contain;
    background-color: #ffffff;
    padding: 0.5rem;
}

.image-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* 图片查看器样式 */
.image-viewer {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 90vw;
    margin: 0 auto;
}

.back-button {
    text-decoration: none;
    color: #333;
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
    text-decoration: underline;
}

.image-container {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 40vh;  /* Reduced from 60vh */
    max-height: 60vh;  /* Added max-height */
    margin-top: 20px;  /* Added space below buttons */
    overflow: hidden;  /* Contain oversized images */
}

.image-container img {
    max-width: 80%;     /* Reduced from 100% */
    max-height: 60vh;   /* Reduced from 80vh */
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 8px;
}

/* 图片查看器特殊样式 */
.image-container img.image-preview {
    background-color: #ffffff;
    padding: 1rem;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.image-wrapper {
    position: relative;
    display: inline-block;
}

.image-wrapper .delete-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-wrapper:hover .delete-button {
    opacity: 1;
}

.delete-button:hover {
    background-color: #c82333;
}

.selection-controls {
    margin: 20px 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    display: flex;
    gap: 10px;
}

.controls-right {
    justify-content: flex-end;  /* Align buttons to the right */
}

.password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.password-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.password-container h2 {
    margin-bottom: 1rem;
    color: #333;
}

.password-container input {
    padding: 8px 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
}

.password-container button {
    padding: 8px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.password-container button:hover {
    background: #0056b3;
}

.upload-button {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
}

.upload-button:hover {
    background: #218838;
}

.upload-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.upload-section {
    margin: 20px 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}

.upload-progress {
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
}

.progress-text {
    color: #333;
    font-size: 14px;
}