/* style.css - Total Farma Popular */
/* Importando fontes modernas do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Cores - Identidade Visual Total Farma */
  --primary-color: #0c2340;        /* Azul Escuro Corporativo */
  --primary-light: #16365c;
  --secondary-color: #a91e2c;      /* Vermelho Farmácia Profissional / Vinho */
  --secondary-hover: #8b1420;
  --accent-color: #00b4d8;         /* Azul Claro/Ciano */
  
  --bg-color: #f4f6fa;
  --panel-bg: #ffffff;
  --text-main: #2b2d42;
  --text-muted: #6c757d;
  --border-color: #e2e8f0;
  
  /* Status */
  --success: #2ec4b6;
  --danger: #e63946;
  --warning: #ffb703;
  --info: #0077b6;
  
  /* Efeitos e Sombras */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 16px rgba(12, 35, 64, 0.08);
  --shadow-lg: 0 16px 32px rgba(12, 35, 64, 0.15);
  --border-radius: 12px;
  --border-radius-sm: 6px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset Geral */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select, textarea {
  font-family: inherit;
  outline: none;
}

/* Scrollbar Customizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* --- Layout Geral da SPA --- */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Cabeçalho Principal (Navegação Global) */
.global-header {
  background-color: var(--primary-color);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.1;
}

.logo-title {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
}

.logo-subtitle {
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--secondary-color);
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 1px;
}

.logo-subtitle .logo-line {
  flex-grow: 1;
  height: 1.5px;
  background-color: var(--secondary-color);
  min-width: 6px;
  opacity: 0.7;
}

.global-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 30px;
  /* backdrop-filter: blur(10px); */
}

.nav-toggle-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.nav-toggle-btn.active {
  background-color: var(--secondary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.user-status {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--primary-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
}

.btn-logout:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: white;
}

/* Área de Conteúdo */
main.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --- VISTA: PORTAL DO CLIENTE (E-COMMERCE) --- */
.customer-portal {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Sub-header do E-commerce */
.ecommerce-subbar {
  background-color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  gap: 20px;
}

.search-wrapper {
  flex: 1;
  max-width: 600px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 20px 12px 45px;
  border: 2px solid var(--border-color);
  border-radius: 30px;
  font-size: 0.95rem;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(12, 35, 64, 0.1);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.ecommerce-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.action-btn {
  background: white;
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: var(--transition);
}

.action-btn:hover {
  background-color: var(--bg-color);
  border-color: var(--text-muted);
}

.cart-btn {
  background-color: var(--secondary-color);
  color: white;
  border: none;
}

.cart-btn:hover {
  background-color: var(--secondary-hover);
  color: white;
}

.cart-count {
  background-color: white;
  color: var(--secondary-color);
  font-weight: 700;
  font-size: 0.75rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Banner de Promoção */
.promo-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 40px;
  margin: 24px;
  border-radius: var(--border-radius);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.promo-banner h2 {
  font-size: 2.2rem;
  margin-bottom: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.promo-banner h2 .sub-pop {
  color: var(--secondary-color);
}

.banner-tagline {
  font-size: 0.95rem;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  margin-bottom: 15px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.promo-banner p {
  color: rgba(255, 255, 255, 0.7);
  max-width: 600px;
  font-size: 0.95rem;
}

.banner-emblem-svg {
  position: absolute;
  top: -10px;
  right: 20px;
  opacity: 0.15;
  transform: rotate(15deg);
  pointer-events: none;
}

/* Grid de Categorias */
.categories-bar {
  display: flex;
  gap: 12px;
  padding: 0 24px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.category-tab {
  background: white;
  border: 1px solid var(--border-color);
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.category-tab:hover, .category-tab.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Vitrine de Produtos */
.products-showcase {
  padding: 0 24px 40px 24px;
}

.section-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.product-card {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(230, 57, 70, 0.3);
}

.product-image-container {
  height: 140px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  position: relative;
}

.product-image-placeholder {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: var(--primary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.product-lab {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.product-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  height: 48px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 6px;
}

.product-dose {
  font-size: 0.8rem;
  background: var(--bg-color);
  color: var(--primary-light);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  align-self: flex-start;
  margin-bottom: 12px;
  font-weight: 500;
}

.product-stock-status {
  font-size: 0.75rem;
  margin-bottom: 12px;
}
.product-stock-status.in-stock {
  color: var(--success);
}
.product-stock-status.out-of-stock {
  color: var(--danger);
}

.product-price-row {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.add-cart-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.add-cart-btn:hover {
  background-color: var(--secondary-color);
  transform: scale(1.1);
}

/* --- VISTA: PAINEL DE GESTÃO (ERP) --- */
.management-portal {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.management-sidebar {
  width: 260px;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.sidebar-title {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-menu {
  list-style: none;
  padding: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  font-size: 0.95rem;
  border-left: 4px solid transparent;
  transition: var(--transition);
}

.sidebar-item a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
}

.sidebar-item.active a {
  background-color: rgba(255, 255, 255, 0.08);
  color: white;
  border-left-color: var(--secondary-color);
}

/* Conteúdo Principal do Painel */
.management-main {
  flex: 1;
  padding: 30px;
  background-color: var(--bg-color);
  overflow-y: auto;
  min-width: 0; /* Impede que o flex item cresça além do viewport, ativando barras de rolagem internas */
  max-width: 100%;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Grid de Métricas (Dashboard) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.metric-card {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 5px solid var(--primary-color);
}

.metric-card.sales { border-left-color: var(--success); }
.metric-card.purchases { border-left-color: var(--danger); }
.metric-card.licenses { border-left-color: var(--warning); }

.metric-info h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 500;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-icon-bg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  color: var(--primary-color);
}

/* Layout Geral de Paineis */
.panel {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* --- Tabelas de Dados --- */
.table-wrapper {
  overflow: auto; /* Permite rolagem vertical e horizontal interna */
  max-height: calc(100vh - 380px); /* Mantém o wrapper e sua rolagem horizontal visíveis na tela */
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  position: relative;
}

.data-table {
  width: 100%;
  min-width: 1100px; /* Garante largura mínima legível para forçar a rolagem horizontal em telas pequenas */
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--primary-color);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 2px solid var(--border-color);
  position: sticky; /* Mantém o cabeçalho fixo no topo ao rolar verticalmente */
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Badges e Status */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.active { background-color: rgba(46, 196, 182, 0.15); color: var(--success); }
.badge.pending { background-color: rgba(255, 183, 3, 0.15); color: var(--warning); }
.badge.expired { background-color: rgba(230, 57, 70, 0.15); color: var(--danger); }
.badge.role-admin { background-color: rgba(12, 35, 64, 0.1); color: var(--primary-color); }
.badge.role-manager { background-color: rgba(0, 180, 216, 0.1); color: var(--accent-color); }
.badge.role-cashier { background-color: rgba(108, 117, 125, 0.1); color: var(--text-muted); }
.badge.role-founder { background-color: rgba(220, 38, 38, 0.1); color: #dc2626; }
.badge.role-client { background-color: rgba(79, 70, 229, 0.1); color: #4f46e5; }
.badge.role-consumer { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge.role-operator { background-color: rgba(124, 58, 237, 0.1); color: #7c3aed; }

/* --- Ações e Formulários --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-light);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}
.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background-color: #cc2a36;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: var(--bg-color);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.action-group {
  display: flex;
  gap: 6px;
}

/* Filtros */
.filter-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
}

.filter-select {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: white;
  font-size: 0.9rem;
  min-width: 150px;
}

/* Formulário de Grade */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  width: 100%;
}
.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(12, 35, 64, 0.1);
}

/* --- Modais e Gavetas --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(12, 35, 64, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  /* backdrop-filter: blur(4px); */
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 40px 10px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: white;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 18px 24px;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: var(--transition);
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: #f8fafc;
}

/* Drawer do Carrinho Lateral */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(12, 35, 64, 0.4);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  /* backdrop-filter: blur(2px); */
  transition: opacity 0.3s ease;
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background-color: white;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-overlay.active + .cart-drawer, .cart-drawer.active {
  right: 0;
}

.drawer-header {
  padding: 20px;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background-color: #f8fafc;
}

/* Itens do Carrinho */
.cart-item {
  display: flex;
  gap: 15px;
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.cart-item-details {
  flex: 1;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.cart-item-lab {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cart-item-price {
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 4px;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.qty-btn:hover {
  background-color: var(--bg-color);
}

.btn-remove-item {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 8px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 15px;
}

/* POS Interface */
.pos-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

.pos-products {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.pos-cart-panel {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  position: sticky;
  top: 100px;
}

.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  margin: 15px 0;
}

/* Simulador de E-mail */
.email-simulator {
  border: 2px dashed var(--secondary-color);
  background-color: #fff9f2;
  border-radius: var(--border-radius-sm);
  padding: 20px;
  margin-top: 15px;
}

.email-header {
  border-bottom: 1px solid #ffe6cc;
  padding-bottom: 10px;
  margin-bottom: 15px;
  font-size: 0.85rem;
}

.email-body {
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #555;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: var(--primary-color);
  color: white;
  padding: 12px 24px;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100px);
  opacity: 0;
  animation: slideIn 0.3s forwards cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.toast.success { background-color: var(--success); }
.toast.danger { background-color: var(--danger); }
.toast.warning { background-color: var(--warning); }
.toast.info { background-color: var(--info); }

@keyframes slideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsividade Mobile */
@media (max-width: 900px) {
  .management-portal {
    flex-direction: column;
  }
  
  .management-sidebar {
    width: 100%;
    height: auto;
  }
  
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 15px;
  }
  
  .sidebar-item a {
    padding: 10px 15px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  
  .sidebar-item.active a {
    border-left-color: transparent;
    border-bottom-color: var(--secondary-color);
  }
  
  .pos-container {
    grid-template-columns: 1fr;
  }
  
  .pos-cart-panel {
    height: auto;
    position: static;
  }
}

@media (max-width: 600px) {
  .global-header {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }
  
  .ecommerce-subbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }
  
  .promo-banner {
    padding: 20px;
    margin: 12px;
  }
  
  .promo-banner h2 {
    font-size: 1.6rem;
  }
  
  .categories-bar {
    padding: 0 12px;
  }
  
  .products-showcase {
    padding: 0 12px 20px 12px;
  }
}

/* --- ESTILOS DE ESTOQUE E IMPRESSÃO (NOVO) --- */

.badge.stock-critical {
  background-color: rgba(230, 57, 70, 0.15);
  color: var(--danger);
  border: 1px solid rgba(230, 57, 70, 0.2);
}

.badge.stock-ok {
  background-color: rgba(46, 196, 182, 0.15);
  color: var(--success);
}

/* Otimização de Relatório Imprimível */
.falteiro-sheet {
  background-color: white;
  color: #2b2d42;
  padding: 10px;
}

.falteiro-header {
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 15px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.falteiro-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
}
.falteiro-logo span {
  color: var(--secondary-color);
}

.falteiro-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
}

.falteiro-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.falteiro-table th {
  background-color: #f1f5f9;
  border-bottom: 2px solid #cbd5e1;
  padding: 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--primary-color);
  font-weight: 600;
}

.falteiro-table td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

.falteiro-footer {
  margin-top: 40px;
  border-top: 1px solid #cbd5e1;
  padding-top: 15px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Ajustes de Impressão */
@media print {
  body * {
    visibility: hidden !important;
  }
  
  /* Impressão do Relatório Falteiro */
  body.printing-falteiro #falteiro-modal,
  body.printing-falteiro #falteiro-modal .modal-content,
  body.printing-falteiro #falteiro-modal .printable-area,
  body.printing-falteiro #falteiro-modal .printable-area * {
    visibility: visible !important;
  }
  
  body.printing-falteiro #falteiro-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: white !important;
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    box-shadow: none !important;
  }
  
  body.printing-falteiro #falteiro-modal .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Impressão do Cupom Térmico POS */
  body.printing-receipt #pos-receipt-modal,
  body.printing-receipt #pos-receipt-modal .modal-content,
  body.printing-receipt #pos-receipt-modal .printable-receipt,
  body.printing-receipt #pos-receipt-modal .printable-receipt * {
    visibility: visible !important;
  }
  
  body.printing-receipt #pos-receipt-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: white !important;
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  
  body.printing-receipt #pos-receipt-modal .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .no-print {
    display: none !important;
  }
  
  @page {
    margin: 1.0cm;
  }
}

/* Switch toggle slider */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--secondary-color);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Animações e Estilos de Checkout Integrado (Novos) */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.thermal-receipt-theme {
  font-family: 'Courier New', Courier, monospace;
  color: #000 !important;
  line-height: 1.35;
  font-size: 0.85rem !important;
  white-space: pre-wrap;
  background: #ffffff !important;
  padding: 10px;
  border: 1px dashed #bbb;
  border-radius: 4px;
}

.thermal-receipt-theme table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
}

.thermal-receipt-theme th, .thermal-receipt-theme td {
  padding: 4px 0;
  border-bottom: 1px dashed #ddd;
  font-size: 0.82rem;
  color: #000;
  text-align: left;
}

.thermal-receipt-theme .receipt-total {
  font-size: 1rem;
  font-weight: bold;
  border-top: 2px dashed #000;
  padding-top: 8px;
  margin-top: 8px;
}

/* Efeito Hover para Botões de Cédula */
.banknote-btn {
  transition: transform 0.1s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.banknote-btn:hover {
  background-color: rgba(0, 0, 0, 0.03) !important;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.banknote-btn:active {
  transform: translateY(1px);
}

/* --- Sincronização em Nuvem LED Pulse --- */
@keyframes pulse {
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* --- Estilos Mobile Premium (Navegação Inferior e Biometria) --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(68px + max(14px, env(safe-area-inset-bottom, 0px)));
  padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  background-color: var(--primary-color);
  color: white;
  z-index: 999;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: var(--transition);
  background: none;
  border: none;
  padding: 0;
}

.bottom-nav-item:hover, .bottom-nav-item.active {
  color: white;
}

.bottom-nav-item.active svg {
  color: var(--accent-color);
  transform: translateY(-2px);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  transition: var(--transition);
}

/* Modal e Leitor Biométrico */
.biometric-scanner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  gap: 20px;
}

.fingerprint-sensor {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(12, 35, 64, 0.05);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.fingerprint-sensor svg {
  width: 44px;
  height: 44px;
  color: var(--primary-color);
}

.fingerprint-sensor.scanning {
  border-color: var(--accent-color);
  background: rgba(0, 180, 216, 0.05);
  animation: pulse-biometric 1.5s infinite;
}

.fingerprint-sensor.scanning svg {
  color: var(--accent-color);
}

.fingerprint-sensor.success-scan {
  border-color: var(--success);
  background: rgba(46, 196, 182, 0.05);
}

.fingerprint-sensor.success-scan svg {
  color: var(--success);
}

@keyframes pulse-biometric {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 180, 216, 0.4);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(0, 180, 216, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 180, 216, 0);
  }
}

.quick-user-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 15px;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  background-color: #fafbfc;
}

.quick-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
  font-weight: 500;
}

.quick-user-item:hover {
  background: rgba(12, 35, 64, 0.05);
  border-color: var(--primary-color);
}

.quick-user-role {
  font-size: 0.75rem;
}

/* Responsividade Mobile Estendida */
@media (max-width: 600px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; /* Evitar que conteúdo fique atrás do bottom nav */
  }

  .mobile-bottom-nav {
    display: flex;
  }

  /* Tabelas com scroll horizontal touch */
  .table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
  }
  
  .data-table {
    min-width: 800px;
  }

  /* Grids de formulários em 1 coluna */
  .form-grid, .filter-bar, .metrics-grid, .pos-container, .panel-header {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 15px;
  }

  .filter-bar .form-group, .filter-input, .filter-select, .btn {
    width: 100%;
  }

  .panel-header {
    align-items: flex-start;
  }

  .action-group {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  /* Cards Responsivos */
  .metric-card, .product-card, .panel {
    width: 100%;
    box-sizing: border-box;
  }

  /* Ajustar vídeo da câmera nos scanners */
  #barcode-scanner-sim video, #qrcode-scanner-sim video {
    transform: scaleX(-1); /* Efeito espelho */
  }
}
