/* 导入Tailwind CSS */
@import url('../aijscss/3.4.17.js');

/* 自定义配置 */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* 全局样式 */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: #64748b;
}

/* 上传区域样式 */
.upload-section {
    text-align: center;
    margin-bottom: 2rem;
}

.upload-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.upload-button:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px var(--shadow-color);
}

.upload-hint {
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* 预览区域样式 */
.preview-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.original-preview,
.grid-preview {
    background-color: var(--card-background);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.original-preview h2,
.grid-preview h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background-color: #f1f5f9;
    border-radius: 0.5rem;
    overflow: hidden;
}

.image-container img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    background-color: #000;
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 1/1;
}

.grid-item {
    background-color: #f1f5f9;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.grid-item:hover {
    transform: scale(1.02);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 加载状态样式 */
.loading-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* 按钮区域样式 */
.button-section {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.reset-button,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.reset-button {
    background-color: #f1f5f9;
    color: var(--text-color);
}

.reset-button:hover {
    background-color: #e2e8f0;
}

.download-button {
    background-color: var(--secondary-color);
    color: white;
}

.download-button:hover {
    background-color: #059669;
}

/* 说明区域样式 */
.instructions {
    background-color: var(--card-background);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 3rem;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.instructions h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.instructions ol {
    list-style-position: inside;
    color: #64748b;
}

.instructions li {
    margin-bottom: 0.5rem;
}

.copyright {
    text-align: center;
    margin-top: 2rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .preview-section {
        grid-template-columns: 1fr;
    }

    .button-section {
        flex-direction: column;
        align-items: center;
    }

    .reset-button,
    .download-button {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }

    .upload-button {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}