/**
 * RDAI Poster Generator - 前端样式
 */

.rdai-poster-generator-wrapper {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.rdai-poster-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* 表单区域 */
.rdai-poster-form-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.rdai-poster-form-section h2 {
    margin: 0 0 10px 0;
    color: #1a1a1a;
    font-size: 28px;
}

.rdai-poster-form-section .subtitle {
    color: #666;
    margin: 0 0 30px 0;
    font-size: 16px;
}

/* 表单样式 */
.rdai-poster-form .form-group {
    margin-bottom: 25px;
}

.rdai-poster-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.rdai-poster-form .required {
    color: #ff4444;
}

.rdai-poster-form input[type="text"],
.rdai-poster-form input[type="url"],
.rdai-poster-form input[type="email"],
.rdai-poster-form input[type="tel"],
.rdai-poster-form input[type="datetime-local"],
.rdai-poster-form select,
.rdai-poster-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.rdai-poster-form textarea {
    resize: vertical;
    min-height: 80px;
}

.rdai-poster-form input:focus,
.rdai-poster-form select:focus,
.rdai-poster-form textarea:focus {
    outline: none;
    border-color: #0066ff;
}

.rdai-poster-form .char-counter {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* 图片上传区域 */
.image-upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-upload {
    padding: 10px 20px;
    background: #0066ff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.3s;
}

.btn-upload:hover {
    background: #0052cc;
}

.or-text {
    color: #999;
    font-size: 14px;
}

.image-upload-area input[type="url"] {
    flex: 1;
}

.image-preview {
    margin-top: 15px;
    position: relative;
    display: inline-block;
}

.image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid #e5e5e5;
}

.image-preview .btn-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ff4444;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

/* 要点列表 */
.keypoints-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.keypoint-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.keypoint-number {
    width: 28px;
    height: 28px;
    background: #0066ff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.keypoint-item input {
    flex: 1;
}

/* 描述文字 */
.description {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #666;
}

/* 操作按钮 */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #0066ff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0052cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,102,255,0.3);
}

.btn-success {
    background: #00d4aa;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #00b894;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,212,170,0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 预览区域 */
.rdai-poster-preview-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    position: sticky;
    top: 20px;
}

.rdai-poster-preview-section h3 {
    margin: 0 0 20px 0;
    color: #1a1a1a;
    font-size: 22px;
}

.preview-tips {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.preview-tips p {
    margin: 0;
    font-size: 16px;
}

.poster-preview-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    overflow: hidden;
}

#poster-canvas {
    margin: 0 auto;
    display: block;
    transform-origin: top center;
}

/* 加载指示器 */
.loading-indicator {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0066ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    color: #666;
    margin: 0;
}

/* 移动端响应式 */
@media (max-width: 1024px) {
    .rdai-poster-container {
        grid-template-columns: 1fr;
    }

    .rdai-poster-preview-section {
        position: static;
    }
}

/* 图片裁切弹窗 */
.crop-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.crop-modal.active {
    display: flex;
}

.crop-modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
}

.crop-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.crop-modal-header h3 {
    margin: 0;
    color: #1a1a1a;
    font-size: 22px;
}

.crop-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #666;
    transition: all 0.3s;
}

.crop-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.crop-container {
    max-width: 700px;
    max-height: 500px;
    margin: 0 auto 20px;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
}

.crop-container img {
    max-width: 100%;
    display: block;
}

.crop-info {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.crop-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.crop-actions .btn {
    flex: 0 0 auto;
    min-width: 120px;
}

/* 移动端响应式 */
@media (max-width: 1024px) {
    .rdai-poster-container {
        grid-template-columns: 1fr;
    }

    .rdai-poster-preview-section {
        position: static;
    }
}

@media (max-width: 768px) {
    .rdai-poster-generator-wrapper {
        padding: 0 15px;
        margin: 20px auto;
    }

    .rdai-poster-form-section,
    .rdai-poster-preview-section {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .image-upload-area {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-upload {
        width: 100%;
    }

    .crop-modal-content {
        padding: 20px;
        max-width: 95%;
        max-height: 95%;
    }

    .crop-container {
        max-height: 300px;
    }
}
