/* ===== 图生提示词页面 - 左右分栏布局 ===== */

/* 页面主容器 - 垂直居中 */
.i2p-page {
    padding: 126px 32px 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
}

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

/* ===== 核心布局：左固定右自适应 ===== */
.i2p-section {
    margin-top: 0;
    display: flex;
    gap: 28px;
    align-items: start;
    animation: fadeSlideIn 0.5s ease-out 0.1s both;
}

/* 左栏 - 图片区，固定宽度 */
.i2p-left-panel {
    flex-shrink: 0;
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 右栏 - 提示词区，填满剩余空间 */
.i2p-right-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== 左栏：图片上传卡片 ===== */
.i2p-upload-card {
    background: var(--bg-card);
    border: 2px dashed var(--border-light);
    border-radius: 16px;
    padding: 8px;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.i2p-upload-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 30% 30%, rgba(59, 130, 246, 0.03) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

.i2p-upload-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.i2p-upload-card:hover::before {
    opacity: 1;
}

.i2p-upload-card.has-image {
    border-style: solid;
    border-color: var(--border-light);
    padding: 0;
    cursor: default;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    width: 350px;
    height: 290px;
    overflow: hidden;
}

.i2p-upload-card.has-image::before {
    opacity: 0;
}

.i2p-upload-card.drag-over {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.06);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 12px 40px rgba(0, 0, 0, 0.4);
    transform: scale(1.005);
}

.i2p-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
    min-height: 240px;
    border-radius: 12px;
    transition: background 0.3s;
}

.i2p-upload-card.has-image .i2p-upload-area {
    display: none;
}

.i2p-upload-icon {
    color: var(--text-muted);
    margin-bottom: 20px;
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
}

.i2p-upload-card:hover .i2p-upload-icon {
    opacity: 0.8;
    transform: translateY(-6px);
}

.i2p-upload-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.i2p-upload-subtext {
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* 图片预览 - 固定宽高，图片等比缩放居中 */
.i2p-image-preview {
    position: relative;
    width: 350px;
    height: 290px;
    border-radius: 14px;
    overflow: hidden;
    background: #0a0a0a;
}

.i2p-image-preview img {
    width: 350px;
    height: 290px;
    object-fit: contain;
    display: block;
}

.i2p-change-img {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, transform 0.2s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.i2p-image-preview:hover .i2p-change-img {
    opacity: 1;
}

.i2p-change-img:hover {
    background: rgba(59, 130, 246, 0.7);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* ===== 左栏：操作按钮行 ===== */
.i2p-actions-row {
    display: flex;
    gap: 12px;
}

/* 通用按钮 */
.i2p-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.i2p-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.i2p-btn:hover::after {
    opacity: 1;
}

.i2p-btn:hover {
    transform: translateY(-1px);
}

.i2p-btn:active {
    transform: translateY(0) scale(0.98);
}

.i2p-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.i2p-btn svg {
    flex-shrink: 0;
}

.i2p-btn .i2p-btn-text {
    text-align: left;
    line-height: 1.4;
    white-space: normal;
}

/* 截取按钮 */
.i2p-btn-capture {
    flex: 1;
    justify-content: center;
    border-color: var(--accent);
    color: var(--accent);
    font-size: 15px;
    height: 60px;
    padding: 13px 24px;
}

.i2p-btn-capture:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
}

/* 生成按钮 */
.i2p-btn-generate {
    flex: 1;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border: none;
    color: #fff;
    font-size: 15px;
    padding: 9px 24px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.i2p-btn-generate:hover {
    background: linear-gradient(135deg, #4f8cf7 0%, #8b5cf6 100%);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.i2p-btn-generate:active {
    transform: translateY(0) scale(0.98);
}

/* ===== 右栏：提示词输出卡片 ===== */
.i2p-output-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 390px;
}

.i2p-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.i2p-output-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.i2p-textarea {
    width: 100%;
    flex: 1;
    min-height: 200px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Noto Sans SC', -apple-system, sans-serif;
    line-height: 1.9;
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.i2p-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 12px rgba(0, 0, 0, 0.15);
}

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

/* 输出区操作按钮 */
.i2p-output-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.i2p-btn-copy {
    color: var(--accent);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.06);
}

.i2p-btn-copy:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--accent);
}

.i2p-btn-clear {
    color: var(--text-secondary);
}

.i2p-btn-save {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.i2p-btn-save:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.5);
}

/* ===== Loading ===== */
.i2p-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 14px;
    z-index: 5;
}

.i2p-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: i2pSpin 0.8s linear infinite;
    margin-bottom: 24px;
}

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

.i2p-loading-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
    letter-spacing: 0.3px;
}

/* ===== 页脚 ===== */
.i2p-page .site-footer {
    background: transparent;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .i2p-page {
        min-height: auto;
        justify-content: flex-start;
    }

    .i2p-section {
        flex-direction: column;
        gap: 24px;
    }

    .i2p-left-panel {
        width: 100%;
    }

    .i2p-upload-area {
        padding: 48px 24px;
        min-height: 200px;
    }

    .i2p-output-card {
        min-height: 280px;
    }

    .i2p-textarea {
        min-height: 160px;
    }
}

@media (max-width: 768px) {
    .i2p-page {
        padding: 24px 16px 0;
        min-height: auto;
        justify-content: flex-start;
    }

    .i2p-section {
        gap: 20px;
    }

    .i2p-upload-area {
        padding: 40px 20px;
        min-height: 160px;
    }

    .i2p-upload-icon svg {
        width: 36px;
        height: 36px;
    }

    .i2p-upload-text {
        font-size: 14px;
    }

    .i2p-actions-row {
        flex-direction: column;
    }

    .i2p-output-card {
        padding: 18px;
        min-height: auto;
    }

    .i2p-textarea {
        min-height: 140px;
    }

    .i2p-output-actions {
        flex-wrap: wrap;
    }

    .i2p-output-actions .i2p-btn {
        flex: 1;
        justify-content: center;
        min-width: calc(50% - 5px);
    }

    .i2p-btn-generate,
    .i2p-btn-capture {
        padding: 13px 20px;
    }

}
