/**
 * AI试衣功能样式
 */

/* 按钮区域样式 */
.modal-actions .action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.try-on-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
    position: relative;
    overflow: hidden;
}

.try-on-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.try-on-btn:hover::before {
    left: 100%;
}

.try-on-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}

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

.try-on-btn i {
    font-size: 1.2rem;
}

/* 试衣模态框样式 */
.try-on-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
    overflow-y: auto;
}

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

.try-on-modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.try-on-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #f0f0f0;
}

.try-on-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.try-on-modal-title i {
    color: #f5576c;
}

.try-on-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.try-on-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.try-on-modal-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.try-on-step {
    margin-bottom: 2rem;
}

.step-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

.step-hint {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* 加载容器 */
.loading-container {
    text-align: center;
    padding: 3rem 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #f5576c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-spinner-large {
    width: 60px;
    height: 60px;
    border: 5px solid #f0f0f0;
    border-top-color: #f5576c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

/* 错误消息 */
.error-message {
    background: #fee;
    color: #c33;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.error-container {
    text-align: center;
    padding: 3rem 1rem;
}

.error-container i {
    font-size: 3rem;
    color: #f5576c;
    margin-bottom: 1rem;
}

.error-container p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* 款式网格 */
.styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.style-card {
    position: relative;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.style-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #f5576c;
}

.style-card.selected {
    border-color: #f5576c;
    box-shadow: 0 0 0 3px rgba(245, 87, 108, 0.2);
}

.style-preview {
    width: 100%;
    height: 120px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.style-placeholder {
    color: #ccc;
    font-size: 2rem;
}

.style-info {
    padding: 0.75rem;
    text-align: center;
}

.style-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.style-color {
    font-size: 0.8rem;
    color: #666;
}

.selected-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #f5576c;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
}

.upload-area:hover {
    border-color: #f5576c;
    background: #fff5f7;
}

.upload-area.has-image {
    border: none;
    padding: 0;
    background: transparent;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-placeholder i {
    font-size: 4rem;
    color: #d0d0d0;
}

.upload-placeholder p {
    color: #666;
    margin: 0;
}

.upload-hint {
    font-size: 0.85rem;
    color: #999;
}

.file-input {
    display: none;
}

.upload-btn {
    display: inline-block;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.uploaded-preview {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
}

.uploaded-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* 处理中容器 */
.processing-container {
    text-align: center;
    padding: 3rem 1rem;
}

.processing-container p {
    color: #666;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f093fb, #f5576c);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* 结果容器 */
.result-container {
    text-align: center;
}

.result-image {
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    height: auto;
    object-fit: contain;
}

.result-error {
    color: #ef4444;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.result-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #4a90e2;
    text-decoration: underline;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.result-btn {
    padding: 0.75rem 2rem;
    border-radius: 25px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.share-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.retry-btn {
    background: #f5f5f5;
    color: #333;
}

.retry-btn:hover {
    background: #e0e0e0;
}

/* 错误操作按钮组 */
.error-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

.check-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.check-btn:hover {
    background: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

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

/* 模态框底部 */
.try-on-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.start-try-on-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.start-try-on-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.start-try-on-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cancel-btn {
    background: #f5f5f5;
    color: #333;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: #e0e0e0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .try-on-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .try-on-modal-header,
    .try-on-modal-body,
    .try-on-modal-footer {
        padding: 1rem;
    }

    .styles-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
        max-height: 300px;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .modal-actions .action-buttons {
        flex-direction: column;
        width: 100%;
        align-items: center; /* 确保按钮在容器中居中 */
    }

    .try-on-btn,
    .generate-card-btn {
        width: 100%;
        max-width: 280px;
        margin: 0 auto; /* 居中显示 */
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 1.2rem 1.5rem;
        font-size: 1rem;
    }
    
    .try-on-btn i {
        font-size: 1.3rem;
        margin-right: 0.5rem;
    }

    .result-actions {
        flex-direction: column;
        width: 100%;
    }

    .result-btn {
        width: 100%;
        justify-content: center;
    }

    .result-image {
        max-width: 100%;
        max-height: 60vh;
    }

    .try-on-modal-footer {
        flex-direction: column;
    }

    .start-try-on-btn,
    .cancel-btn {
        width: 100%;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .try-on-btn {
        font-size: 0.95rem;
        padding: 1rem 1.2rem;
    }
    
    .try-on-btn i {
        font-size: 1.2rem;
    }
}
