/* ==================== 图片生成器样式 ==================== */

.image-generator-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    padding: 24px 28px 40px;
    background: var(--bg);
    overflow-y: auto;
}

.image-generator-inner {
    width: min(960px, 100%);
    margin: 0 auto;
}

.ig-header {
    margin-bottom: 18px;
}

.ig-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--text);
}

.ig-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* ===== 模式切换 ===== */
.ig-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel) 76%, transparent);
    border: 1px solid color-mix(in srgb, var(--line-soft) 78%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

.ig-tab {
    min-height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ig-tab:hover {
    background: color-mix(in srgb, var(--panel) 80%, transparent);
    color: var(--text);
}

.ig-tab.active {
    background: var(--panel);
    border-color: transparent;
    color: var(--text);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

/* ===== 结果展示区 ===== */
.ig-result-area {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    padding: 16px;
    overflow: hidden;
}

.ig-result-area img {
    max-width: 100%;
    max-height: 520px;
    border-radius: 10px;
    cursor: zoom-in;
    display: block;
}

.ig-placeholder {
    color: var(--muted-2);
    text-align: center;
    font-size: 14px;
}

.ig-result-actions {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ig-result-actions .btn {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

/* ===== 加载动画 ===== */
.ig-loading {
    text-align: center;
    color: var(--muted);
}

.ig-spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 14px;
    border: 3px solid var(--line-soft);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: ig-spin 1s linear infinite;
}

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

.ig-loading p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

/* ===== 多图参考网格 ===== */
.ig-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border: 2px dashed var(--line);
    border-radius: 14px;
    background: var(--panel-muted);
    transition: border-color .2s ease, background-color .2s ease;
}

.ig-ref-grid.drag-over {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.ig-ref-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line-soft);
}

.ig-ref-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ig-ref-thumb .ig-remove-ref {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(215, 0, 21, .85);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-ref-thumb .ig-remove-ref:hover {
    background: var(--red);
}

.ig-ref-add {
    aspect-ratio: 1;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    transition: all .2s ease;
}

.ig-ref-add:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-soft);
}

.ig-ref-add-plus {
    font-size: 22px;
    line-height: 1;
    font-weight: 300;
}

.ig-ref-add-text {
    text-align: center;
    font-size: 11px;
}

.ig-ref-add-text small {
    color: var(--muted-2);
    font-size: 10px;
}

/* ===== 实际生效参数对比 ===== */
.ig-actual-params {
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--panel-muted);
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    font-size: 12px;
    color: var(--muted);
}

.ig-actual-params-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    font-size: 12px;
}

.ig-actual-params-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ig-actual-params-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ig-actual-params-item .label {
    color: var(--muted-2);
}

.ig-actual-params-item .value {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ig-actual-params-item.diff .value {
    color: var(--red);
    font-weight: 600;
}

.ig-actual-params-item.diff .arrow {
    color: var(--muted-2);
}

.ig-time-info {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ig-time-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.ig-time-item .label {
    color: var(--muted-2);
}

.ig-time-item .value {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ig-revised-prompt {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
    font-size: 12px;
    color: var(--muted);
    line-height: 1.55;
    word-break: break-word;
}

.ig-revised-prompt b {
    color: var(--text);
    font-weight: 600;
}

/* ===== 多图结果展示 ===== */
.ig-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    width: 100%;
}

.ig-result-grid img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 10px;
    cursor: zoom-in;
    background: var(--panel-muted);
}

/* ===== 尺寸按钮 ===== */
.ig-size-btn {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s ease;
    min-width: 120px;
    text-align: left;
}

.ig-size-btn:hover {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

/* ===== 尺寸选择器模态框 ===== */
.ig-size-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .3);
    backdrop-filter: blur(4px);
}

.ig-size-modal-content {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    display: flex;
    flex-direction: column;
}

.ig-size-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line-soft);
}

.ig-size-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.ig-size-current {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.ig-size-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-modal-close:hover {
    background: var(--panel-muted);
    color: var(--text);
}

.ig-size-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.ig-size-mode-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--panel-muted);
    border-radius: 12px;
    margin-bottom: 20px;
}

.ig-size-mode-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-mode-tab:hover {
    color: var(--text);
}

.ig-size-mode-tab.active {
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.ig-size-mode-content {
    position: relative;
    min-height: 320px;
}

.ig-size-mode-panel {
    display: none;
}

.ig-size-mode-panel.active {
    display: block;
}

/* 自动模式 */
.ig-size-auto-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.ig-size-auto-hint svg {
    width: 48px;
    height: 48px;
    color: var(--blue);
    margin-bottom: 12px;
}

.ig-size-auto-hint h4 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.ig-size-auto-hint p {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
}

/* 按比例模式 */
.ig-size-section {
    margin-bottom: 20px;
}

.ig-size-section-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.ig-size-tier-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ig-size-tier-btn {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-tier-btn:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.ig-size-tier-btn.active {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
}

.ig-size-ratio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.ig-size-ratio-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-ratio-btn:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.ig-size-ratio-btn.active {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
}

.ig-size-ratio-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-size-ratio-icon > div {
    border: 1.5px solid currentColor;
    border-radius: 3px;
    opacity: .6;
}

/* 自定义宽高模式 */
.ig-size-custom-inputs {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.ig-size-custom-input-wrap {
    flex: 1;
}

.ig-size-custom-input-wrap label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--muted);
}

.ig-size-custom-input-wrap input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: all .2s ease;
}

.ig-size-custom-input-wrap input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.ig-size-custom-x {
    color: var(--muted-2);
    font-size: 14px;
    padding-bottom: 8px;
}

.ig-size-hint {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--panel-muted);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
}

.ig-size-hint svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--blue);
}

/* 预览区 */
.ig-size-preview {
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--panel-muted);
    border-radius: 12px;
}

.ig-size-preview-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}

.ig-size-preview-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.ig-size-modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--line-soft);
}

.ig-size-modal-footer .btn {
    flex: 1;
    min-height: 40px;
    font-size: 14px;
}

/* 移动端适配 */
@media (max-width: 560px) {
    .ig-size-modal {
        padding: 0;
    }

    .ig-size-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .ig-size-ratio-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.ig-params-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

.ig-param-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ig-param-group label {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    font-weight: 500;
}

.ig-param-group select,
.ig-param-group input {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
}

.ig-param-group select:focus,
.ig-param-group input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.ig-param-group.ig-param-disabled {
    opacity: .5;
}

.ig-param-group input:disabled {
    cursor: not-allowed;
    background: var(--panel-muted);
}

.ig-size-input {
    width: 76px;
    text-align: center;
}

/* ===== 输入区 ===== */
.ig-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 24px;
}

.ig-input-row textarea {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    height: 56px;
    outline: none;
    font-family: inherit;
}

.ig-input-row textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.ig-gen-btn {
    min-height: 56px;
    padding: 0 26px;
    border: none;
    border-radius: 14px;
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color .15s ease;
}

.ig-gen-btn:hover:not(:disabled) {
    background: var(--blue-hover);
}

.ig-gen-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ===== 历史记录 ===== */
.ig-history-section {
    margin-top: 24px;
}

.ig-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ig-history-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.ig-clear-btn {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--red);
    font-size: 12px;
    cursor: pointer;
    transition: all .15s ease;
}

.ig-clear-btn:hover {
    background: rgba(215, 0, 21, .08);
    border-color: rgba(215, 0, 21, .3);
}

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

.ig-history-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted-2);
    font-size: 13px;
    padding: 24px;
}

.ig-history-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: var(--panel-muted);
    border: 1px solid var(--line-soft);
}

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

.ig-history-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(215, 0, 21, .85);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
}

.ig-history-item:hover .ig-history-delete {
    display: flex;
}

/* ===== 移动端适配 ===== */
@media (max-width: 760px) {
    .image-generator-container {
        padding: 14px 12px 24px;
    }

    .image-generator-inner {
        width: 100%;
    }

    .ig-header {
        margin-bottom: 14px;
    }

    .ig-header h2 {
        font-size: 20px;
    }

    .ig-header p {
        font-size: 12px;
        line-height: 1.55;
    }

    .ig-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 4px;
        margin-bottom: 14px;
    }

    .ig-tab {
        width: 100%;
        min-height: 40px;
        padding: 0 8px;
        font-size: 13px;
    }

    .ig-result-area {
        min-height: 240px;
        margin-bottom: 14px;
        padding: 12px;
    }

    .ig-placeholder {
        font-size: 14px;
        line-height: 1.5;
        text-align: center;
    }

    .ig-params-row {
        gap: 10px;
        margin-bottom: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .ig-param-group {
        width: 100%;
        justify-content: space-between;
    }

    .ig-param-group select,
    .ig-param-group input {
        flex: 1;
        min-width: 0;
    }

    .ig-input-row {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 18px;
    }

    .ig-input-row textarea {
        height: 84px;
        font-size: 14px;
    }

    .ig-gen-btn {
        width: 100%;
        min-height: 48px;
    }

    .ig-history-section {
        margin-top: 18px;
    }

    .ig-history-header {
        align-items: center;
    }

    .ig-history-header h3 {
        font-size: 15px;
    }

    .ig-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
        gap: 8px;
    }

    .ig-history-item {
        border-radius: 12px;
    }
}

@media (max-width: 560px) {
    .ig-tabs {
        gap: 6px;
    }

    .ig-tab {
        font-size: 12px;
    }

    .ig-result-actions {
        flex-wrap: wrap;
    }

    .ig-history-delete {
        display: flex;
    }
}

