/* ==========================================================================
   Componentes de Interface - MapeiaDrone
   ========================================================================== */

/* === CARDS DE SEÇÃO DA SIDEBAR === */
.sidebar-section {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-section:focus-within,
.sidebar-section:hover {
  border-color: rgba(0, 242, 254, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-accent);
}

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

/* === MODO DE MISSÃO (CHIPS / ABAS) === */
.mode-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mode-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.mode-chip svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  transition: stroke var(--transition-fast);
}

.mode-chip:hover {
  color: var(--text-primary);
  border-color: rgba(0, 242, 254, 0.4);
  background: rgba(0, 242, 254, 0.05);
}

.mode-chip.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.mode-chip.active svg {
  stroke: var(--accent-cyan);
}

/* === FORM CONTROLS: INPUTS, SELECTS, SLIDERS === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.form-value-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.form-select, .form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  padding: 8px 10px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.form-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-full);
  outline: none;
  margin: 6px 0;
}

.form-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-cyan-glow);
  transition: transform var(--transition-fast);
}

.form-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* === TOGGLE SWITCH === */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.toggle-label {
  font-size: 0.78rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

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

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-surface-2);
  transition: var(--transition-fast);
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: var(--transition-fast);
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

input:checked + .slider-toggle:before {
  transform: translateX(16px);
  background-color: #080c14;
}

/* === BADGE DE GSD E QUALIDADE === */
.gsd-quality-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gsd-badge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gsd-badge-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.gsd-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.gsd-stats-row strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* === BOTÕES PRINCIPAIS E AÇÕES === */
.btn-primary-neon {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), #00b4d8);
  color: #041017;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-neon);
  transition: all var(--transition-fast);
}

.btn-primary-neon:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.5);
}

.btn-primary-neon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.2);
  border-color: var(--text-muted);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* === BOTÕES DE EXPORTAÇÃO === */
.export-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-export {
  padding: 9px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.btn-export:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
}

.btn-export:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* === SIMULADOR HUD FLUTUANTE === */
.simulation-hud-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: none;
  flex-direction: column;
  gap: 10px;
}

.simulation-hud-card.active {
  display: flex;
}

.sim-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sim-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sim-round {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sim-round:hover {
  background: var(--accent-cyan);
  color: #080c14;
}

.sim-speed-pill {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  color: var(--text-muted);
  cursor: pointer;
}

.sim-speed-pill.active {
  background: var(--accent-cyan);
  color: #080c14;
  font-weight: 700;
}

/* Marcador e ícone Leaflet do drone simulado */
.sim-drone-hud {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.05s linear;
}

.sim-drone-heading-arrow {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid var(--accent-cyan);
  filter: drop-shadow(0 0 4px var(--accent-cyan));
}

.sim-drone-body {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.2);
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === MODAIS MODERNOS GLASSMORPHISM === */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: var(--modal-backdrop-bg);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevation);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-footer);
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  border-left: 4px solid var(--accent-cyan);
  box-shadow: var(--shadow-elevation);
  color: var(--text-primary);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.3s ease-out;
  min-width: 260px;
  max-width: 380px;
}

.toast.toast-success { border-left-color: var(--accent-green); }
.toast.toast-warning { border-left-color: var(--accent-amber); }
.toast.toast-error { border-left-color: var(--accent-red); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   TEMA CLARO - OVERRIDES DE COMPONENTES (LIGHT MODE EXCELLENCE)
   ========================================================================== */
[data-theme="light"] .sidebar-section {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .sidebar-section:focus-within,
[data-theme="light"] .sidebar-section:hover {
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
}

[data-theme="light"] .mode-chip {
  background: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="light"] .mode-chip svg {
  stroke: var(--text-muted);
}

[data-theme="light"] .mode-chip:hover {
  color: #0284c7;
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
}

[data-theme="light"] .mode-chip:hover svg {
  stroke: #0284c7;
}

[data-theme="light"] .mode-chip.active {
  background: rgba(2, 132, 199, 0.12);
  border-color: #0284c7;
  color: #0284c7;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.25);
}

[data-theme="light"] .mode-chip.active svg {
  stroke: #0284c7;
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select {
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.28);
  color: var(--text-primary);
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

[data-theme="light"] .form-value-tag {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
}

[data-theme="light"] .btn-primary-neon {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

[data-theme="light"] .btn-primary-neon:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.25);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #0284c7;
  color: #0284c7;
}

[data-theme="light"] .btn-export {
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.25);
  color: var(--text-primary);
}

[data-theme="light"] .btn-export:hover:not(:disabled) {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
  color: #0284c7;
}

[data-theme="light"] .gsd-quality-card {
  background: #f8fafc;
  border-color: var(--border-subtle);
}

[data-theme="light"] .slider-toggle {
  background-color: #cbd5e1;
}

[data-theme="light"] input:checked + .slider-toggle {
  background-color: #0284c7;
  border-color: #0284c7;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.35);
}

[data-theme="light"] input:checked + .slider-toggle:before {
  background-color: #ffffff;
}

[data-theme="light"] .range-slider {
  background: #e2e8f0;
}

[data-theme="light"] .range-slider::-webkit-slider-thumb {
  background: #0284c7;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.4);
}

[data-theme="light"] .toast {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
}

/* Controles Leaflet adaptados ao Tema Claro */
[data-theme="light"] .leaflet-bar,
[data-theme="light"] .leaflet-draw-toolbar a {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(100, 116, 139, 0.25) !important;
}

[data-theme="light"] .leaflet-bar a:hover {
  background-color: #f1f5f9 !important;
  color: #0284c7 !important;
}

/* Botão de Toggle de Tema */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
}

.theme-toggle-btn .theme-icon {
  font-size: 14px;
  line-height: 1;
}


/* Controles que não se aplicam ao tipo de missão escolhido */
.mode-hidden { display: none !important; }

/* Selo "beta" nos exportadores ainda não validados em campo */
.beta-tag {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.03em;
  padding: 0 4px;
  margin-left: 3px;
  border-radius: 3px;
  border: 1px solid currentColor;
  opacity: 0.6;
  vertical-align: middle;
}
