/* 教育图片生成器 - 前端样式 */

:root {
    --primary-color: #4a6fa5;
    --primary-dark: #3a5a8c;
    --secondary-color: #ff6b6b;
    --accent-color: #4ecdc4;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

/* 重置和基础样式 */
.gbe-generator-container * {
    box-sizing: border-box;
}

.gbe-generator-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
}

/* 标题区域 */
.gbe-header {
    text-align: center;
    margin: 40px 0 50px;
    padding: 0 20px;
}

.gbe-header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.gbe-header p {
    color: var(--dark-color);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    opacity: 0.9;
}

/* 主内容区域 */
.gbe-main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 50px;
    padding: 0 20px;
}

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

/* 生成器表单 */
.gbe-generator-form {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    transition: var(--transition);
}

.gbe-generator-form:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.gbe-form-section {
    margin-bottom: 25px;
}

.gbe-form-section h3 {
    color: var(--primary-color);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.3rem;
    font-weight: 600;
}

/* 表单行布局 */
.gbe-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .gbe-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* 表单组 */
.gbe-form-group {
    margin-bottom: 20px;
}

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

.gbe-form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
    color: var(--dark-color);
}

.gbe-form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.1);
}

.gbe-form-control::placeholder {
    color: #adb5bd;
}

/* 文本区域 */
.gbe-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
    font-family: inherit;
}

/* 示例区域 */
.gbe-examples-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

.gbe-examples-section h4 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}

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

@media (max-width: 768px) {
    .gbe-examples-grid {
        grid-template-columns: 1fr;
    }
}

/* 示例卡片 */
.gbe-example-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
    border-left: 3px solid var(--accent-color);
}

.gbe-example-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.gbe-example-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.gbe-example-description {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 40px;
}

.gbe-example-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-color);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.gbe-example-action:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* 比例选择器 */
.gbe-aspect-ratios {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.gbe-aspect-ratio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    color: var(--dark-color);
    user-select: none;
}

.gbe-aspect-ratio:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.gbe-aspect-ratio.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.gbe-aspect-ratio.active:hover {
    background: var(--primary-dark);
}

.gbe-ratio-icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* 文件上传区域 */
.gbe-file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    margin-top: 10px;
}

.gbe-file-upload:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.gbe-file-upload.dragover {
    background: rgba(74, 111, 165, 0.05);
    border-color: var(--primary-color);
    border-style: solid;
}

.gbe-upload-icon {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 15px;
    transition: var(--transition);
}

.gbe-file-upload:hover .gbe-upload-icon {
    color: var(--primary-color);
}

.gbe-file-preview {
    max-width: 100%;
}

.gbe-file-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

/* 操作按钮 */
.gbe-form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.gbe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 25px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1.5;
}

.gbe-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gbe-btn-primary {
    background: var(--primary-color);
    color: white;
}

.gbe-btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.gbe-btn-secondary {
    background: var(--light-color);
    color: var(--dark-color);
    border: 1px solid var(--border-color);
}

.gbe-btn-secondary:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
}

.gbe-btn-success {
    background: var(--success-color);
    color: white;
}

.gbe-btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.gbe-btn-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* 图片预览 */
.gbe-preview-section {
    margin-top: 30px;
    padding: 25px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: none;
    animation: fadeIn 0.5s ease;
}

.gbe-preview-section.show {
    display: block;
}

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

.gbe-preview-content {
    max-width: 800px;
    margin: 0 auto;
}

.gbe-preview-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    background: #f8f9fa;
    display: block;
}

.gbe-preview-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.gbe-info-item {
    display: flex;
    flex-direction: column;
}

.gbe-info-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.gbe-info-value {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
}

.gbe-preview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 侧边栏 */
.gbe-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.gbe-guide-section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.gbe-guide-section:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.gbe-guide-section h3 {
    color: var(--primary-color);
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.gbe-guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gbe-guide-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.gbe-guide-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.gbe-guide-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.gbe-guide-text {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    flex: 1;
}

/* 精选图片展示 */
.gbe-featured-section {
    margin: 50px 20px;
}

.gbe-section-title {
    text-align: center;
    margin-bottom: 40px;
}

.gbe-section-title h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.gbe-section-title p {
    color: #666;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.gbe-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

@media (max-width: 768px) {
    .gbe-featured-grid {
        grid-template-columns: 1fr;
    }
}

/* 精选卡片 */
.gbe-featured-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gbe-featured-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.gbe-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gbe-featured-card:hover .gbe-card-image {
    transform: scale(1.05);
}

.gbe-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gbe-card-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.gbe-card-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    line-height: 1;
}

.gbe-card-badge.subject {
    background: var(--primary-color);
}

.gbe-card-badge.grade {
    background: var(--accent-color);
}

.gbe-card-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
    line-height: 1.4;
    flex: 1;
}

.gbe-card-description {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.gbe-card-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

/* 加载状态 */
.gbe-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* 进度条 */
.gbe-progress {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin: 20px 0;
}

.gbe-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.gbe-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 消息提示 */
.gbe-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    animation: slideIn 0.3s ease;
    max-width: 350px;
    font-weight: 500;
}

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

.gbe-message.success {
    background: var(--success-color);
    color: white;
    border-left: 4px solid #1e7e34;
}

.gbe-message.error {
    background: var(--danger-color);
    color: white;
    border-left: 4px solid #bd2130;
}

.gbe-message.info {
    background: var(--warning-color);
    color: var(--dark-color);
    border-left: 4px solid #e0a800;
}

.gbe-message .close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.gbe-message .close-btn:hover {
    opacity: 1;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .gbe-header h1 {
        font-size: 2rem;
    }
    
    .gbe-header p {
        font-size: 1rem;
    }
    
    .gbe-generator-form {
        padding: 20px;
    }
    
    .gbe-form-actions {
        flex-direction: column;
    }
    
    .gbe-btn {
        width: 100%;
        justify-content: center;
    }
    
    .gbe-preview-actions {
        flex-direction: column;
    }
}

/* 无数据状态 */
.gbe-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.gbe-no-data .icon {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 15px;
}

/* 工具提示 */
.gbe-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.gbe-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 8px 12px;
    border-radius: 4px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    font-weight: normal;
}

.gbe-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark-color) transparent transparent transparent;
}

.gbe-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .gbe-generator-container {
        color: #e2e8f0;
        background: #1a202c;
    }
    
    .gbe-generator-form,
    .gbe-sidebar,
    .gbe-preview-section,
    .gbe-featured-card,
    .gbe-guide-section {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .gbe-form-control {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .gbe-form-control::placeholder {
        color: #a0aec0;
    }
    
    .gbe-examples-section {
        background: #4a5568;
    }
    
    .gbe-example-card {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .gbe-preview-info {
        background: #4a5568;
        border-color: #4a5568;
    }
    
    .gbe-guide-text {
        color: #cbd5e0;
    }
    
    .gbe-section-title p {
        color: #a0aec0;
    }
    
    .gbe-card-description {
        color: #a0aec0;
    }
}