/* ==========================================================================
   GERADOR DE IMAGENS — estilos específicos desta página.
   Usa as variáveis de cor definidas em assets/hub.css (inclusive tema
   claro/escuro) para manter a mesma identidade visual do restante do site.
   ========================================================================== */

:root {
    --color-danger: #c23b3b;
    --color-danger-bg: rgba(194, 59, 59, 0.1);
}

:root[data-theme="dark"] {
    --color-danger: #e2726b;
    --color-danger-bg: rgba(226, 114, 107, 0.14);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-danger: #e2726b;
        --color-danger-bg: rgba(226, 114, 107, 0.14);
    }
}

/* ---------- Pilha vertical de cartões ----------
   Um único fluxo (prompt → dicas → resultado) em vez de duas colunas,
   para que cada cartão use toda a largura disponível na página. */
.generator-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* ---------- Cartões ---------- */
.panel-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    padding: 22px;
    box-shadow: var(--shadow-card);
}

.panel-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.panel-card-header h2, .panel-card-header h3 {
    font-size: 16.5px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--color-text);
}

.panel-card-header h2 i, .panel-card-header h3 i {
    color: var(--color-accent);
    font-size: 15px;
}

/* ---------- Campo de texto do prompt ---------- */
.prompt-input-wrapper { position: relative; margin-bottom: 16px; }

textarea, .custom-select, .custom-input {
    width: 100%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-s);
    padding: 12px 14px;
    color: var(--color-text);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { border-radius: var(--radius-m); padding: 14px; resize: vertical; }

textarea:focus, .custom-select:focus, .custom-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(47, 95, 216, 0.15);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-faint);
}

kbd {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: monospace;
}

/* ---------- Tags de estilo rápido ---------- */
.style-tags-container { margin-bottom: 20px; }

.tags-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tags-scroll { display: flex; flex-wrap: wrap; gap: 8px; }

.style-tag {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s ease;
}

.style-tag:hover {
    background: rgba(47, 95, 216, 0.1);
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
}

/* ---------- Opções de geração ---------- */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.option-group { display: flex; flex-direction: column; gap: 7px; }

.option-group label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.option-group .option-hint {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--color-text-faint);
    margin-top: 2px;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-s);
    padding: 11px 14px;
    cursor: pointer;
    height: 100%;
}

.option-checkbox input { width: 16px; height: 16px; accent-color: var(--color-accent); cursor: pointer; }

/* ---------- Botões ---------- */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--color-accent);
    border: none;
    border-radius: var(--radius-s);
    color: #fff;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-primary:hover { background: var(--color-accent-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-content { display: flex; align-items: center; justify-content: center; gap: 9px; }

.btn-secondary {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-s);
    padding: 10px 16px;
    color: var(--color-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-accent-dark); }

.btn-text {
    background: none;
    border: none;
    color: var(--color-accent);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-text:hover { text-decoration: underline; }

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-s);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-icon:hover { border-color: var(--color-accent); color: var(--color-accent-dark); }

.btn-danger {
    background: var(--color-danger-bg);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: 9px 14px;
    border-radius: var(--radius-s);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-danger:hover { background: var(--color-danger); color: #fff; }

.result-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Área de exibição da imagem ---------- */
.result-card { min-height: 420px; display: flex; flex-direction: column; }

.image-display-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-m);
    padding: 20px;
    position: relative;
    overflow: hidden;
    min-height: 300px;
}

.state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    max-width: 480px;
    width: 100%;
}

.empty-illustration, .error-illustration {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--color-text-faint);
    margin-bottom: 6px;
}

.error-illustration { background: var(--color-danger-bg); border-color: transparent; color: var(--color-danger); }

.state-container h3 { margin: 0; font-size: 16px; color: var(--color-text); }
.state-container p { margin: 0; font-size: 13.5px; color: var(--color-text-muted); }

/* ---------- Spinner de carregamento ---------- */
.loader-spinner { position: relative; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; }

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-icon { font-size: 20px; color: var(--color-accent); }

.progress-bar-container {
    width: 100%;
    height: 5px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar { height: 100%; width: 0%; background: var(--color-accent); transition: width 0.3s ease; }

.timer-text { font-size: 12.5px; font-family: monospace; color: var(--color-text-muted); }

/* ---------- Imagem renderizada ---------- */
.image-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-m);
    overflow: hidden;
}

.image-wrapper img {
    max-width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: contain;
    border-radius: var(--radius-m);
    animation: fadeIn 0.3s ease;
}

.image-overlay { position: absolute; bottom: 10px; left: 10px; }

.image-tag {
    background: rgba(0, 0, 0, 0.65);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    color: #fff;
}

/* ---------- Console de diagnóstico ---------- */
.debug-console-wrapper {
    margin-top: 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-m);
    overflow: hidden;
    width: 100%;
}

.debug-console-wrapper details { padding: 10px 14px; }

.debug-console-wrapper summary {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.debug-console-wrapper summary i { color: var(--color-accent); margin-right: 6px; }

.debug-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.debug-log-output {
    margin-top: 10px;
    max-height: 160px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-s);
    padding: 10px;
    font-family: monospace;
    font-size: 11.5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-line { word-break: break-all; overflow-wrap: anywhere; line-height: 1.4; }
.log-line.info { color: var(--color-text-muted); }
.log-line.success { color: var(--color-ok); }
.log-line.warn { color: var(--color-warn); }
.log-line.error { color: var(--color-danger); }

/* ---------- Dicas laterais ---------- */
.tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 24px;
}

.tips-list li {
    font-size: 13px;
    color: var(--color-text-muted);
    position: relative;
    padding-left: 16px;
}

.tips-list li::before {
    content: "\2022";
    color: var(--color-accent);
    font-size: 16px;
    position: absolute;
    left: 0;
    top: -2px;
}

.tips-list strong { color: var(--color-text); }

/* ---------- Galeria do histórico ---------- */
.gallery-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    padding: 22px;
    box-shadow: var(--shadow-card);
    margin-top: 20px;
}

.gallery-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.gallery-section-header h2 {
    font-size: 16.5px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.gallery-section-header h2 i { color: var(--color-accent); font-size: 15px; }

.gallery-count { font-size: 12.5px; color: var(--color-text-muted); }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 20vw, 170px), 1fr));
    gap: 14px;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 16px;
    color: var(--color-text-faint);
    font-size: 13.5px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-m);
    overflow: hidden;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.gallery-item:hover { transform: scale(1.02); border-color: var(--color-accent); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75), transparent 65%);
    opacity: 0;
    display: flex;
    align-items: flex-end;
    padding: 9px;
    transition: opacity 0.15s ease;
}

.gallery-item:hover .gallery-item-overlay { opacity: 1; }

.gallery-item-prompt {
    font-size: 11px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Modais ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 16, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

.modal-card {
    max-width: 500px;
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    padding: 22px;
    box-shadow: var(--shadow-card-hover);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal-header h3 i { color: var(--color-accent); }

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 14px;
    margin-bottom: 20px;
    font-size: 13.5px;
    color: var(--color-text-muted);
}

.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 12.5px; font-weight: 700; color: var(--color-text-muted); }

.password-input-wrapper { position: relative; display: flex; align-items: center; }

.btn-icon-inside {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--color-text-faint);
    cursor: pointer;
}

.info-box {
    background: rgba(47, 95, 216, 0.08);
    border: 1px solid rgba(47, 95, 216, 0.2);
    border-radius: var(--radius-s);
    padding: 13px;
    display: flex;
    gap: 11px;
    font-size: 12.5px;
    color: var(--color-text);
}

.info-box i { color: var(--color-accent); font-size: 16px; margin-top: 2px; }
.info-box ol { margin: 6px 0 0 18px; padding: 0; }
.info-box a { color: var(--color-accent-dark); text-decoration: underline; }

.modal-footer { display: flex; justify-content: flex-end; gap: 10px; }

/* Lightbox */
.lightbox-container {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 10px;
}

.lightbox-container img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: var(--radius-m);
}

.lightbox-caption {
    margin-top: 14px;
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.lightbox-close { position: absolute; top: -40px; right: 0; z-index: 10; background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); color: #fff; }

/* ---------- Toasts ---------- */
.toast-container {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 13px 18px;
    border-radius: var(--radius-m);
    color: var(--color-text);
    font-size: 13.5px;
    box-shadow: var(--shadow-card-hover);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.25s ease;
}

.toast.success { border-left: 3px solid var(--color-ok); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.info { border-left: 3px solid var(--color-accent); }

.hidden { display: none !important; }

/* ---------- Animações ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ---------- Responsivo ---------- */
@media (max-width: 560px) {
    .panel-card, .gallery-section { padding: 16px; }
    .image-display-area { min-height: 260px; padding: 12px; }
    .image-wrapper img { max-height: 380px; }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { width: 100%; }
    .modal-card { padding: 18px; }
    .lightbox-container img { max-height: 62vh; }
}
