/* grid-builder.css — editor visual da grelha do Nível 3 (dividir célula ao
   clicar, arrastar fronteiras para redimensionar, régua para remover
   faixas). Vive dentro do "Configurar Bloco" quando o bloco selecionado é
   Nível 2 (free). */

#gridBuilderSection {
    margin-top: 4px;
}

#gridBuilderWidget {
    position: relative;
    width: 100%;
    max-width: 260px;
    margin: 8px auto 24px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.nv-gb-grid {
    position: absolute;
    inset: 0;
    display: grid;
}

.nv-gb-cell {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    overflow: hidden;
}

.nv-gb-cell:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.nv-gb-split-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    cursor: pointer;
    z-index: 2;
}

.nv-gb-cell:hover .nv-gb-split-btn {
    display: flex;
}

.nv-gb-split-btn:hover {
    background: var(--accent);
}

.nv-gb-split-btn--h {
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}

.nv-gb-split-btn--v {
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* Apagar célula — só quando já há 2+ células (ver grid-builder-panel.js:
   cells.length === 1 decide entre isto e os botões de dividir acima),
   centrado na célula, mesmo padrão visual/hover dos botões de dividir. */
.nv-gb-remove-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    z-index: 2;
}

.nv-gb-cell:hover .nv-gb-remove-btn {
    display: flex;
}

.nv-gb-remove-btn:hover {
    background: var(--danger);
}

/* Pega de redimensionamento entre duas faixas adjacentes — sobreposta à
   fronteira, com uma faixa de tolerância maior que a linha visual para
   ser fácil de agarrar. */
.nv-gb-handle {
    position: absolute;
    z-index: 3;
    background: transparent;
}

.nv-gb-handle--col {
    top: 0;
    bottom: 0;
    width: 10px;
    margin-left: -5px;
    cursor: col-resize;
}

.nv-gb-handle--row {
    left: 0;
    right: 0;
    height: 10px;
    margin-top: -5px;
    cursor: row-resize;
}

.nv-gb-handle:hover,
.nv-gb-handle:active {
    background: rgba(34, 197, 94, 0.35);
}

#gridBuilderStart {
    width: 100%;
}

/* Campos "Columns/Rows Template" — atalho manual sobre o MESMO modelo do
   editor visual acima (só pesos separados por espaço, ex: "1 1 1 1"; ver
   grid-model.js: tracksToText/parseTracksText), não CSS livre. Também é
   aqui que se remove uma faixa (apagar um número da lista) — sem botão
   dedicado nenhum. */
.nv-gb-template-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.nv-gb-template-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nv-gb-template-field label {
    flex: 0 0 62px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.25;
}

.nv-gb-template-field input {
    flex: 1 1 auto;
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.nv-gb-template-field input:focus {
    border-color: var(--accent);
    outline: none;
}
