/**
 * ferramentas.css v1.0
 * Estilos da Barra de Ferramentas Lateral
 * 
 * Uso: <link href="ferramentas.css" rel="stylesheet">
 */

/* ══════════════════════════════════════════════════════════════════
   VARIÁVEIS (complementa as do sistema)
   ══════════════════════════════════════════════════════════════════ */
:root {
    --toolbar-bg: #1c2128;
    --toolbar-btn-bg: #0f141a;
    --toolbar-btn-border: #2a3442;
    --toolbar-btn-hover: #243040;
}

/* ══════════════════════════════════════════════════════════════════
   LAYOUT - POSIÇÃO DA BARRA
   ══════════════════════════════════════════════════════════════════ */
.layout.toolbar-left .toolbar-container {
    order: 0;
}

.layout.toolbar-right .toolbar-container {
    order: 2;
}

.layout.toolbar-left .stage,
.layout.toolbar-right .stage {
    order: 1;
}

/* ══════════════════════════════════════════════════════════════════
   CONTAINER DA BARRA
   ══════════════════════════════════════════════════════════════════ */
.toolbar-container {
    width: 220px;
    min-width: 220px;
    background: var(--toolbar-bg);
    border-right: 1px solid var(--border, #1e242d);
    display: flex;
    flex-direction: column;
    user-select: none;
}

.layout.toolbar-right .toolbar-container {
    border-right: none;
    border-left: 1px solid var(--border, #1e242d);
}

/* ══════════════════════════════════════════════════════════════════
   CABEÇALHO DA BARRA (arrastar)
   ══════════════════════════════════════════════════════════════════ */
.toolbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--panel, #161b22);
    border-bottom: 1px solid var(--border, #1e242d);
    cursor: grab;
}

.toolbar-header:active {
    cursor: grabbing;
}

.toolbar-header .title {
    font-size: 12px;
    font-weight: 600;
    color: var(--mute, #8b949e);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toolbar-header .drag-hint {
    font-size: 16px;
    color: var(--mute, #8b949e);
    cursor: grab;
}

.toolbar-header .drag-hint:hover {
    color: var(--accent, #3ea6ff);
}

/* ══════════════════════════════════════════════════════════════════
   CONTAINER DE SEÇÕES
   ══════════════════════════════════════════════════════════════════ */
.toolbar-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

/* ══════════════════════════════════════════════════════════════════
   SEÇÃO INDIVIDUAL (com borda)
   ══════════════════════════════════════════════════════════════════ */
.toolbar-section {
    border: 1px solid var(--border, #1e242d);
    border-radius: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--mute, #8b949e);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-left: 4px;
}

/* ══════════════════════════════════════════════════════════════════
   CONTAINER DE BOTÕES - GRID ÚNICO DE 3 COLUNAS
   ══════════════════════════════════════════════════════════════════ */
.toolbar-buttons {
    --grid-cols: 3; /* ← Fácil de mudar para 4 */
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    gap: 6px;
    padding: 10px;
}

/* ══════════════════════════════════════════════════════════════════
   BOTÃO INDIVIDUAL
   ══════════════════════════════════════════════════════════════════ */
.tool-btn {
    width: 100%;
    min-width: 0; /* Importante para truncar texto no grid */
    height: 65px;
    background: var(--toolbar-btn-bg);
    border: 1px solid var(--toolbar-btn-border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.2s ease;
    position: relative;
    padding: 4px;
    overflow: hidden;
}

.tool-btn:hover:not(:disabled) {
    background: var(--toolbar-btn-hover);
    border-color: var(--accent, #3ea6ff);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(62, 166, 255, 0.2);
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Classe btn-disabled para toggles (que não usam atributo disabled) */
.tool-btn.btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.tool-btn img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
    padding: 2px;
}

.tool-btn .btn-label {
    font-size: 9px;
    color: var(--mute, #8b949e);
    text-align: center;
    line-height: 1.1;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
}

.tool-btn:hover:not(:disabled) .btn-label {
    color: var(--text, #e6edf3);
}

/* Grid 2x2 de preview (botão Novo Módulo) */
.btn-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1px;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    padding: 2px;
}

.btn-preview-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 0;
    border-radius: 2px;
    background: #fff;
}

/* Zoom 3x na imagem do Módulo Atual ao passar mouse */
#btnModuloAtual {
    overflow: visible;
}

#btnModuloAtual:hover:not(:disabled) {
    z-index: 1000;
}

#btnModuloAtual:hover:not(:disabled) img {
    transform: scale(3);
    z-index: 1001;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#btnModuloAtual img {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

/* ══════════════════════════════════════════════════════════════════
   ZONAS DE DROP (arrastar barra)
   ══════════════════════════════════════════════════════════════════ */
.drop-zone {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 80px;
    background: rgba(62, 166, 255, 0.1);
    border: 3px dashed var(--accent, #3ea6ff);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.drop-zone.left {
    left: 0;
}

.drop-zone.right {
    right: 0;
}

.drop-zone.active {
    display: flex;
    background: rgba(62, 166, 255, 0.2);
}

.drop-zone::after {
    content: '⬅ Soltar aqui';
    color: var(--accent, #3ea6ff);
    font-size: 12px;
    font-weight: 600;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.drop-zone.right::after {
    content: 'Soltar aqui ➡';
}

/* ══════════════════════════════════════════════════════════════════
   MODAIS - BACKDROP
   ══════════════════════════════════════════════════════════════════ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-backdrop.active {
    display: flex;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL - JANELA PRINCIPAL
   ══════════════════════════════════════════════════════════════════ */
.modal {
    background: var(--panel, #161b22);
    border: 1px solid var(--border, #1e242d);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #1e242d);
    background: var(--toolbar-bg);
}

.modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #e6edf3);
}

.modal-close {
    background: none;
    border: none;
    color: var(--mute, #8b949e);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text, #e6edf3);
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border, #1e242d);
    display: flex;
    justify-content: flex-end;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL - GRID DE IMAGENS
   ══════════════════════════════════════════════════════════════════ */
.modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.modal-grid.large {
    grid-template-columns: repeat(4, 1fr);
    max-width: 700px;
}

/* Classes dinâmicas para número de colunas */
.modal-grid.cols-1 { grid-template-columns: repeat(1, 1fr); }
.modal-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.modal-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.modal-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.modal-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.modal-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }

.modal-item {
    background: var(--toolbar-btn-bg);
    border: 2px solid var(--toolbar-btn-border);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    min-width: 140px;
}

.modal-item:hover {
    border-color: var(--accent, #3ea6ff);
    background: var(--toolbar-btn-hover);
    transform: translateY(-2px);
}

.modal-item img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 6px;
}

.modal-item .item-label {
    font-size: 11px;
    color: var(--mute, #8b949e);
    line-height: 1.2;
}

.modal-item:hover .item-label {
    color: var(--text, #e6edf3);
}

/* Botão "Sem Portas" / "Sem Gavetas" */
.modal-item.btn-sem {
    background: rgba(139, 69, 69, 0.3);
    border-color: #8b4545;
}

.modal-item.btn-sem:hover {
    background: rgba(139, 69, 69, 0.5);
    border-color: #a05050;
}

.modal-item .item-placeholder {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 20px;
    color: var(--mute, #8b949e);
}

/* ══════════════════════════════════════════════════════════════════
   MODAL POPUP (posicionado próximo ao botão)
   ══════════════════════════════════════════════════════════════════ */
.modal-popup {
    position: fixed;
    background: var(--panel, #161b22);
    border: 1px solid var(--border, #1e242d);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 3000;
    display: none;
    flex-direction: column;
    min-width: 280px;
}

.modal-popup.active {
    display: flex;
}

.modal-popup .modal-header {
    padding: 8px 12px;
}

.modal-popup .modal-body {
    padding: 12px;
}

/* ══════════════════════════════════════════════════════════════════
   BOTÕES DE AÇÃO
   ══════════════════════════════════════════════════════════════════ */
.btn-cancel {
    background: #2d333b;
    border: 1px solid var(--border, #1e242d);
    color: var(--text, #e6edf3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.btn-cancel:hover {
    background: #373e47;
}

/* ══════════════════════════════════════════════════════════════════
   TOAST (feedback visual)
   ══════════════════════════════════════════════════════════════════ */
.ferramentas-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a7f37;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.ferramentas-toast.show {
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════
   INPUT GROUPS
   ══════════════════════════════════════════════════════════════════ */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
}

.input-group label {
    font-size: 13px;
    color: var(--mute, #8b949e);
    font-weight: 500;
}

.input-field {
    background: var(--bg, #0f1216);
    border: 1px solid var(--border, #1e242d);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text, #e6edf3);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--accent, #3ea6ff);
}

.input-field::-webkit-inner-spin-button,
.input-field::-webkit-outer-spin-button {
    opacity: 1;
}

/* Botão Confirmar */
.btn-confirm {
    background: var(--accent, #3ea6ff);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-confirm:hover {
    background: #5ab8ff;
}

.btn-confirm:active {
    transform: scale(0.98);
}
/* ══════════════════════════════════════════════════════════════════
   TOGGLE - LADO GAVETAS/NICHO/CANTO (Módulo 03, 05, 08, Aéreo)
   ══════════════════════════════════════════════════════════════════ */

/* Container do Toggle - usa estrutura de tool-btn */
.toggle-container-balcao,
.toggle-container-aereo {
    cursor: pointer !important;
}

/* REMOVIDO: Não escondemos mais os toggles - apenas habilitamos/desabilitamos */

/* Remove qualquer wrapper intermediário */
.toggle-container-balcao .toggle-wrapper,
.toggle-container-aereo .toggle-wrapper {
    display: contents !important;
}

/* Switch Toggle - no lugar da imagem */
.toggle-btn-posicao {
    width: 36px;
    height: 20px;
    background: #374151;
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
    margin: 0 auto;
}

/* Cor cinza quando ativo (sem azul) */
.toggle-btn-posicao.active {
    background: #6b7280;
}

.toggle-btn-posicao .toggle-knob {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
}

.toggle-btn-posicao.active .toggle-knob {
    left: 18px;
}

/* Label do toggle */
.toggle-container-balcao .btn-label,
.toggle-container-aereo .btn-label {
    font-size: 9px !important;
    color: var(--mute, #8b949e) !important;
    text-align: center !important;
    line-height: 1.1 !important;
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding: 0 2px !important;
    display: block !important;
    margin-top: 3px !important;
}

.toggle-container-balcao:hover .btn-label,
.toggle-container-aereo:hover .btn-label {
    color: var(--text, #e6edf3) !important;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL AJUSTE COMPRIMENTO - Estilos específicos
   ══════════════════════════════════════════════════════════════════ */

/* Info dentro do item (Atual/Novo) */
.modal-item .item-info {
    font-size: 10px;
    color: var(--mute, #8b949e);
    margin-top: 4px;
    line-height: 1.4;
}

.modal-item .item-info strong {
    color: var(--text, #e6edf3);
}

/* Destaque vermelho para valor reduzido */
.modal-item .item-info .valor-reduzido {
    color: #f44336 !important;
}

/* Destaque azul para o novo módulo */
.modal-item.ajuste-novo {
    border-color: var(--accent, #3ea6ff);
    background: rgba(62, 166, 255, 0.1);
}

.modal-item.ajuste-novo:hover {
    background: rgba(62, 166, 255, 0.2);
    border-color: #5ab8ff;
}

.modal-item.ajuste-novo .item-label {
    color: var(--accent, #3ea6ff) !important;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL AJUSTE DE COMPRIMENTO (centralizado com backdrop)
   ══════════════════════════════════════════════════════════════════ */
#modalAjusteComprimento {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 500px;
    z-index: 5000;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.7);
}

#modalAjusteComprimento .modal-header {
    background: #d32f2f;
    border-radius: 10px 10px 0 0;
}

#modalAjusteComprimento .modal-header h3 {
    color: #fff;
    margin: 0;
    font-size: 14px;
}

#modalAjusteComprimento .modal-close {
    color: #fff;
}