/* AI Quiz System — Image Generator Styles
   Developed by Omomo Excellence in corporation with Darapet Technology */

/* ── Wrapper ── */
.aqs-imagegen-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 60px;
}

/* ── Hero ── */
.aqs-imagegen-hero {
    background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(167,139,250,0.08) 100%);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 24px;
}
.aqs-imagegen-hero-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}
.aqs-imagegen-hero-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}
.aqs-imagegen-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 6px;
    line-height: 1.2;
}
.aqs-imagegen-sub {
    color: #475569;
    margin: 0 0 4px;
    font-size: 0.95rem;
    line-height: 1.5;
}
.aqs-imagegen-credit {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 0;
}

/* ── Prompt Card ── */
.aqs-imagegen-prompt-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.aqs-imagegen-prompt-row { margin-bottom: 16px; }
.aqs-imagegen-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.97rem;
    font-family: inherit;
    resize: none;
    line-height: 1.55;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s;
    min-height: 80px;
}
.aqs-imagegen-textarea:focus {
    outline: none;
    border-color: #6366f1;
    background: #fff;
}

/* ── Presets ── */
.aqs-imagegen-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}
.aqs-ig-preset-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    margin-right: 4px;
}
.aqs-ig-preset {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.aqs-ig-preset:hover { border-color: #6366f1; color: #6366f1; background: rgba(99,102,241,0.05); }
.aqs-ig-preset.active { background: #6366f1; border-color: #6366f1; color: #fff; }

/* ── Options row ── */
.aqs-imagegen-options {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.aqs-ig-option-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}
.aqs-ig-option-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.aqs-ig-option-group select {
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.88rem;
    background: #f8fafc;
    color: #1e293b;
    cursor: pointer;
    font-family: inherit;
}
.aqs-ig-option-group select:focus { outline: none; border-color: #6366f1; }

/* ── Actions ── */
.aqs-imagegen-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.aqs-ig-generate-btn {
    padding: 11px 24px;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    border: none;
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.aqs-ig-generate-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.35); }
.aqs-ig-generate-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.aqs-ig-enhance-btn {
    padding: 10px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(99,102,241,0.08);
    border: 1.5px solid rgba(99,102,241,0.3);
    color: #6366f1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.aqs-ig-enhance-btn:hover:not(:disabled) { background: rgba(99,102,241,0.15); }
.aqs-ig-enhance-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.aqs-ig-clear-btn {
    padding: 10px 16px;
    font-size: 0.88rem;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    color: #64748b;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 600;
}
.aqs-ig-clear-btn:hover { background: #e2e8f0; }

/* ── Spin animation ── */
@keyframes aqs-ig-spin { to { transform: rotate(360deg); } }
.aqs-ig-spin { animation: aqs-ig-spin 0.7s linear infinite; }

/* ── Status ── */
.aqs-ig-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(167,139,250,0.05));
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 12px;
    margin-bottom: 16px;
    color: #6366f1;
    font-weight: 600;
    font-size: 0.93rem;
}
.aqs-ig-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(99,102,241,0.25);
    border-top-color: #6366f1;
    border-radius: 50%;
    flex-shrink: 0;
    animation: aqs-ig-spin 0.75s linear infinite;
}

/* ── Error ── */
.aqs-ig-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ── Results ── */
.aqs-ig-results-header, .aqs-ig-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.aqs-ig-results-header h3, .aqs-ig-history-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* ── Image grid ── */
.aqs-ig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

/* ── Image card ── */
.aqs-ig-card {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}
.aqs-ig-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.12); transform: translateY(-2px); }
.aqs-ig-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    flex: 1;
    cursor: zoom-in;
}
.aqs-ig-card.loading {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f0f4ff, #ede9fe);
    animation: aqs-ig-shimmer 1.5s ease-in-out infinite;
}
@keyframes aqs-ig-shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.aqs-ig-card-shimmer {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #6366f1;
    font-size: 0.85rem;
    font-weight: 600;
}
.aqs-ig-card-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(99,102,241,0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: aqs-ig-spin 0.75s linear infinite;
}
.aqs-ig-card-err {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    font-size: 0.83rem;
    color: #ef4444;
    line-height: 1.5;
}
.aqs-ig-card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    align-items: center;
}
.aqs-ig-card:hover .aqs-ig-card-actions { opacity: 1; }
.aqs-ig-card-actions .aqs-btn {
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: 6px;
}
.aqs-ig-card-actions .aqs-btn-primary { background: #6366f1; color: #fff; border: none; }

/* ── History card ── */
.aqs-ig-hist-card { aspect-ratio: 1; }
.aqs-ig-hist-card .aqs-ig-card-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}
.aqs-ig-hist-card:hover .aqs-ig-card-actions { opacity: 1; }
.aqs-ig-hist-prompt {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.9);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.aqs-imagegen-history-section { margin-top: 8px; }

/* ── Lightbox ── */
.aqs-ig-lb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 9998;
}
.aqs-ig-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 16px;
}
.aqs-ig-lightbox img {
    max-width: min(90vw, 800px);
    max-height: 70vh;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.aqs-ig-lb-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 10000;
}
.aqs-ig-lb-close:hover { background: rgba(255,255,255,0.25); }
.aqs-ig-lb-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.aqs-ig-lb-actions .aqs-btn {
    font-size: 0.9rem;
    padding: 9px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.aqs-ig-lb-actions .aqs-btn-primary { background: #6366f1; color: #fff; }
.aqs-ig-lb-actions .aqs-btn:not(.aqs-btn-primary) { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.aqs-ig-lb-prompt {
    max-width: 600px;
    text-align: center;
    font-size: 0.83rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.5;
    padding: 0 16px;
}

/* ── Image gen nav highlight ── */
.aqs-site-nav-imagegen {
    background: rgba(167,139,250,0.1);
    border-radius: 8px;
    color: #7c3aed !important;
}
.aqs-site-nav-imagegen:hover { background: rgba(167,139,250,0.2) !important; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .aqs-imagegen-hero-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
    .aqs-imagegen-hero { padding: 20px; }
    .aqs-imagegen-title { font-size: 1.3rem; }
    .aqs-imagegen-options { flex-direction: column; }
    .aqs-ig-option-group { min-width: 100%; }
    .aqs-ig-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
}
