/* ==========================================================================
   DAXV SYSTEM V2 - MASTER STYLE
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap');

:root {
    /* Cores de Fundo */
    --bg-primary: #000000;
    --bg-secondary: #0d0d0d;
    --bg-card: #141414;
    --bg-input: #050505;
    
    /* Cores de Destaque */
    --accent: #f39c12;       /* Laranja DAXV */
    --success: #2ecc71;      /* Verde Operacional */
    --danger: #e74c3c;       /* Vermelho Alerta */
    --warning: #f1c40f;      /* Amarelo Instrução */
    
    /* Tipografia e Bordas */
    --text-primary: #ffffff;
    --text-muted: #888888;
    --border: #222222;
    --font-main: 'Inter', -apple-system, sans-serif;
    
    /* Dimensões */
    --nav-height: 75px;
    --header-height: 60px;
}

/* 1. RESET E BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    line-height: 1.5;
}

/* 2. LAYOUT DE LOGIN (ACESSO)
   ========================================================================== */
.login-wrapper {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--bg-card);
    padding: 40px 30px;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.login-header img {
    max-width: 90px;
    display: block;
    margin: 0 auto 15px;
    filter: drop-shadow(0 0 10px rgba(243, 156, 18, 0.2));
}

.login-header h1 {
    font-size: 16px;
    text-align: center;
    letter-spacing: 3px;
    font-weight: 900;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.login-header span {
    display: block;
    text-align: center;
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ==========================================================================
   3.1. CABEÇALHO PRINCIPAL (HEADER V2)
   ========================================================================== */
.main-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(13, 13, 13, 0.85); /* Fundo semi-transparente */
    backdrop-filter: blur(12px); /* Efeito de vidro fosco moderno */
    -webkit-backdrop-filter: blur(12px); /* Suporte para iOS */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.header-logo { 
    font-weight: 900; 
    letter-spacing: 2px; 
    font-size: 16px; 
    display: flex;
    align-items: center;
    color: #fff;
}

.badge-v2 { 
    font-size: 9px; 
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid var(--accent); 
    color: var(--accent); 
    padding: 3px 6px; 
    border-radius: 6px; 
    margin-left: 8px; 
    letter-spacing: 1px;
}

/* Área do Usuário / Botão de Logout */
.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 4px 4px 12px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.header-user:hover {
    background: rgba(231, 76, 60, 0.05);
    border-color: rgba(231, 76, 60, 0.2);
}

.user-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
}

.user-name {
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.user-role {
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
}

.logout-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
}

.header-user:hover .logout-btn {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

/* Botão de Atualização Centralizado */
/* Botão de Atualização (Junto à Logo) */
.header-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 32px; /* Ajustado para alinhar perfeitamente com a logo */
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 101;
    font-size: 12px;
}

/* Efeito ao tocar (Mobile) ou passar o mouse (PC) */
.header-refresh:hover, 
.header-refresh:active {
    background: rgba(46, 204, 113, 0.15); 
    color: var(--success); 
    border-color: var(--success);
    /* Gira o ícone em 180 graus de forma limpa */
    transform: rotate(180deg); 
}
.app-container {
    padding-bottom: 120px !important; /* Espaço para o botão + Nav */
}

/* Correção de Espaçamento Extra no Topo (Mobile) */
.content-frame { padding-top: 15px; }
.view { padding: 0 20px; }
.sector-view { padding: 20px; }

/* 4. COMPONENTES V2 (CARDS E GRIDS)
   ========================================================================== */
.v2-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    margin-top: 0 !important; /* Força o card a colar no topo quando necessário */
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-card i { font-size: 28px; color: var(--accent); }
.action-card span { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.action-card:active { transform: scale(0.95); background: #1a1a1a; border-color: var(--accent); }

/* 5. FORMULÁRIOS E INPUTS (PADRÃO V1 EVOLUÍDO)
   ========================================================================== */
.v1-title {
    font-size: 11px;
    font-weight: 900;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-top: 5px;
    padding-bottom: 10px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.v1-form-group { margin-bottom: 15px; }
.v1-form-group label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #555;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.v1-form-group input, 
.v1-form-group select, 
.v1-form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: #fff;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--font-main);
    transition: all 0.3s;
}

.v1-form-group input:focus { border-color: var(--accent); outline: none; background: #000; }
.v1-row { display: flex; gap: 15px; }

/* 6. BOTÕES OPERACIONAIS E ESTILOS ESPECÍFICOS DE CONSULTA
   ========================================================================== */
.btn-v1-orange {
    background: var(--accent);
    color: #000;
    border: none;
    width: 100%;
    padding: 16px;
    border-radius: 10px;
    font-weight: 900;
    font-size: 13px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter 0.2s;
}

#view-vendas {
    padding-bottom: 50px;
}

.final-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed var(--border);
}

.btn-v1-finalize {
    background: var(--accent);
    color: #000;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(243, 156, 18, 0.2);
    border: none;
    width: 100%;
    cursor: pointer;
}

.btn-v1-orange:active, .btn-v1-finalize:active { transform: scale(0.97); filter: brightness(1.2); }

/* Seletores de Prefixo F/E Estilizados (Aba Consulta) */
.selector-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.type-btn {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 15px;
    border-radius: 10px;
    font-weight: 900;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.type-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(243, 156, 18, 0.05);
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.1);
}

/* Botão de Cancelar (Ghost Red) */
.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    margin-top: 10px;
    cursor: pointer;
}

/* Item de Resultado Individual (Aba Consulta) */
.search-item-row {
    background: #0a0a0a;
    border-left: 3px solid var(--accent);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* --- DOMADOR DE IOS (CORREÇÃO DE VAZAMENTO DE INPUTS) --- */
input[type="date"],
input[type="number"],
input[type="text"] {
    -webkit-appearance: none !important; /* Desativa o visual nativo que quebra a tela no iPhone */
    -moz-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
    display: block !important;
    margin: 0 !important;
}

/* Ícone nativo SEM esticar área clicável */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;            /* esconde visualmente */
    cursor: pointer;
}

/* Remove spin button sem interferir no clique */
input[type="date"]::-webkit-inner-spin-button {
    display: none;
}

/* 7. RESUMO E TOTAIS
   ========================================================================== */
.v1-total-box {
    background: var(--bg-input);
    padding: 18px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    border: 1px dashed var(--border);
}

#display_valor_total { font-size: 22px; font-weight: 900; color: var(--accent); }

.v1-grand-total {
    text-align: right;
    font-size: 24px;
    font-weight: 900;
    color: var(--success);
    margin: 25px 0;
    letter-spacing: -1px;
}

/* 8. NAVEGAÇÃO INFERIOR (BOTTOM NAV)
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: var(--nav-height);
    background: #050505;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    transition: color 0.3s;
}

.nav-item i { font-size: 22px; }
.nav-item span { font-size: 9px; font-weight: 800; letter-spacing: 0.5px; }
.nav-item.active { color: var(--accent); }

/* Utilitários */
.text-center { text-align: center; }
.muted { color: var(--text-muted); }



/* 9. MODAL DE AVISO ESTILIZADO
   ========================================================================== */
.v2-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.v2-modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 400px;
    padding: 30px;
    border-radius: 16px;
    border-top: 5px solid var(--accent);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    position: relative;
}

.v2-modal-content h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--accent);
}

.v2-modal-body {
    color: #ccc;
    font-size: 14px;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.v2-modal-body li { margin-bottom: 8px; list-style: none; position: relative; padding-left: 15px; }
.v2-modal-body li::before { content: "•"; position: absolute; left: 0; color: var(--accent); }

/* =========================================================
   10. MODO PC (DESKTOP) - SIMULADOR DE SMARTPHONE
   ========================================================= */
@media (min-width: 768px) {
    body {
        background-color: #050505; /* Fundo externo da tela escuro */
        display: flex;
        justify-content: center;
        align-items: flex-start;
        min-height: 100vh;
        margin: 0;
    }

    .login-wrapper,
    .app-container {
        width: 100%;
        max-width: 450px; /* Trava a largura exata de um celular moderno */
        min-height: 100vh;
        background-color: var(--bg-primary); /* Fundo preto do app */
        position: relative;
        box-shadow: 0 0 40px rgba(0,0,0,0.9), 0 0 0 1px #222; /* Borda tática lateral */
    }

.bottom-nav {
        max-width: 450px;
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto !important;
        transform: none !important;
    }

    /* O Cabeçalho já acompanha o container, só precisamos garantir a largura */
    .main-header {
        max-width: 450px;
        width: 100%;
        left: auto !important;
        transform: none !important;
    }

    /* Estiliza a barra de rolagem no PC para não quebrar a imersão */
    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: var(--bg-primary); }
    ::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--accent); }
}

/* ==========================================================================
   VISUAL E NAVEGAÇÃO DOS DROPDOWNS DE BUSCA
   ========================================================================== */
.autocomplete-dropdown {
    box-shadow: 0 10px 25px rgba(0,0,0,0.8);
    border-radius: 8px;
    overflow: hidden;
}

.autocomplete-item {
    padding: 12px 15px;
    border-bottom: 1px solid #222; /* Separação visual sutil */
    cursor: pointer;
    transition: all 0.1s ease;
    color: var(--text-muted);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* O que acontece ao passar o mouse ou focar com o teclado */
.autocomplete-item:hover,
.autocomplete-item.active-nav {
    background: rgba(243, 156, 18, 0.15); /* Fundo Laranja DAXV Translúcido */
    color: #fff;
    border-left: 4px solid var(--accent); /* Marcador lateral tático */
}

