/* =====================================================================
   PromptShop AI — components.css
   Elementos reutilizáveis entre módulos: botões, badges, painéis,
   listas e estados vazios.
   ===================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn--gold {
    background: var(--gradient-primary);
    color: var(--primary-ink);
    box-shadow: 0 4px 18px -6px var(--primary-glow);
}

.btn--gold:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 22px -4px var(--primary-glow);
}

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn--ghost:hover {
    border-color: var(--primary-bright);
    color: var(--primary-bright);
}

.btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn--danger {
    color: #e5787c;
}

.btn--danger:hover {
    border-color: #e5787c;
    color: #f0a1a4;
}

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(124, 92, 255, .14);
    color: var(--primary-bright);
    border: 1px solid rgba(124, 92, 255, .28);
}

.badge--mono {
    font-family: var(--font-mono);
    background: rgba(201, 162, 75, .12);
    color: var(--gold-bright);
    border-color: rgba(201, 162, 75, .3);
}

/* ---------------------------------------------------------------------
   Painéis
   --------------------------------------------------------------------- */

.panel {
    background: rgba(19, 19, 32, .6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.panel__header {
    margin-bottom: 12px;
}

.panel__title {
    font-size: 15px;
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Listas
   --------------------------------------------------------------------- */

.list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.list__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.list__item-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.list__item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list__item-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------------
   Skeleton loading (usado no lugar do texto "Carregando..." nas listas)
   --------------------------------------------------------------------- */

@keyframes ps-skeleton-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.skeleton-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

.skeleton-card__image {
    aspect-ratio: 9 / 16;
    background: linear-gradient(90deg, var(--surface-raised) 25%, var(--border-strong) 37%, var(--surface-raised) 63%);
    background-size: 200% 100%;
    animation: ps-skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-line {
    height: 12px;
    margin: 12px 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--surface-raised) 25%, var(--border-strong) 37%, var(--surface-raised) 63%);
    background-size: 200% 100%;
    animation: ps-skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-line--60 { width: 60%; }
.skeleton-line--40 { width: 40%; }

.skeleton-list-row {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.skeleton-list-row .skeleton-line {
    margin: 8px 0;
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-card__image,
    .skeleton-line {
        animation: none;
    }
}

/* ---------------------------------------------------------------------
   Scrollbar customizada (blocos de prompt)
   --------------------------------------------------------------------- */

.prompt-block__body {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.prompt-block__body::-webkit-scrollbar {
    width: 8px;
}

.prompt-block__body::-webkit-scrollbar-track {
    background: transparent;
}

.prompt-block__body::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: 8px;
}

.prompt-block__body::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-bright);
}

/* ---------------------------------------------------------------------
   Estado vazio
   --------------------------------------------------------------------- */

.empty-state {
    padding: 20px 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.empty-state span {
    font-size: 13px;
    color: var(--text-muted);
}

.empty-state--full {
    min-height: 40vh;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ---------------------------------------------------------------------
   Bloco de prompt (usado em Minha Modelo, Gerador, Variações, Biblioteca)
   --------------------------------------------------------------------- */

.prompt-block {
    position: relative;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.prompt-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
}

.prompt-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.prompt-block__label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.prompt-block__body {
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow-y: auto;
}

/* ---------------------------------------------------------------------
   Toast de feedback (ex: "Prompt copiado!")
   --------------------------------------------------------------------- */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 12px);
    background: var(--gradient-primary);
    color: var(--primary-ink);
    font-weight: 600;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px -6px var(--primary-glow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 100;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------------------------------------------------------------------
   Barra de ferramentas (busca + filtros) — reutilizável entre módulos
   --------------------------------------------------------------------- */

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.input {
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    padding: 10px 14px;
    width: 100%;
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--primary-bright);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input--select {
    max-width: 220px;
    cursor: pointer;
}

textarea.input {
    resize: vertical;
    min-height: 72px;
}

/* ---------------------------------------------------------------------
   Formulários (modais de cadastro/edição)
   --------------------------------------------------------------------- */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-error {
    font-size: 13px;
    color: #e5787c;
    margin: -6px 0 16px;
}

.image-preview {
    margin-top: 10px;
    width: 96px;
    height: 96px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-strong);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview--portrait {
    width: 96px;
    height: 171px;
}

.form-hint {
    font-size: 12px;
    color: var(--gold-bright);
    margin: 6px 0 0;
    line-height: 1.5;
}

/* ---------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 7, 0.72);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility 0s linear .2s;
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .2s ease;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(12px) scale(.98);
    transition: transform .22s cubic-bezier(.16, 1, .3, 1);
}

.modal-overlay.is-open .modal {
    transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal {
        transition: none;
    }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal__title {
    font-size: 17px;
    font-weight: 700;
}

.modal__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.modal__close:hover {
    color: var(--text);
}

.modal__body {
    padding: 24px;
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}
