/* ==========================================================================
   FLOWPDV GESTOR MOBILE (COMPANION APP) - MASTER ADMIN THEME
   Dark Slate #0f172a • Cyan #38bdf8 • Violet #7c3aed • Emerald #10b981
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700;800&display=swap');

:root {
  --bg-app: #0f172a;
  --bg-surface-1: #1e293b;
  --bg-surface-2: #273549;
  --bg-surface-3: #334155;
  --border-subtle: #1e293b;
  --border-card: #334155;
  --border-highlight: rgba(99, 102, 241, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-cyan-light: rgba(56, 189, 248, 0.15);
  --accent-cyan-glow: rgba(56, 189, 248, 0.3);

  --accent-purple: #7c3aed;
  --accent-purple-hover: #6d28d9;
  --accent-purple-light: rgba(124, 58, 237, 0.15);
  --accent-purple-glow: rgba(124, 58, 237, 0.35);

  --accent-green: #10b981;
  --accent-green-light: rgba(16, 185, 129, 0.15);
  --accent-green-border: rgba(16, 185, 129, 0.3);

  --accent-amber: #f59e0b;
  --accent-amber-light: rgba(245, 158, 11, 0.15);

  --accent-red: #ef4444;
  --accent-red-light: rgba(239, 68, 68, 0.15);

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 30px -5px rgba(0, 0, 0, 0.7);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  user-select: none;
}

/* Container Principal Mobile (Limitado a 500px para telas de tablet/PC) */
.mobile-app-shell {
  width: 100%;
  max-width: 500px;
  min-height: 100vh;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   TELA DE LOGIN DO DONO / GESTOR
   ========================================================================== */
#screen-login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at top right, #1e1b4b 0%, #0f172a 70%);
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-header-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-logo-img {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.login-title {
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.login-title span {
  color: var(--accent-cyan);
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group-mobile {
  text-align: left;
  margin-bottom: 18px;
}

.form-label-mobile {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.input-wrapper-mobile {
  position: relative;
  display: flex;
  align-items: center;
}

.input-mobile {
  width: 100%;
  height: 48px;
  background: #0b0f19;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0 16px;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  outline: none;
  transition: all 0.2s ease;
}

.input-mobile:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.input-mobile.uppercase {
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-mobile.mono {
  font-family: 'JetBrains Mono', monospace;
}

.btn-toggle-pass {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.remember-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.btn-login-submit {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, var(--accent-purple), #4f46e5);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-purple-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn-login-submit:active {
  background: var(--accent-purple-hover);
}

.login-error-toast {
  display: none;
  background: var(--accent-red-light);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  text-align: left;
}

/* ==========================================================================
   INTERFACE DO APP (HEADER, CONTEÚDO E BOTTOM TABBAR)
   ========================================================================== */
.app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 85px; /* Espaço para a barra inferior fixa */
}

/* Header Superior Fixo */
.mobile-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-card);
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-store-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-store-name {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.header-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-green);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-action {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-header-action:active {
  background: var(--bg-surface-2);
}

.rotating {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Área de Conteúdo / Telas */
.mobile-tab-view {
  display: none;
  padding: 16px;
  flex-direction: column;
  gap: 14px;
}

.mobile-tab-view.active {
  display: flex;
}

/* Cards de Métricas Principais */
.hero-metric-card {
  background: linear-gradient(135deg, #1e293b 0%, #1e1b4b 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--accent-purple-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-value {
  font-size: 32px;
  font-weight: 900;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  margin: 6px 0;
  display: block;
}

.hero-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.grid-2-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.small-metric-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.small-metric-card.alert {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.small-metric-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  display: block;
}

.small-metric-value {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
  display: block;
}

/* Seções e Listas */
.section-title-mobile {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  margin-bottom: 2px;
}

.badge-pill-count {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

/* Cards de Lista (Vendas, Produtos, Contas, Auditoria) */
.mobile-list-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.mobile-list-card:active {
  background: var(--bg-surface-2);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-item-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}

.card-item-price {
  font-size: 14.5px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-green);
  white-space: nowrap;
}

.card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Badges Coloridos */
.badge-tag-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-tag-sm.ok {
  background: var(--accent-green-light);
  color: var(--accent-green);
  border: 1px solid var(--accent-green-border);
}

.badge-tag-sm.low {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-tag-sm.zero {
  background: var(--accent-red-light);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-tag-sm.purple {
  background: var(--accent-purple-light);
  color: #c084fc;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.badge-tag-sm.blue {
  background: var(--accent-cyan-light);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Botão WhatsApp Cobrança */
.btn-whatsapp-mobile {
  background: #25d366;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp-mobile:active {
  background: #128c7e;
}

/* Barra de Pesquisa e Filtros */
.mobile-search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 44px;
}

.mobile-search-input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  width: 100%;
  outline: none;
  margin-left: 8px;
}

/* Carrossel de Filtros com Navegação Lateral e Scroll por Toque */
.filter-carousel-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  width: 100%;
}

.btn-carousel-arrow {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  padding: 0;
  line-height: 1;
}

.btn-carousel-arrow:hover {
  background: var(--bg-surface-2);
  color: #ffffff;
  border-color: var(--accent-cyan);
}

.btn-carousel-arrow:active {
  background: var(--bg-surface-3);
  transform: scale(0.92);
}

.filter-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.filter-chips-row::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 15px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.chip-btn:hover {
  color: #ffffff;
  border-color: var(--border-highlight);
}

.chip-btn.active {
  background: linear-gradient(135deg, var(--accent-purple), #4f46e5);
  color: #ffffff;
  border-color: var(--accent-purple);
  box-shadow: 0 2px 10px var(--accent-purple-glow);
}

/* ==========================================================================
   BARRA DE NAVEGAÇÃO INFERIOR FIXA (BOTTOM TABBAR)
   ========================================================================== */
.bottom-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0 calc(env(safe-area-inset-bottom, 0px) + 8px) 0;
  z-index: 999;
}

.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 12px;
  transition: color 0.15s ease;
  position: relative;
}

.tabbar-icon {
  font-size: 19px;
  transition: transform 0.15s ease;
}

.tabbar-item.active {
  color: var(--accent-cyan);
}

.tabbar-item.active .tabbar-icon {
  transform: scale(1.1);
}

/* Empty States & Placeholders */
.empty-state-mobile {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state-icon {
  font-size: 36px;
  opacity: 0.7;
}

/* Modal Bottom Sheet */
.modal-bottom-sheet {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10000;
  justify-content: center;
  align-items: flex-end;
}

.modal-bottom-content {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface-1);
  border-top: 1px solid var(--border-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 20px calc(env(safe-area-inset-bottom, 0px) + 20px) 20px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.7);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
