/* ==============================================================================
   ESTILOS GERAIS & DESIGN SYSTEM - SISTEMA DE VALIDAÇÃO SWITCH MERAKI
   ============================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(28, 36, 56, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.35);
  --primary-light: #60a5fa;
  
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.3);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --success-bg: rgba(16, 185, 129, 0.12);
  
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.3);
  --warning-bg: rgba(245, 158, 11, 0.12);
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --danger-bg: rgba(239, 68, 68, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px var(--border-color);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.5) 0%, transparent 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* ==============================================================================
   HEADER & NAVBAR (MOBILE RESPONSIVE)
   ============================================================================== */
.navbar {
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 15px var(--primary-glow);
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  flex-direction: column;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

.unit-badge-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-badge-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ==============================================================================
   MAIN CONTAINER & STEPPER
   ============================================================================== */
.main-wrapper {
  max-width: 900px;
  width: 100%;
  margin: 16px auto;
  padding: 0 14px 40px;
  flex: 1;
}

.stepper-container {
  margin-bottom: 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.stepper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.stepper-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.stepper-progress-bar {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  border-radius: var(--radius-full);
  transition: width var(--transition-smooth);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.step-dots-scroll {
  overflow-x: auto;
  padding: 10px 0 4px;
  scrollbar-width: none;
}
.step-dots-scroll::-webkit-scrollbar { display: none; }

.step-dots {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 320px;
}

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.step-dot.active {
  background: var(--primary);
  border-color: var(--primary-light);
  color: #fff;
  box-shadow: 0 0 12px var(--primary-glow);
  transform: scale(1.15);
}

.step-dot.completed {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

/* ==============================================================================
   CARDS & CONTAINERS DE CONTEÚDO
   ============================================================================== */
.step-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.25s ease-out;
}

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

.card-header {
  margin-bottom: 20px;
}

.step-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: var(--primary-light);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==============================================================================
   FORMULÁRIOS & BUSCA (SMARTPHONE FRIENDLY - 16px INPUTS)
   ============================================================================== */
.unit-search-box {
  position: relative;
  margin: 16px 0;
}

.input-with-icon {
  position: relative;
  width: 100%;
}

.input-with-icon .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
}

.form-control {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 46px;
  font-size: 16px; /* Evita auto-zoom no Safari iOS */
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
  min-height: 48px;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(15, 23, 42, 0.98);
}

.unit-dropdown-results {
  max-height: 280px;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 6px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.7);
  -webkit-overflow-scrolling: touch;
}

.unit-dropdown-item {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background var(--transition-fast);
  min-height: 52px;
}

.unit-dropdown-item:last-child {
  border-bottom: none;
}

.unit-dropdown-item:active, .unit-dropdown-item:hover {
  background: rgba(37, 99, 235, 0.25);
}

.unit-number-badge {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-cyan);
}

.unit-name-text {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.unit-city-text {
  font-size: 12px;
  color: var(--text-muted);
}

.status-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.status-tag.in-progress {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-tag.new {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
}

/* ==============================================================================
   ÁREA DE FOTOS E CAPTURA DE CÂMERA
   ============================================================================== */
.photo-capture-zone {
  margin: 18px 0;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 20px 14px;
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  transition: all var(--transition-fast);
}

.camera-preview-box {
  width: 100%;
  max-height: 320px;
  min-height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #050811;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.camera-preview-box img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.photo-buttons-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-direction: column;
}

@media (min-width: 600px) {
  .photo-buttons-group {
    flex-direction: row;
  }
}

.photo-file-status {
  margin-top: 10px;
  font-size: 13px;
}

/* ==============================================================================
   ILUSTRAÇÕES E DIAGRAMAS TÉCNICOS
   ============================================================================== */
.diagram-container {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 16px 0;
  text-align: center;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}

.diagram-container img, .diagram-container svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ==============================================================================
   PAINEL VISUAL DO SWITCH MERAKI (24 PORTAS RESPONSIVO)
   ============================================================================== */
.switch-visualizer {
  background: #090e1a;
  border: 1.5px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 16px 12px;
  margin: 20px 0;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.switch-chassis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 8px;
}

.switch-brand {
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 13px;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.switch-grid-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.switch-grid-ports {
  display: grid;
  grid-template-columns: repeat(12, minmax(48px, 1fr));
  gap: 6px;
  min-width: 600px;
}

@media (max-width: 640px) {
  .switch-grid-ports {
    grid-template-columns: repeat(6, 1fr);
    min-width: 100%;
  }
}

.port-slot {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 6px 2px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  min-height: 48px;
}

.port-slot:active, .port-slot:hover {
  border-color: #60a5fa;
  background: #1e293b;
}

.port-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin: 0 auto 4px;
  background: #4b5563;
}

.port-slot.connected .port-led {
  background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
}

.port-slot.target-correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.15);
}

.port-slot.target-wrong {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.2);
  animation: pulse-danger 1.5s infinite;
}

@keyframes pulse-danger {
  0%, 100% { border-color: var(--danger); }
  50% { border-color: #fca5a5; }
}

.port-slot.uplink {
  border-color: var(--accent-cyan);
}

.port-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.port-tag-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  margin-top: 3px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.port-tag-badge.printer { background: #0284c7; color: #fff; }
.port-tag-badge.special { background: #7c3aed; color: #fff; }
.port-tag-badge.warn { background: var(--danger); color: #fff; }

/* ==============================================================================
   ALERTAS E FEEDBACK
   ============================================================================== */
.alert-box {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 14px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
}

.alert-box.alert-success { background: var(--success-bg); border: 1px solid rgba(16, 185, 129, 0.3); color: #a7f3d0; }
.alert-box.alert-danger { background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.alert-box.alert-warning { background: var(--warning-bg); border: 1px solid rgba(245, 158, 11, 0.3); color: #fde68a; }
.alert-box.alert-info { background: rgba(37, 99, 235, 0.12); border: 1px solid rgba(59, 130, 246, 0.3); color: #bfdbfe; }

.alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==============================================================================
   CRONÔMETRO
   ============================================================================== */
.timer-card {
  background: #0a0e17;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  margin: 16px 0;
}

.timer-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 42px;
  font-weight: 800;
  color: var(--accent-cyan);
  text-shadow: 0 0 20px var(--accent-cyan-glow);
  letter-spacing: 2px;
  margin: 8px 0;
}

.timer-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==============================================================================
   BOTÕES E AÇÕES (SMARTPHONE TOUCH TARGETS - MIN 48px)
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
  outline: none;
  min-height: 48px;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:active { transform: scale(0.98); }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--success-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-touch-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}

.btn-block-mobile {
  width: 100%;
}

.btn-mobile-touch {
  min-height: 50px;
  width: 100%;
  font-size: 15px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  min-height: 52px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  gap: 10px;
}

.mobile-action-bar {
  flex-direction: column-reverse;
}

@media (min-width: 500px) {
  .mobile-action-bar {
    flex-direction: row;
  }
}

.mobile-action-bar button, .mobile-action-bar .btn {
  width: 100%;
}

@media (min-width: 500px) {
  .mobile-action-bar button, .mobile-action-bar .btn {
    width: auto;
  }
}

/* ==============================================================================
   CHECKLIST INTERATIVO
   ============================================================================== */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.checklist-card-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 54px;
}

.checklist-card-item:active, .checklist-card-item:hover {
  background: rgba(30, 41, 59, 0.75);
  border-color: rgba(96, 165, 250, 0.3);
}

.checklist-card-item.checked {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
}

.custom-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.checklist-card-item.checked .custom-checkbox {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* ==============================================================================
   REVISÃO FINAL
   ============================================================================== */
.review-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.review-photo-card {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}

.review-photo-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.review-photo-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.review-photo-file {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent-cyan);
  word-break: break-all;
}

/* ==============================================================================
   MODAIS E TOASTS
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal-content {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 600px) {
  .toast-container {
    left: auto;
    right: 24px;
    max-width: 400px;
  }
}

.toast {
  background: #1e293b;
  color: #fff;
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-size: 13px;
  pointer-events: auto;
}

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