/* =========================================
   IMPERIUS PDV - MOBILE FIRST
   Layout 100% mobile, estilo app
   Reaproveitando todos os IDs já usados no JS
   ========================================= */

/* ------------ RESET & VARIÁVEIS ------------ */

:root {
    --velo-purple: #4a148c;
    --velo-purple-dark: #2c0b55;
    --velo-orange: #ff3d00;
    --velo-orange-hover: #e63700;
    --velo-bg: #f3f0f5;
    --velo-gray: #e0e0e0;
    --text-dark: #222;
    --border-radius: 10px;

    --primary: #4a148c;
    --primary-light: #7c43bd;
    --success: #2e7d32;
    --danger: #d32f2f;
    --text-main: #333;
    --text-muted: #666;
    --card-radius: 12px;
    --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    background-color: var(--velo-bg);
    color: var(--text-dark);
    overflow: hidden; /* sensação de app */
}

/* Utilitários */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.full { width: 100%; }
.mt-20 { margin-top: 20px; }

/* Scroll custom leve (dentro de containers roláveis) */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* =========================================
   LOGIN - MOBILE
   ========================================= */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: radial-gradient(circle at top, #7c43bd 0, #4a148c 40%, #2c0b55 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    padding: 30px 24px 26px;
    backdrop-filter: blur(10px);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
    color: var(--velo-purple);
}

.login-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.login-header i {
    margin-right: 6px;
}

.login-header p {
    font-size: 0.85rem;
    color: #777;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d0d0d0;
    font-size: 0.95rem;
    outline: none;
    background-color: #fff;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--velo-purple);
    box-shadow: 0 0 0 2px rgba(74, 20, 140, 0.15);
}

.btn-login {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, var(--velo-orange), var(--velo-purple));
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(74, 20, 140, 0.3);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-login:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: 0 5px 14px rgba(74, 20, 140, 0.25);
}

/* =========================================
   CONTAINER PRINCIPAL APP (MOBILE)
   ========================================= */

.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--velo-bg);
}

/* Header superior em modo "app" */
.desktop-header {
    flex-shrink: 0;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #ececec;
    display: flex;
    align-items: center;
    padding: 0 14px;
    justify-content: space-between;
}

.header-search {
    display: none; /* não usamos busca global no mobile, pode habilitar depois se quiser */
}

.user-area {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.badge-status {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #e0e0e0;
    color: #555;
}

/* Esconde sidebar completamente no mobile */
.sidebar {
    display: none !important;
}

/* Área de conteúdo rolável */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

/* Cards da home (dashboard simples mobile) */
.desktop-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.desktop-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-soft);
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.desktop-card:active {
    transform: scale(0.99);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--velo-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 6px 18px rgba(74, 20, 140, 0.4);
}

.card-icon-box i {
    font-size: 1.4rem;
}

.desktop-card span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* =========================================
   TELA DE VENDA (PDV) - FULL MOBILE
   ========================================= */

.velo-pdv-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--velo-bg);
    display: flex;
    flex-direction: column;
    z-index: 2000;
}

/* Header roxo do PDV */
.velo-header {
    flex-shrink: 0;
    height: 60px;
    background: linear-gradient(90deg, var(--velo-purple), #7c43bd);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    color: #fff;
}

.velo-logo {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.velo-message {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.85;
}

.velo-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.65rem;
    cursor: pointer;
    opacity: 0.95;
}

.action-item i {
    font-size: 1rem;
    margin-bottom: 2px;
}

/* Corpo da tela de venda */
.velo-body {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

/* Views internas (Venda x Pagamento) */
.pdv-view {
    display: none;
    width: 100%;
}

.pdv-view.active {
    display: block;
}

/* Colunas (no mobile são apenas seções empilhadas) */
.velo-left-col,
.velo-right-col {
    width: 100%;
    background: transparent;
}

/* Busca de produto */
.velo-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 12px;
    border: 2px solid var(--velo-purple);
    padding: 8px 12px;
    box-shadow: var(--shadow-soft);
}

.velo-search-box i {
    font-size: 1.4rem;
    color: var(--velo-purple);
}

.velo-search-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
    background: transparent;
}

.search-help {
    margin-top: 4px;
    font-size: 0.75rem;
    color: #1976d2;
    text-align: right;
}

/* Inputs principais de venda */
.velo-inputs-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.input-block {
    flex: 1;
}

.input-block label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--velo-purple);
    margin-bottom: 4px;
}

.velo-big-input {
    width: 100%;
    height: 52px;
    border-radius: 12px;
    border: 1px solid #ccc;
    font-size: 1.3rem;
    text-align: right;
    padding: 0 10px;
    outline: none;
    color: #222;
    background: #fff;
}

.velo-big-input:focus {
    border-color: var(--velo-purple);
    box-shadow: 0 0 0 2px rgba(74, 20, 140, 0.15);
}

.gray-bg {
    background: #f0f0f0;
}

.border-purple {
    border: 2px solid var(--velo-purple) !important;
}

.bg-highlight {
    background-color: #fcfcfc;
}

/* Botões principais da venda */
.velo-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.velo-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 6px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.1s ease;
}

.velo-btn:active {
    transform: scale(0.98);
    box-shadow: none;
}

.velo-btn.purple {
    background: var(--velo-purple);
    color: #fff;
    box-shadow: 0 8px 20px rgba(74, 20, 140, 0.35);
}

.velo-btn.purple:hover {
    background: var(--velo-purple-dark);
}

.velo-btn.light {
    background: #e5def0;
    color: var(--velo-purple);
}

.velo-btn.orange {
    background: var(--velo-orange);
    color: #fff;
}

/* Painel de pagamento rápido (dentro da venda) */
.pagamento-panel {
    margin-top: 12px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #ffd7c9;
    padding: 10px 12px;
    box-shadow: var(--shadow-soft);
}

.pagamento-panel h3 {
    font-size: 0.9rem;
    color: var(--velo-orange);
    margin-bottom: 6px;
}

.mini-list-pagamentos {
    max-height: 80px;
    overflow-y: auto;
    margin: 6px 0;
    border-radius: 6px;
    border: 1px dashed #ddd;
    padding: 4px;
    font-size: 0.75rem;
}

.troco-display {
    text-align: right;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Tabela de itens */
.velo-selectors {
    margin-top: 10px;
    padding: 8px 10px;
    background: #f9f9f9;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.sel-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--velo-purple);
}

.sel-group span {
    font-size: 0.8rem;
    color: #555;
}

.velo-table-container {
    margin-top: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    max-height: 220px;
    overflow-y: auto;
}

.velo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.velo-table thead {
    position: sticky;
    top: 0;
    background: #fafafa;
    z-index: 1;
}

.velo-table th,
.velo-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.velo-table th {
    font-weight: 600;
    color: #777;
}

.empty-msg {
    text-align: center;
    padding: 18px;
    color: #aaa;
    font-style: italic;
}

/* Rodapé da venda */
.velo-footer {
    margin-top: 8px;
    padding: 10px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #555;
}

.footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.velo-btn-finalizar {
    flex: 1;
    border-radius: 999px;
    padding: 10px 10px;
    border: none;
    background: var(--velo-orange);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 9px 20px rgba(255, 61, 0, 0.35);
    cursor: pointer;
}

.total-big-display {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--velo-orange);
    text-align: right;
}

/* =========================================
   MODAIS GERAIS (mobile fullscreen)
   ========================================= */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 94%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 18px;
    padding: 18px 16px 16px;
    position: relative;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.close {
    position: absolute;
    right: 12px;
    top: 6px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.card-style h3 {
    color: var(--velo-purple);
    font-size: 1.05rem;
    margin-bottom: 12px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}

/* Footer de modal */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.btn-modal {
    min-width: 90px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.08s;
}

.btn-modal:active {
    transform: scale(0.98);
    box-shadow: none;
}

.btn-primary {
    background-color: var(--velo-purple);
    color: #fff;
}

.btn-secondary {
    background-color: #f4f4f4;
    color: #555;
    border: 1px solid #ddd;
}

.btn-danger {
    background: #d32f2f;
    color: #fff;
}

.btn-success {
    background: #388e3c;
    color: #fff;
}

/* Ticket-style (aprovar transferência) */
.ticket-style {
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
}

.ticket-header-bg {
    background: linear-gradient(135deg, #2196f3, #1565c0);
    padding: 18px;
    text-align: center;
    color: #fff;
    position: relative;
}

.close-white {
    position: absolute;
    right: 12px;
    top: 6px;
    font-size: 20px;
    cursor: pointer;
    color: #fff;
}

.big-icon {
    font-size: 2.4rem;
    margin-bottom: 6px;
}

.ticket-body {
    padding: 16px;
    text-align: center;
}

.ticket-meta {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 6px;
}

.ticket-number {
    font-size: 3rem;
    font-weight: 900;
    margin: 6px 0;
    color: #222;
}

.ticket-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* =========================================
   MODAL PAGAMENTO VELO - MOBILE
   ========================================= */

/* Quando usado como overlay desktop, mas o layout também é mobile-first */
.velo-payment-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--velo-bg);
    z-index: 4000;
    display: flex;
    flex-direction: column;
}

/* Header do modal pagamento (não usamos no mobile view, mas mantemos compatível) */
.vp-header {
    height: 60px;
    background: linear-gradient(90deg, #4a148c, #d84315);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    color: #fff;
}

.vp-logo {
    font-size: 1.4rem;
    font-weight: 700;
}

.vp-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.vp-user {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Corpo do pagamento */
.vp-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 10px;
    overflow-y: auto;
}

.vp-left,
.vp-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Botões de acréscimo/desconto */
.vp-adjust-buttons {
    display: flex;
    gap: 8px;
}

.vp-btn-adjust {
    flex: 1;
    padding: 8px;
    border-radius: 999px;
    border: none;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--velo-orange);
    color: #fff;
}

/* Inputs de pagamento */
.vp-inputs-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.vp-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vp-input-group label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--velo-purple);
}

.vp-input-big {
    height: 50px;
    border-radius: 12px;
    border: 2px solid #ccc;
    padding: 0 12px;
    font-size: 1.2rem;
    outline: none;
}

.vp-input-big:focus {
    border-color: var(--velo-purple);
}

.vp-input-big.readonly {
    background: #f3f3f3;
    border-color: #e0e0e0;
}

/* Formas de pagamento em grid */
.vp-methods-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.vp-method-btn {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #ddd;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    font-size: 0.8rem;
}

.vp-method-btn span {
    font-weight: 600;
    color: #444;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.icon-box.green { background: #2e7d32; }
.icon-box.blue { background: #1565c0; }
.icon-box.purple { background: #4a148c; }
.icon-box.purple-light { background: #7b1fa2; }
.icon-box.purple-dark { background: #311b92; }
.icon-box.orange { background: #e65100; }
.icon-box.orange-dark { background: #ff6f00; }
.icon-box.pink { background: #c2185b; }

/* Ações de pagamento */
.vp-footer-actions {
    display: flex;
    gap: 8px;
}

.vp-action-btn {
    flex: 1;
    border-radius: 999px;
    padding: 10px;
    border: none;
    background: var(--velo-purple);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    cursor: pointer;
}

.vp-footer-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.7rem;
}

.tag-shortcut {
    padding: 3px 8px;
    border-radius: 999px;
    background: #e3dce6;
    color: var(--velo-purple);
    font-weight: 600;
}

/* Resumo de pagamentos (lado direito) */
.vp-summary-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.vp-box-header {
    padding: 8px 10px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vp-list-content {
    max-height: 140px;
    overflow-y: auto;
    padding: 6px 10px;
}

.vp-payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px dashed #eee;
    font-size: 0.8rem;
}

/* Totais */
.totals-box {
    padding-bottom: 10px;
}

.vp-total-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #666;
}

.vp-total-row.big {
    font-size: 0.9rem;
    font-weight: 700;
}

.vp-total-row.big strong {
    color: var(--velo-purple);
}

.vp-total-row.received strong {
    color: var(--success);
}

.vp-total-row.missing strong {
    color: var(--danger);
}

.vp-link-voltar {
    margin-top: 8px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1565c0;
    cursor: pointer;
}

/* Botão concluir venda */
#btnConcluirVendaFinal {
    margin-top: 10px;
    border-radius: 999px;
}

/* =========================================
   ALERTAS B2B
   ========================================= */

#containerAlertasB2B {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    width: 90%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 80vh;
    overflow-y: auto;
}

.alerta-transferencia {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 18px;
    padding: 22px;
    color: #fff;
    border: 2px solid #00f2fe;
    box-shadow: 0 0 35px rgba(0, 242, 254, 0.35);
    text-align: center;
    animation: alertPulse 2s ease-in-out infinite alternate;
}

@keyframes alertPulse {
    from { box-shadow: 0 0 20px rgba(0, 242, 254, 0.2); }
    to   { box-shadow: 0 0 45px rgba(0, 242, 254, 0.6); }
}

.btn-receber-grande {
    margin-top: 10px;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #00f2fe;
    color: #0f172a;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
}

/* =========================================
   AJUSTES RESPONSIVOS (até tablet)
   ========================================= */

@media (min-width: 600px) {
    .desktop-grid {
        grid-template-columns: 1fr 1fr;
    }

    .vp-body {
        flex-direction: row;
    }

    .vp-left,
    .vp-right {
        width: 50%;
    }
}