/* ═══════════════════════════════════════════════════
   ZLH 生图 — 独立样式
   ═══════════════════════════════════════════════════ */

/* ── Section override ── */
#zlh-image-gen.section {
    padding: 0;
    overflow: hidden;
}

#zlh-image-gen.section.active {
    display: flex;
    flex-direction: column;
}

/* ── Guard ── */
.zig-guard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 100%;
    color: rgba(148, 163, 184, 0.45);
    font-size: 15px;
}

/* ── Panel ── */
.zig-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0b0d13;
}

/* ── Header ── */
.zig-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 36px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.zig-title {
    font-size: 22px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
    letter-spacing: -0.3px;
}

.zig-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: rgba(148, 163, 184, 0.7);
}

/* ── Body ── */
.zig-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Left Sidebar ── */
.zig-sidebar {
    width: 260px;
    flex-shrink: 0;
    padding: 24px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    background: rgba(255, 255, 255, 0.01);
}

.zig-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(148, 163, 184, 0.5);
    margin-bottom: 12px;
}

/* ── Model Cards ── */
.zig-model-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zig-model-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.2s ease;
}

.zig-model-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

.zig-model-card.active {
    border-color: rgba(43, 109, 229, 0.5);
    background: rgba(43, 109, 229, 0.1);
    box-shadow: 0 0 0 3px rgba(43, 109, 229, 0.08);
}

.zig-model-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(43, 109, 229, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #6ba3ff;
    flex-shrink: 0;
}

.zig-model-card.active .zig-model-card-icon {
    background: rgba(43, 109, 229, 0.25);
    color: #8db8ff;
}

.zig-model-card-info {
    min-width: 0;
}

.zig-model-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.3;
}

.zig-model-card-tag {
    font-size: 11px;
    color: rgba(148, 163, 184, 0.55);
    margin-top: 1px;
}

/* ── Ratio Grid ── */
.zig-ratio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.zig-ratio-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    color: rgba(148, 163, 184, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    font-family: inherit;
}

.zig-ratio-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
}

.zig-ratio-btn.active {
    border-color: rgba(43, 109, 229, 0.5);
    background: rgba(43, 109, 229, 0.1);
    color: #8db8ff;
}

.zig-ratio-icon {
    display: block;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    background: transparent;
}

/* ── Main Area ── */
.zig-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Prompt Area ── */
.zig-prompt-area {
    padding: 20px 36px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.zig-prompt-wrap {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.zig-prompt-input {
    flex: 1;
    min-height: 88px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.zig-prompt-input:focus {
    border-color: rgba(43, 109, 229, 0.5);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(43, 109, 229, 0.06);
}

.zig-prompt-input::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

.zig-generate-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    flex-shrink: 0;
    height: fit-content;
}

.zig-generate-btn:hover {
    opacity: 0.92;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35);
}

.zig-generate-btn:active {
    transform: scale(0.97);
}

.zig-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.zig-prompt-hint {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(148, 163, 184, 0.45);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Prompt Input Group (textarea + ref) ── */
.zig-prompt-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.zig-prompt-input-group .zig-prompt-input {
    min-height: 80px;
}

/* ── Reference Image Area ── */
.zig-ref-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zig-ref-upload {
    flex-shrink: 0;
}

.zig-ref-dropzone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 12px;
    color: rgba(148, 163, 184, 0.6);
    white-space: nowrap;
}

.zig-ref-dropzone:hover {
    border-color: rgba(43, 109, 229, 0.4);
    background: rgba(43, 109, 229, 0.05);
    color: #8db8ff;
}

.zig-ref-dropzone i {
    font-size: 14px;
}

.zig-ref-hint {
    color: rgba(148, 163, 184, 0.3);
    font-size: 11px;
}

.zig-ref-preview {
    position: relative;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zig-ref-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zig-ref-clear {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.zig-ref-clear:hover {
    background: rgba(239, 68, 68, 0.8);
}

.zig-ref-url-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.zig-ref-url-input:focus {
    border-color: rgba(43, 109, 229, 0.3);
}

.zig-ref-url-input::placeholder {
    color: rgba(148, 163, 184, 0.3);
}

/* ── Generating Indicator ── */
.zig-generating {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 36px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(43, 109, 229, 0.04);
}

.zig-generating-spinner {
    font-size: 20px;
    color: #6ba3ff;
}

.zig-generating-label {
    font-size: 14px;
    color: #cbd5e1;
    font-weight: 500;
}

.zig-generating-model {
    font-size: 12px;
    color: rgba(148, 163, 184, 0.55);
    margin-left: 8px;
}

/* ── Results ── */
.zig-results {
    flex: 1;
    overflow-y: auto;
    padding: 20px 36px 36px;
}

.zig-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.zig-results-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}

.zig-results-count {
    font-size: 12px;
    color: rgba(148, 163, 184, 0.5);
}

.zig-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ── Result Card ── */
.zig-result-card {
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.zig-result-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.zig-result-img-wrap {
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.zig-result-img {
    width: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.zig-result-card:hover .zig-result-img {
    transform: scale(1.03);
}

.zig-result-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 40%);
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    pointer-events: none;
    align-items: flex-end;
    padding: 12px;
}

.zig-result-card:hover .zig-result-overlay {
    opacity: 1;
}

.zig-result-dl-btn {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    pointer-events: auto;
    gap: 6px;
    transition: background 0.2s;
}

.zig-result-dl-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.zig-result-meta {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.zig-result-model {
    font-size: 11px;
    color: rgba(148, 163, 184, 0.5);
}

.zig-result-size {
    font-size: 11px;
    color: rgba(148, 163, 184, 0.4);
}

.zig-result-time {
    font-size: 11px;
    color: rgba(148, 163, 184, 0.35);
}

/* ── Empty State ── */
.zig-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
}

.zig-empty-icon {
    font-size: 48px;
    color: rgba(148, 163, 184, 0.15);
    margin-bottom: 16px;
}

.zig-empty-title {
    font-size: 16px;
    color: rgba(148, 163, 184, 0.45);
    font-weight: 500;
    margin: 0 0 6px;
}

.zig-empty-desc {
    font-size: 13px;
    color: rgba(148, 163, 184, 0.3);
    margin: 0;
    max-width: 360px;
    line-height: 1.5;
}

/* ── Scrollbar ── */
.zig-results::-webkit-scrollbar,
.zig-sidebar::-webkit-scrollbar {
    width: 4px;
}

.zig-results::-webkit-scrollbar-thumb,
.zig-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .zig-body {
        flex-direction: column;
    }
    .zig-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
        padding: 16px 20px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .zig-sidebar .zig-section {
        flex: 1;
        min-width: 180px;
    }
    .zig-prompt-area {
        padding: 16px 20px;
    }
    .zig-results {
        padding: 16px 20px 36px;
    }
}

/* ── Lightbox ── */
.zig-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zig-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.zig-lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: zigFadeIn 0.2s ease;
}

@keyframes zigFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.zig-lightbox-inner img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.5);
}

.zig-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10000;
}

.zig-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zig-lightbox-meta {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    text-align: center;
}

/* ── Result card clickable ── */
.zig-result-img {
    cursor: pointer;
}
