/* ===== AI Image Generator — Plugin CSS ===== */

.aig-wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Header ── */
.aig-header {
    margin-bottom: 24px;
}

.aig-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
}

.aig-title-icon {
    width: 28px;
    height: 28px;
    color: #6366f1;
}

.aig-subtitle {
    color: #6b7280;
    font-size: .9rem;
    margin: 0;
}

/* ── Message ── */
.aig-message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.aig-message-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.aig-message-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* ── Card ── */
.aig-form-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .06);
}

/* ── Section ── */
.aig-section {
    margin-bottom: 28px;
}

.aig-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.aig-step-badge {
    width: 24px;
    height: 24px;
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.aig-optional {
    font-weight: 400;
    color: #9ca3af;
    font-size: .8rem;
}

/* ── Prompt ── */
.aig-prompt-wrap {
    position: relative;
}

.aig-prompt-wrap textarea {
    width: 100%;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: .9rem;
    line-height: 1.6;
    color: #111827;
    resize: vertical;
    transition: border-color .2s;
    box-sizing: border-box;
}

.aig-prompt-wrap textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .1);
}

.aig-char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: .72rem;
    color: #9ca3af;
}

/* ── Translate chips ── */
.aig-translate-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: .8rem;
    color: #6366f1;
    font-weight: 500;
}

.aig-translate-chip svg {
    width: 16px;
    height: 16px;
}

.aig-translated-preview {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: .82rem;
}

.aig-translated-preview svg {
    width: 18px;
    height: 18px;
    color: #0284c7;
    flex-shrink: 0;
    margin-top: 2px;
}

.aig-translated-label {
    font-weight: 600;
    color: #0369a1;
    margin: 0 0 2px;
}

.aig-translated-text {
    color: #374151;
    margin: 0;
    line-height: 1.5;
}

/* ── Resolution ── */
.aig-resolution-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.aig-res-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 16px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all .15s;
    position: relative;
    background: #fff;
}

.aig-res-card:hover {
    border-color: #a5b4fc;
    background: #f5f3ff;
}

.aig-res-selected {
    border-color: #6366f1 !important;
    background: #eef2ff !important;
}

.aig-res-icon svg {
    width: 32px;
    height: 32px;
    color: #6b7280;
}

.aig-res-selected .aig-res-icon svg {
    color: #6366f1;
}

.aig-res-name {
    font-weight: 700;
    font-size: .88rem;
    color: #111827;
    margin: 0;
}

.aig-res-label {
    font-size: .75rem;
    color: #6b7280;
    margin: 0;
}

.aig-res-price {
    font-size: .82rem;
    font-weight: 600;
    color: #6366f1;
    margin: 0;
}

.aig-res-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: .65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    background: #d1fae5;
    color: #065f46;
}

.aig-badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.aig-badge-purple {
    background: #ede9fe;
    color: #6d28d9;
}

.aig-badge-gold {
    background: #fef9c3;
    color: #92400e;
}

/* ── Options row ── */
.aig-options-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.aig-option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aig-option-label {
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
}

.aig-num-btns,
.aig-format-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.aig-num-btn {
    padding: 5px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    background: #fff;
    cursor: pointer;
    transition: all .15s;
}

.aig-num-btn:hover {
    border-color: #a5b4fc;
    color: #6366f1;
}

.aig-num-active {
    border-color: #6366f1 !important;
    background: #eef2ff !important;
    color: #6366f1 !important;
}

/* ── Slider ── */
.aig-slider {
    width: 100%;
    accent-color: #6366f1;
    cursor: pointer;
}

.aig-slider-hint {
    font-size: .72rem;
    color: #9ca3af;
    margin: 0;
}

/* ── Cost sub ── */
.aig-cost-sub {
    font-size: .75rem;
    color: #7c3aed;
    margin: 4px 0 0;
}

/* ── Style chips ── */
.aig-style-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aig-style-chip {
    padding: 6px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    background: #f9fafb;
    transition: all .15s;
}

.aig-style-chip:hover {
    border-color: #a5b4fc;
    background: #eef2ff;
    color: #6366f1;
}

.aig-style-chip-active {
    border-color: #6366f1;
    background: #eef2ff;
    color: #6366f1;
}

/* ── Submit bar ── */
.aig-submit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    padding: 16px 20px;
}

.aig-cost-label {
    font-size: .8rem;
    font-weight: 600;
    color: #6d28d9;
    margin: 0 0 2px;
}

.aig-cost-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #4c1d95;
    margin: 0;
    line-height: 1;
}

.aig-cr {
    font-size: 1rem;
    font-weight: 500;
}

.aig-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, .35);
}

.aig-btn-primary:hover:not(:disabled) {
    opacity: .92;
    transform: translateY(-1px);
}

.aig-btn-primary:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.aig-btn-icon,
.aig-btn-spinner {
    width: 20px;
    height: 20px;
}

/* ── Spin animation ── */
@keyframes aig-spin {
    to {
        transform: rotate(360deg);
    }
}

.aig-spin {
    animation: aig-spin .8s linear infinite;
}

/* ── Progress ── */
.aig-progress-card {
    margin-top: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}

.aig-progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.aig-progress-icon {
    width: 22px;
    height: 22px;
    color: #6366f1;
}

.aig-progress-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.aig-progress-track {
    background: #e5e7eb;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.aig-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 999px;
    transition: width .5s ease;
}

.aig-progress-hint {
    margin: 10px 0 0;
    font-size: .78rem;
    color: #9ca3af;
    text-align: center;
}

/* ── Result ── */
.aig-result-card {
    margin-top: 24px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 16px;
    padding: 28px;
    text-align: center;
}

.aig-result-check {
    width: 56px;
    height: 56px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.aig-result-check svg {
    width: 28px;
    height: 28px;
    stroke: #16a34a;
}

.aig-result-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #15803d;
    margin: 0 0 20px;
}

/* ── Multi-image grid ── */
.aig-result-grid {
    margin-bottom: 20px;
}

.aig-grid-single {
    max-width: 600px;
    margin: 0 auto 20px;
}

.aig-grid-multi {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.aig-img-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
    background: #111;
}

.aig-result-img {
    width: 100%;
    display: block;
}

.aig-img-dl-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, .6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
    color: #fff;
}

.aig-img-item:hover .aig-img-dl-btn {
    opacity: 1;
}

.aig-img-dl-btn svg {
    width: 18px;
    height: 18px;
}

.aig-result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.aig-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: #16a34a;
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
    transition: background .15s;
}

.aig-btn-download svg {
    width: 18px;
    height: 18px;
}

.aig-btn-download:hover {
    background: #15803d;
    color: #fff;
}

.aig-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: #fff;
    color: #374151;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: all .15s;
}

.aig-btn-secondary svg {
    width: 18px;
    height: 18px;
}

.aig-btn-secondary:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f5f3ff;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .aig-resolution-grid {
        grid-template-columns: 1fr;
    }

    .aig-options-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .aig-submit-bar {
        flex-direction: column;
        gap: 14px;
        text-align: center;
    }

    .aig-form-card {
        padding: 18px;
    }
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}