/* ============================================================
   SUGESTÃO DE ALQUIMIA
   Página envolvida pelo tema escuro do site (style.css). Aqui só
   ficam os estilos específicos: barra de ferramentas, catálogo
   lateral, modais, e a "janela" da alquimia com a cara do jogo.
   ============================================================ */

.alq-page {
    padding-top: 20px;
}

.alq-intro {
    text-align: center;
    margin-bottom: 2rem;
}

.alq-intro h2 {
    font-size: 2.2rem;
    color: var(--sky);
    margin-bottom: 0.5rem;
}

.alq-intro h2 i {
    margin-right: 10px;
}

.alq-intro p {
    color: var(--muted);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

/* --- BARRA DE FERRAMENTAS --- */

.alq-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(20px);
}

.alq-toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.alq-toolbar-group label {
    font-size: 0.8rem;
    color: var(--muted);
}

.alq-toolbar-group label i {
    color: var(--sky);
    margin-right: 5px;
}

.alq-toolbar-group select,
.alq-toolbar-group input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.55rem 0.75rem;
    font-family: 'Inter', sans-serif;
    min-width: 160px;
}

.alq-toolbar-group select:focus,
.alq-toolbar-group input:focus {
    outline: none;
    border-color: var(--sky);
}

.alq-toolbar-actions {
    display: flex;
    gap: 0.6rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.alq-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1.1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: 0.25s;
}

.alq-btn-primary {
    background: linear-gradient(135deg, var(--sky), var(--sky-dark));
    color: #0b1220;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.alq-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.7);
}

.alq-btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border: 1px solid var(--border);
}

.alq-btn-ghost:hover {
    color: var(--sky);
    border-color: var(--sky);
}

.alq-btn-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #ff8a8a;
    border: 1px solid rgba(220, 53, 69, 0.4);
}

.alq-btn-danger:hover {
    background: rgba(220, 53, 69, 0.3);
}

.alq-status {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.alq-status.erro {
    color: #ff8a8a;
}

.alq-status.ok {
    color: #7ee787;
}

/* --- ESPAÇO DE TRABALHO --- */

.alq-workspace {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

/* Catálogo lateral (tema do site) */

.alq-catalogo {
    width: 280px;
    flex-shrink: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(20px);
    position: sticky;
    top: 100px;
}

.alq-catalogo h3 {
    color: var(--sky);
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.alq-busca {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    margin-bottom: 0.75rem;
    font-family: 'Inter', sans-serif;
}

.alq-busca:focus {
    outline: none;
    border-color: var(--sky);
}

.alq-lista-catalogo {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alq-item-catalogo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: grab;
    transition: 0.15s;
    border: 1px solid transparent;
}

.alq-item-catalogo:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--border);
}

.alq-item-catalogo img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}

.alq-item-catalogo span {
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alq-item-catalogo .alq-item-id {
    color: var(--muted);
    font-size: 0.72rem;
}

.alq-sem-resultado {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0;
}

.alq-lixeira {
    margin-top: 1rem;
    text-align: center;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px dashed rgba(220, 53, 69, 0.5);
    color: #ff8a8a;
    font-size: 0.8rem;
    transition: 0.2s;
}

.alq-lixeira.alq-drag-over {
    background: rgba(220, 53, 69, 0.25);
    border-style: solid;
}

/* --- JANELA ESTILO JOGO --- */

.alq-janela-wrap {
    flex: 1;
    min-width: 320px;
    display: flex;
    justify-content: center;
}

.alq-janela {
    width: 100%;
    max-width: 760px;
    background: linear-gradient(180deg, #f7edd8 0%, #ecdcb8 100%);
    border: 3px solid #a9793f;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 0 2px #fff7e6;
    padding: 0 0 16px;
    overflow: hidden;
}

.alq-janela-topo {
    background: linear-gradient(180deg, #caa666, #a9793f);
    color: #fff6e0;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: 1px;
    padding: 10px 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid #8a5f2c;
}

.alq-janela-abas {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px 8px;
    flex-wrap: wrap;
}

.alq-aba {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: 8px 8px 0 0;
    border: 1px solid #a9793f;
    border-bottom: none;
    background: #e2cd9c;
    color: #8a6a3d;
    cursor: not-allowed;
}

.alq-aba.ativa {
    background: #fbf3df;
    color: #6b3f16;
    cursor: default;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08) inset;
}

.alq-aba-info {
    margin-left: 12px;
    font-size: 0.78rem;
    color: #8a6a3d;
    font-style: italic;
}

.alq-grade {
    display: grid;
    grid-template-columns: 70px repeat(8, 1fr);
    gap: 6px;
    padding: 0 16px;
    margin-top: 4px;
}

.alq-rodada-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: #6b3f16;
    background: #e2cd9c;
    border-radius: 8px;
    text-align: center;
    padding: 4px;
}

.alq-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #ded4f0;
    border: 1px solid #b9a8dc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    overflow: hidden;
}

.alq-slot:hover {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
}

.alq-slot.alq-drag-over {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px #38bdf8;
    background: #cfe9fb;
}

.alq-slot.alq-vazio {
    background: rgba(222, 212, 240, 0.4);
}

.alq-slot.alq-vazio::after {
    content: "+";
    color: #b9a8dc;
    font-size: 1.4rem;
    font-weight: 700;
}

.alq-slot img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    image-rendering: pixelated;
}

.alq-slot .alq-slot-qtd {
    position: absolute;
    bottom: 2px;
    right: 3px;
    background: #1a1512;
    color: #ffd700;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 4px;
    border-radius: 6px;
    line-height: 1.3;
}

.alq-janela-rodape {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding: 10px 16px 0;
}

.alq-rodape-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: #6b3f16;
    background: #e2cd9c;
    padding: 6px 16px;
    border-radius: 20px;
}

.alq-rodape-valor {
    font-weight: 600;
    color: #38729c;
}

/* --- MODAIS --- */

.alq-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.alq-modal-overlay.aberto {
    display: flex;
}

.alq-modal {
    width: 92%;
    max-width: 440px;
    max-height: 82vh;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
}

.alq-modal-pequeno {
    max-width: 320px;
}

.alq-modal-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--sky);
    font-weight: 600;
}

.alq-modal-fechar {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.alq-modal-fechar:hover {
    color: var(--sky);
}

.alq-lista-menu {
    max-height: 50vh;
}

.alq-modal-dica {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.alq-sql-textarea {
    width: 100%;
    min-height: 260px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #7ee787;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.78rem;
    padding: 0.75rem;
    resize: vertical;
}

.alq-modal-acoes {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.alq-modal-slot-corpo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.alq-modal-slot-corpo img {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
}

.alq-slot-nome {
    color: var(--text);
    font-weight: 600;
    text-align: center;
}

.alq-qtd-controle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alq-qtd-controle button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
}

.alq-qtd-controle button:hover {
    border-color: var(--sky);
    color: var(--sky);
}

.alq-qtd-controle input {
    width: 70px;
    text-align: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}

.alq-modal-slot-corpo .alq-btn {
    width: 100%;
    justify-content: center;
}

/* --- RESPONSIVO --- */

@media (max-width: 900px) {
    .alq-workspace {
        flex-direction: column;
    }

    .alq-catalogo {
        width: 100%;
        position: static;
    }

    .alq-grade {
        grid-template-columns: 50px repeat(8, 1fr);
        gap: 4px;
    }
}

@media (max-width: 560px) {
    .alq-grade {
        grid-template-columns: repeat(4, 1fr);
    }

    .alq-rodada-label {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-left: 10px;
    }

    .alq-toolbar-actions {
        margin-left: 0;
        width: 100%;
    }
}
