/* ==========================================================================
   CONFIGURAÇÕES GERAIS E PALETA DE CORES (DESIGN SYSTEM)
   ========================================================================== */
:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta de Cores HSL - Estilo Dark Premium */
  --bg-app: hsl(222, 47%, 6%);
  --bg-sidebar: hsl(222, 35%, 9%);
  --bg-card: hsla(222, 28%, 12%, 0.7);
  --bg-input: hsl(222, 28%, 8%);
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(56, 189, 248, 0.15);

  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 65%);
  --text-muted: hsl(215, 16%, 47%);

  /* Cores de Destaque */
  --primary: hsl(199, 89%, 48%);
  --primary-hover: hsl(199, 95%, 40%);
  --primary-glow: rgba(56, 189, 248, 0.4);

  --accent-purple: hsl(271, 91%, 65%);
  --accent-purple-hover: hsl(271, 91%, 55%);
  --accent-purple-glow: rgba(168, 85, 247, 0.3);

  --success: hsl(150, 76%, 50%);
  --success-glow: rgba(52, 211, 153, 0.2);

  --danger: hsl(342, 89%, 48%);
  --danger-hover: hsl(342, 95%, 40%);
  --danger-glow: rgba(244, 63, 94, 0.3);

  --warning: hsl(38, 92%, 50%);

  /* Transições e Sombras */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --glass-blur: 16px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* BARRA DE NAVEGAÇÃO LATERAL (SIDEBAR) */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
  z-index: 100;
  transition: transform var(--transition-medium);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 8px 4px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.accent-dot {
  color: var(--accent-purple);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.nav-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.nav-item:hover .nav-icon {
  transform: translateX(2px);
}

.nav-item.active {
  background-image: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(168, 85, 247, 0.05));
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.05);
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

/* PAINEL DE STATUS DO LEITOR */
.sidebar-footer {
  margin-top: auto;
}

.connection-status-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: 14px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.status-indicator.connected {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success-glow);
}

.status-indicator.disconnected {
  background-color: var(--text-muted);
}

.status-indicator.connecting {
  background-color: var(--warning);
  animation: pulse-warn 1.5s infinite;
}

.status-indicator.scanning {
  background-color: var(--accent-purple);
  animation: pulse-scan 1s infinite;
}

.connection-details {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.status-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.status-device {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.btn-connect-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-connect-icon:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* CONTEÚDO PRINCIPAL */
.main-content {
  flex-grow: 1;
  padding: 40px;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* CADASTRADOS E CABEÇALHOS */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 4px;
}

.action-bar {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   ELEMENTOS DE UI / COMPONENTES
   ========================================================================== */

/* BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background-color: var(--primary);
  color: hsl(222, 47%, 6%);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-primary);
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
  box-shadow: 0 6px 20px var(--danger-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-full {
  width: 100%;
}

/* GRADE DE ESTATÍSTICAS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(var(--glass-blur));
  transition: border-color var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--border-glow);
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrapper svg {
  width: 24px;
  height: 24px;
}

.stat-icon-wrapper.blue {
  background-color: rgba(56, 189, 248, 0.1);
  color: var(--primary);
}

.stat-icon-wrapper.purple {
  background-color: rgba(168, 85, 247, 0.1);
  color: var(--accent-purple);
}

.stat-icon-wrapper.green {
  background-color: rgba(52, 211, 153, 0.1);
  color: var(--success);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2px;
}

/* BIG NUMBER CARDS */
.stat-card.bignumber-card {
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card.bignumber-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.stat-card.bignumber-card.blue:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.stat-card.bignumber-card.green:hover {
  border-color: rgba(52, 211, 153, 0.4);
}

.stat-card.bignumber-card.amber:hover {
  border-color: rgba(245, 158, 11, 0.4);
}

.stat-card.bignumber-card.red:hover {
  border-color: rgba(248, 113, 113, 0.4);
}

.stat-value.bignumber {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-top: 4px;
}

.stat-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* COMBOBOX BUSCÁVEL (SEARCHABLE DROPDOWN) */
.searchable-combobox-wrapper {
  position: relative;
  width: 100%;
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 1000;
  padding: 6px 0;
  backdrop-filter: blur(16px);
}

.combobox-dropdown.hidden {
  display: none;
}

.combobox-item {
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.combobox-item:hover, .combobox-item.selected {
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--primary);
}

.combobox-item .combobox-subtext {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.combobox-empty {
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* CARDS E PAINÉIS */
.content-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(var(--glass-blur));
  display: flex;
  flex-direction: column;
  min-width: 0; /* Impede vazamento horizontal em layouts flex/grid */
  word-wrap: break-word;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.card-filters {
  display: flex;
  gap: 12px;
}

.input-search, .select-filter, .form-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  border-radius: 10px;
  transition: all var(--transition-fast);
}

.input-search {
  padding: 8px 16px;
  width: 240px;
}

.select-filter {
  padding: 8px 12px;
  cursor: pointer;
}

.input-search:focus, .select-filter:focus, .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* TABELAS */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th, .data-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.font-mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

/* BADGES DE STATUS */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.success {
  background-color: rgba(52, 211, 153, 0.1);
  color: var(--success);
}

.badge.info {
  background-color: rgba(56, 189, 248, 0.1);
  color: var(--primary);
}

.badge.purple {
  background-color: rgba(168, 85, 247, 0.1);
  color: var(--accent-purple);
}

.badge.warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge.danger {
  background-color: rgba(248, 113, 113, 0.1);
  color: var(--danger);
}

/* SINAL RSSI */
.rssi-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rssi-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 18px;
  height: 12px;
}

.rssi-bar {
  width: 3px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
}

.rssi-bar:nth-child(1) { height: 25%; }
.rssi-bar:nth-child(2) { height: 50%; }
.rssi-bar:nth-child(3) { height: 75%; }
.rssi-bar:nth-child(4) { height: 100%; }

.rssi-container.strong .rssi-bar { background-color: var(--success); }
.rssi-container.medium .rssi-bar:nth-child(-n+3) { background-color: var(--primary); }
.rssi-container.weak .rssi-bar:nth-child(-n+2) { background-color: var(--warning); }
.rssi-container.very-weak .rssi-bar:nth-child(1) { background-color: var(--danger); }

/* ESTADO VAZIO */
.empty-state {
  text-align: center;
  padding: 60px 20px !important;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* TAB NAVEGAÇÃO COMPORTAMENTO */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.tab-content.active {
  display: flex;
  animation: fadeIn var(--transition-medium);
}

/* ==========================================================================
   ABAS DE CADASTRADOS, CSV E CONFIGURAÇÕES
   ========================================================================== */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* FORMULÁRIOS */
.card-body {
  padding: 24px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

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

.form-input {
  padding: 12px;
  width: 100%;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* BLUETOOTH PAINEL */
.bluetooth-panel {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.device-status-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 6px;
}

.device-name-bold {
  font-weight: 600;
}

.btn-group-row {
  display: flex;
  gap: 12px;
}

.device-list-container {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.device-list-container h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.device-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.device-list-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: var(--primary);
}

/* ZONE DE UPLOAD DE CSV */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.upload-zone:hover {
  border-color: var(--primary);
  background-color: rgba(56, 189, 248, 0.02);
  color: var(--text-primary);
}

.upload-icon {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
}

.feedback-msg {
  margin-top: 12px;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: 8px;
  display: none;
}

.feedback-msg.success {
  display: block;
  background-color: rgba(52, 211, 153, 0.1);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.feedback-msg.error {
  display: block;
  background-color: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.code-preview {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-top: 8px;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 100%;
}

.export-actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.export-box {
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.01);
}

.export-box h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.export-box p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ==========================================================================
   MODAL BACKDROP E DIALOG
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast);
}

.modal-card {
  width: 90%;
  max-width: 480px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp var(--transition-medium);
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

/* ==========================================================================
   ELEMENTOS DE ANIMAÇÃO E AUXILIARES
   ========================================================================== */
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse-warn {
  0% { opacity: 0.5; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { opacity: 1; box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { opacity: 0.5; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes pulse-scan {
  0% { opacity: 0.6; box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.5); }
  70% { opacity: 1; box-shadow: 0 0 0 8px rgba(168, 85, 247, 0); }
  100% { opacity: 0.6; box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  /* BARRA DE NAVEGAÇÃO INFERIOR */
  .sidebar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    width: 100%;
    height: calc(65px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    border-right: none;
    flex-direction: row;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
    transform: none !important;
    z-index: 150;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }

  .sidebar .logo-area,
  .sidebar .sidebar-footer {
    display: none !important;
  }

  .nav-menu {
    flex-direction: row !important;
    width: 100%;
    height: 100%;
    gap: 0;
  }

  .nav-item {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 6px 0;
    flex: 1;
    height: 100%;
    border-radius: 0;
    background: none;
    border: none;
    text-align: center;
    color: var(--text-secondary);
  }

  .nav-item:hover {
    background: none;
  }

  .nav-item.active {
    background: none !important;
    color: var(--primary) !important;
    border: none !important;
    box-shadow: none !important;
  }

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

  .nav-icon {
    width: 22px;
    height: 22px;
  }

/* ==========================================================================
   CABEÇALHO SUPERIOR MÓVEL (EXCLUSIVO PARA DISPOSITIVOS MÓVEIS)
   ========================================================================== */
.mobile-header {
  display: none;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background-color: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 150;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
  }

  .mobile-logo svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
    filter: drop-shadow(0 0 6px var(--primary-glow));
  }

  .mobile-connection-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
  }
}


  /* AJUSTE DE CONTEÚDO */
  .main-content {
    padding: 16px;
    padding-bottom: 85px; /* Evita que o conteúdo seja cortado pelo menu inferior */
    height: auto;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .action-bar {
    width: 100%;
  }

  .action-bar .btn {
    flex: 1;
  }

  .grid-2-col {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }

  .card-filters {
    width: 100%;
    flex-direction: column;
  }

  .input-search,
  .select-filter {
    width: 100%;
  }

  /* TRANSFORMAÇÃO DE TABELAS EM CARD NO MOBILE (RETIRA O SCROLL HORIZONTAL) */
  .table-container {
    overflow-x: hidden;
  }

  .data-table, 
  .data-table thead, 
  .data-table tbody, 
  .data-table tr, 
  .data-table th, 
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    transition: transform var(--transition-fast);
  }

  .data-table tbody tr:active {
    transform: scale(0.98);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    text-align: right;
  }

  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: left;
  }

  .font-mono {
    font-size: 0.75rem !important;
    word-break: break-all;
    max-width: 60%;
  }
}

/* ==========================================================================
   TELA DE LOGIN (ESTILO GLASSMORPHISM PREMIUM)
   ========================================================================== */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: radial-gradient(circle at 20% 30%, rgba(56, 189, 248, 0.08), transparent), 
                    radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.06), transparent);
  background-color: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(var(--glass-blur));
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalScaleUp var(--transition-medium);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-logo .logo-icon {
  width: 36px;
  height: 36px;
  color: var(--primary);
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.login-logo .logo-text {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   RFID TAG LOCATOR & PROXIMITY SIGNAL (RSSI)
   ========================================================================== */
.radar-pulse-locator {
  width: 12px;
  height: 12px;
  background-color: var(--primary);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  animation: radarPulse 1.5s infinite ease-out;
}

@keyframes radarPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(56, 189, 248, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
}

.locator-gauge-container {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0.2) 100%);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  padding: 8px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.4);
}

.locator-gauge-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.locator-percentage {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.locator-distance {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cores de calor do localizador baseados em classes */
.locator-cold {
  border-color: rgba(56, 189, 248, 0.4) !important;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}
.locator-warm {
  border-color: rgba(168, 85, 247, 0.5) !important;
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.25);
}
.locator-hot {
  border-color: rgba(244, 63, 94, 0.7) !important;
  box-shadow: 0 0 35px rgba(244, 63, 94, 0.35);
}

/* Modais e fechamento */
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

/* ==========================================================================
   PICKING CARD & ITEMS
   ========================================================================== */
.order-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  text-align: left;
}

.order-card:hover, .order-card.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.order-id {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.order-client {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.order-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Itens de Picking Checklist */
.picking-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease, border-color 0.3s ease;
  text-align: left;
}

.picking-item.completed {
  background: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.25);
}

.picking-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.picking-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.picking-item-count {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.picking-item.completed .picking-item-count {
  color: var(--success);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  padding: 16px 20px;
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(120%);
  opacity: 0;
  animation: slideInToast 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  backdrop-filter: blur(var(--glass-blur));
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast.toast-error {
  border-left-color: var(--danger);
}

.toast.toast-info {
  border-left-color: var(--primary);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-info .toast-icon {
  color: var(--primary);
}

.toast-content {
  flex-grow: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toast.hiding {
  animation: slideOutToast 0.3s ease-in forwards;
}

@keyframes slideInToast {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToast {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .toast-container {
    bottom: 80px; /* Acima do menu inferior */
    right: 16px;
    left: 16px;
    align-items: center;
  }
  .toast {
    width: 100%;
    max-width: 100%;
  }
}

/* ==========================================================================
   CARDS DE AÇÕES RÁPIDAS (DASHBOARD HOME)
   ========================================================================== */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}

.action-card-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(var(--glass-blur));
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  position: relative;
  overflow: hidden;
  text-align: left;
}

.action-card-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.action-card-btn:hover::before {
  opacity: 1;
}

.action-card-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  background-color: hsla(222, 28%, 15%, 0.85);
}

.action-card-btn.reader:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.15);
}

.action-card-btn.checkin:hover {
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 10px 24px rgba(52, 211, 153, 0.15);
}

.action-card-btn.picking:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 10px 24px rgba(168, 85, 247, 0.15);
}

.action-card-btn.audit:hover {
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 10px 24px rgba(251, 191, 36, 0.15);
}

.action-card-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.action-card-btn:hover .action-card-icon-wrapper {
  transform: scale(1.08);
}

.action-card-btn.reader .action-card-icon-wrapper {
  background-color: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.2));
}

.action-card-btn.checkin .action-card-icon-wrapper {
  background-color: rgba(52, 211, 153, 0.1);
  color: var(--success);
  filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.2));
}

.action-card-btn.picking .action-card-icon-wrapper {
  background-color: rgba(168, 85, 247, 0.1);
  color: var(--accent-purple);
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.2));
}

.action-card-icon-wrapper svg {
  width: 24px;
  height: 24px;
}

.action-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.action-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.action-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Responsividade para telas maiores no dashboard */
@media (min-width: 600px) {
  .quick-actions-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .action-card-btn {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px;
    height: 100%;
  }
  .action-card-info {
    margin-top: 8px;
  }
}
