/**
 * AgriNewBras & Brant Solutions • Layout Híbrido V2 (Navigation Rail + Wizard + Drawer Retrátil + Dock Flutuante)
 * Subdomínio de Homologação: irrigacao.elorium.com.br
 * Padrão Ergonômico de Alta Produtividade e Zero-Lag
 */

:root {
  --rail-width: 56px;
  --drawer-width: 420px;
  --top-height: 56px;
  --primary: #007a3d;
  --primary-dark: #00562b;
  --primary-light: #e6f4ea;
  --accent-water: #0077b6;
  --accent-water-dark: #023e8a;
  --accent-water-light: #e0f2fe;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  --transition-fast: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* WIZARD BAR INTEGRADO AO TOPO */
.wizard-header-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border-radius: 30px;
  padding: 3px 6px;
  border: 1px solid var(--border);
}

.wizard-step-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.wizard-step-pill:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.wizard-step-pill.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 122, 61, 0.25);
}

.wizard-step-pill.completed {
  color: var(--primary);
  background: var(--primary-light);
}

.wizard-step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.wizard-step-pill.active .wizard-step-num {
  background: #ffffff;
  color: var(--primary);
}

/* WORKSPACE COM NAVIGATION RAIL E MAPA FULLSCREEN */
.workspace-v2 {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: calc(100vh - var(--top-height));
  height: calc(100dvh - var(--top-height));
}

/* NAVIGATION RAIL LATERAL (56px) */
.nav-rail {
  width: var(--rail-width);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 16px 0;
  z-index: 1002;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.rail-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.rail-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--transition-fast);
}

.rail-btn:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  transform: translateY(-1px);
}

.rail-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 122, 61, 0.15);
}

.rail-btn .rail-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tooltip nativo do Rail */
.rail-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 58px;
  background: #1e293b;
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-6px);
  transition: all 0.18s ease;
  z-index: 2000;
  box-shadow: var(--shadow-md);
}

.rail-btn:hover[data-tooltip]::after {
  opacity: 1;
  transform: translateX(0);
}

/* DRAWER LATERAL RETRÁTIL (420px) */
.side-drawer {
  position: absolute;
  top: 0;
  left: var(--rail-width);
  width: var(--drawer-width);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform var(--transition-fast);
}

.side-drawer.collapsed {
  transform: translateX(calc(-100% - var(--rail-width) - 20px));
}

.drawer-header {
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  flex-shrink: 0;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-drawer-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}

.btn-drawer-close:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* MAP WRAPPER FULLSCREEN */
.map-wrapper-v2 {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* DOCK DE AÇÕES FLUTUANTE INFERIOR */
.floating-action-dock {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 10px;
  border-radius: 30px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.25s ease;
}

.dock-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.dock-badge.badge-highlight {
  background: var(--accent-water-light);
  color: var(--accent-water-dark);
  border-color: #bae6fd;
}

.dock-badge.badge-success-glow {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: #bbf7d0;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.dock-btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 122, 61, 0.3);
}

.dock-btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.dock-btn-secondary {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.dock-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.dock-btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.dock-btn-danger:hover {
  background: #fee2e2;
}

/* GAVETA DOS PANES */
.drawer-pane {
  display: none;
}

.drawer-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

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

/* RESPONSIVIDADE MOBILE (< 768px) */
@media (max-width: 768px) {
  .wizard-header-bar {
    display: none; /* Em celular simplifica para economizar espaço */
  }

  .nav-rail {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 52px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 0 8px;
  }

  .rail-group {
    flex-direction: row;
    justify-content: space-around;
  }

  .rail-group-bottom {
    display: none;
  }

  .side-drawer {
    left: 0;
    width: 100%;
    height: 70vh;
    bottom: 52px;
    top: auto;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    transform: translateY(0);
  }

  .side-drawer.collapsed {
    transform: translateY(120%);
  }

  .floating-action-dock {
    bottom: 64px;
    width: calc(100% - 24px);
    justify-content: space-between;
    padding: 6px 8px;
    overflow-x: auto;
  }

  .dock-badge {
    display: none; /* esconde badges no dock no mobile para caber os botões */
  }
}
