/* ========================================
   Bubblegum UI - 全局样式
   ======================================== */

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

:root {
    /* Bubblegum 色彩系统 */
    --primary: #FF6B9D;
    --primary-light: #FFB5D6;
    --primary-dark: #E85A8A;
    --secondary: #A8E6CF;
    --accent: #FFD93D;
    --accent-purple: #C3B1E1;
    
    /* 背景色 */
    --bg-main: #FFF5F7;
    --bg-card: #FFFFFF;
    --bg-hover: #FFF0F5;
    
    /* 文字色 */
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --text-light: #A0AEC0;
    
    /* 边框和阴影 */
    --border: #FFE4E6;
    --shadow-sm: 0 2px 8px rgba(255, 107, 157, 0.1);
    --shadow-md: 0 4px 16px rgba(255, 107, 157, 0.15);
    --shadow-lg: 0 8px 32px rgba(255, 107, 157, 0.2);
    
    /* 圆角 */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;
    --radius-xl: 50px;
    
    /* 字体 */
    --font-main: 'Quicksand', 'Microsoft YaHei', sans-serif;
}

body {
    font-family: var(--font-main);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========================================
   气泡背景动画
   ======================================== */

.bubble-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bubble-bg::before,
.bubble-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

.bubble-bg::before {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-purple) 100%);
    opacity: 0.3;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.bubble-bg::after {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    opacity: 0.2;
    bottom: -150px;
    right: -150px;
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(50px, -50px) rotate(90deg); }
    50% { transform: translate(0, -100px) rotate(180deg); }
    75% { transform: translate(-50px, -50px) rotate(270deg); }
}

/* ========================================
   容器布局
   ======================================== */

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

/* ========================================
   头部样式
   ======================================== */

.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========================================
   主内容区
   ======================================== */

.main-content {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 30px;
    animation: fadeInUp 0.6s ease-out;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   卡片样式
   ======================================== */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.card-body {
    padding: 25px;
}

/* ========================================
   标签页切换
   ======================================== */

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

/* ========================================
   表单样式
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.textarea,
.select {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: all 0.3s ease;
    resize: vertical;
}

.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.1);
}

.textarea::placeholder {
    color: var(--text-light);
}

/* ========================================
   按钮样式
   ======================================== */

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: var(--radius-xl);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #8DD4AE 100%);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.btn-text,
.btn-loader {
    position: relative;
    z-index: 1;
}

/* ========================================
   上传区域
   ======================================== */

.upload-area {
    border: 3px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-hover);
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--primary);
    background: white;
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.1) 0%, rgba(195, 177, 225, 0.1) 100%);
    transform: scale(1.02);
}

.upload-placeholder {
    width: 100%;
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.upload-placeholder p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.upload-placeholder small {
    color: var(--text-light);
}

.upload-preview {
    width: 100%;
    height: 100%;
    position: relative;
}

.upload-preview img {
    max-width: 100%;
    max-height: 250px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* 多图预览网格 */
.upload-preview-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 10px;
}

.upload-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--bg-hover);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.upload-preview-item:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

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

.upload-preview-item .remove-btn {
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
}

.upload-preview-item .image-number {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.label-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 400;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* ========================================
   结果展示区
   ======================================== */

.result-container {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    text-align: center;
    color: var(--text-light);
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.empty-state small {
    font-size: 0.95rem;
}

.result-image-container {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.4s ease-out;
}

.result-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.result-image:hover {
    transform: scale(1.02);
}

.result-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 20px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.result-image-container:hover .result-actions {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: white;
    transform: translateY(-2px);
}

/* ========================================
   历史记录
   ======================================== */

.history-container {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}

.history-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.history-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.history-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.history-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 107, 157, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.history-overlay span {
    color: white;
    font-size: 1.5rem;
}

/* ========================================
   模态框
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

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

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.3s ease-out;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--primary-dark);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
}

.modal-body img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 200px;
}

/* ========================================
   Toast 提示
   ======================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid var(--secondary);
}

.toast.error {
    border-left: 4px solid var(--primary);
}

.toast.info {
    border-left: 4px solid var(--accent);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

/* ========================================
   加载动画
   ======================================== */

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* ========================================
   动画效果
   ======================================== */

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

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

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main-content {
        gap: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .modal-content {
        max-width: 95%;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .toast {
        min-width: 250px;
    }
    
    .toast-container {
        right: 10px;
        left: 10px;
    }
}