/* ===================================
   VENDAS — NOVO PEDIDO LAYOUT
   =================================== */

/* Elementos mobile-only: ocultos por padrão no desktop */
.nv-sheet, .nv-sheet-overlay, .nv-mobile-bar { display: none; }

/* ── Layout principal ── */
.nv-layout {
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
    background: #f3f4f6;
    gap: 0;
}

/* ── Painel de produtos (esquerda) ── */
.nv-produtos-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f3f4f6;
    min-width: 0;
}

/* Barra de busca */
.nv-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.nv-menu-icon {
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
}

.nv-search-wrap {
    flex: 1;
    position: relative;
}

.nv-search-wrap input {
    width: 100%;
    padding: 9px 16px 9px 38px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    background: #f9fafb;
    transition: border-color 0.2s;
}

.nv-search-wrap input:focus {
    border-color: var(--primary);
    background: white;
}

.nv-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 13px;
    pointer-events: none;
}

/* Abas de categoria */
.nv-cats {
    display: flex;
    gap: 0;
    padding: 0 16px;
    background: white;
    border-bottom: 2px solid #e5e7eb;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

.nv-cats::-webkit-scrollbar { display: none; }

.nv-cat-tab {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.02em;
}

.nv-cat-tab:hover { color: #374151; }

.nv-cat-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Grid de produtos */
.nv-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    align-content: start;
}

.nv-prod-card {
    background: white;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    user-select: none;
}

.nv-prod-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb),0.15);
    transform: translateY(-1px);
}

.nv-prod-card:active { transform: translateY(0); }

.nv-prod-card.sem-estoque {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.nv-info-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #d1d5db;
    font-size: 12px;
}

.nv-cart-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.nv-prod-img {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.nv-prod-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nv-prod-price {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
}

.nv-prod-name {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.nv-estoque-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.nv-estoque-badge.ok   { background: #dcfce7; color: #166534; }
.nv-estoque-badge.low  { background: #fef3c7; color: #92400e; }
.nv-estoque-badge.zero { background: #fee2e2; color: #991b1b; }

.nv-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 16px;
    color: #9ca3af;
}

.nv-empty i { font-size: 48px; margin-bottom: 12px; }
.nv-empty p { font-size: 14px; margin: 0; }

/* ── Painel do carrinho (direita) ── */
.nv-cart-panel {
    width: 340px;
    flex-shrink: 0;
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nv-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.nv-cart-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.nv-esvaziar {
    font-size: 12px;
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.nv-esvaziar:hover { background: #fee2e2; }

/* Itens do carrinho */
.nv-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.nv-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #d1d5db;
    padding: 32px;
    text-align: center;
}

.nv-cart-empty i { font-size: 48px; margin-bottom: 12px; }
.nv-cart-empty p { font-size: 13px; margin: 0; }

.nv-cart-item {
    background: #f9fafb;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
}

.nv-ci-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nv-ci-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.nv-ci-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nv-ci-nome {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.nv-ci-del {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.nv-ci-del:hover { color: #ef4444; background: #fee2e2; }

.nv-ci-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-ci-qty {
    display: flex;
    align-items: center;
    gap: 0;
    background: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.nv-ci-qty button {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: #374151;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.nv-ci-qty button:hover { background: #f3f4f6; }

.nv-ci-qty span {
    min-width: 24px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.nv-ci-preco-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    background: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    padding: 0 8px;
    height: 30px;
    transition: border-color 0.15s;
}

.nv-ci-preco-wrap:focus-within { border-color: var(--primary); }

.nv-ci-rs {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    white-space: nowrap;
}

.nv-ci-preco-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    width: 0;
    min-width: 0;
    background: transparent;
}

.nv-ci-unitario {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Seletor de cliente */
.nv-cliente-box {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.nv-cliente-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.nv-novo-cli {
    width: 38px;
    height: 38px;
    background: var(--primary-tint);
    border: 1.5px solid var(--primary-tint-2);
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.nv-novo-cli:hover { background: var(--primary-tint-2); }

/* Botão continuar */
.nv-continuar {
    margin: 12px;
    padding: 14px 16px;
    background: #111827;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.nv-continuar:hover:not(:disabled) { background: #1f2937; }
.nv-continuar:active:not(:disabled) { transform: scale(0.98); }
.nv-continuar:disabled { background: #d1d5db; cursor: not-allowed; }

.nv-continuar-count {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nv-continuar-total {
    margin-left: auto;
    font-size: 15px;
}

/* ── TELA DE CHECKOUT ── */
.nv-checkout-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.nv-checkout-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.nv-checkout-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.nv-voltar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s;
}

.nv-voltar-btn:hover { background: #f3f4f6; }

.nv-checkout-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.nv-checkout-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
}

.nv-checkout-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-checkout-section h3 i { color: #6b7280; }

/* Resumo de itens */
.nv-resumo-itens { display: flex; flex-direction: column; gap: 6px; }

.nv-resumo-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #374151;
    padding: 4px 0;
    border-bottom: 1px dashed #f3f4f6;
}

.nv-resumo-item:last-child { border-bottom: none; }

/* Form groups */
.nv-form-row {
    display: flex;
    gap: 12px;
}

.nv-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nv-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.nv-form-group input,
.nv-form-group select,
.nv-form-group textarea {
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

.nv-form-group input:focus,
.nv-form-group select:focus,
.nv-form-group textarea:focus {
    border-color: var(--primary);
}

/* Grid de pagamento */
.nv-pagamento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.nv-pagamento-card {
    cursor: pointer;
}

.nv-pagamento-card input[type="radio"] { display: none; }

.nv-pagamento-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 12px;
    color: #374151;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
}

.nv-pagamento-inner i { font-size: 20px; color: #6b7280; }

.nv-pagamento-card input:checked + .nv-pagamento-inner {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary-darker);
}

.nv-pagamento-card input:checked + .nv-pagamento-inner i { color: var(--primary); }

/* Abas de tipo de entrega */
.nv-entrega-tipos {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.nv-tipo-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    position: relative;
}

.nv-tipo-btn i { font-size: 16px; color: #9ca3af; }

.nv-tipo-btn:hover {
    border-color: var(--primary-soft);
    background: var(--primary-tint);
    color: var(--primary-darker);
}

.nv-tipo-btn:hover i { color: var(--primary); }

.nv-tipo-btn.active {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary-darker);
}

.nv-tipo-btn.active i { color: var(--primary); }

.nv-tipo-count {
    background: var(--primary);
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
}

/* Logísticas dentro de cada tipo */
.nv-entrega-ops { margin-bottom: 4px; }

.nv-entrega-vazia {
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #e5e7eb;
}

.nv-entrega-vazia i { margin-right: 8px; }

.nv-entrega-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nv-entrega-nome {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.nv-entrega-detalhe {
    font-size: 11px;
    color: #9ca3af;
}

.nv-entrega-card.active .nv-entrega-nome { color: var(--primary-darker); }
.nv-entrega-card.active .nv-entrega-detalhe { color: var(--primary-soft); }

/* Grid de entrega */
.nv-entrega-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nv-entrega-card {
    cursor: pointer;
    flex: 1;
    min-width: 120px;
}

.nv-entrega-card input[type="radio"] { display: none; }

.nv-entrega-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    color: #374151;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
}

.nv-entrega-inner i { font-size: 18px; color: #6b7280; }

.nv-entrega-card.active .nv-entrega-inner,
.nv-entrega-card input:checked + .nv-entrega-inner {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary-darker);
}

.nv-entrega-card.active .nv-entrega-inner i,
.nv-entrega-card input:checked + .nv-entrega-inner i { color: var(--primary); }

/* Box de totais */
.nv-total-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    position: sticky;
    top: 24px;
}

.nv-total-box h3 {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px 0;
}

.nv-total-cliente {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.nv-total-linha {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6b7280;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.nv-total-linha:last-of-type { border-bottom: none; }

.nv-total-linha.total {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 2px solid #e5e7eb;
    border-bottom: none;
}

.nv-confirmar-btn {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, transform 0.1s;
    box-sizing: border-box;
}

.nv-confirmar-btn:hover { background: #15803d; }
.nv-confirmar-btn:active { transform: scale(0.98); }

/* ── CHECKOUT MOBILE ── */
@media (max-width: 768px) {
    .nv-checkout-layout {
        padding: 0 0 100px 0;
    }

    .nv-checkout-header {
        padding: 14px 16px;
        gap: 10px;
        position: sticky;
        top: 0;
        background: #f9fafb;
        z-index: 10;
        border-bottom: 1px solid #e5e7eb;
    }

    .nv-checkout-header h2 {
        font-size: 16px;
    }

    .nv-checkout-body {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
        width: 100%;
        overflow-x: hidden;
    }

    /* Coluna de totais vai para o final no mobile */
    .nv-checkout-left {
        order: 1;
        padding: 12px;
        gap: 10px;
        display: flex;
        flex-direction: column;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }
    .nv-checkout-right {
        order: 2;
        padding: 12px 12px 0;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .nv-checkout-section {
        padding: 14px;
        border-radius: 10px;
        margin: 0;
    }

    .nv-checkout-section h3 {
        font-size: 13px;
        margin-bottom: 10px;
    }

    /* Itens do pedido — mais compactos */
    .nv-resumo-item {
        font-size: 12px;
        padding: 5px 0;
    }

    /* Desconto e Frete — empilha no mobile */
    .nv-form-row {
        flex-direction: column;
        gap: 8px;
    }

    /* Pagamento — 3 colunas no mobile */
    .nv-pagamento-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .nv-pagamento-inner {
        padding: 8px 4px;
        border-radius: 8px;
        font-size: 11px;
        gap: 4px;
    }

    .nv-pagamento-inner i {
        font-size: 17px;
    }

    /* Entrega — chips horizontais com scroll */
    .nv-entrega-tipos {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        gap: 6px;
    }

    .nv-entrega-grid {
        gap: 6px;
    }

    .nv-entrega-card {
        min-width: 0;
        flex: 1 1 calc(50% - 3px);
    }

    .nv-entrega-inner {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Box de totais — sem sticky no mobile */
    .nv-total-box {
        position: static;
        border-radius: 10px;
        padding: 14px;
    }

    .nv-total-linha {
        font-size: 12px;
    }

    .nv-total-linha.total {
        font-size: 15px;
    }

    /* Botão confirmar — fixo na parte inferior */
    .nv-confirmar-btn {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
        padding: 16px;
        font-size: 15px;
        z-index: 100;
        box-shadow: 0 -4px 16px rgba(0,0,0,.12);
    }
}
