/* Configurações Globais & Variáveis */
:root {
  --bg-color: #0b0f19;
  --bg-gradient: radial-gradient(circle at 50% 50%, #151d30 0%, #0b0f19 100%);
  --card-bg: rgba(18, 26, 47, 0.6);
  --card-border: rgba(255, 255, 255, 0.06);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --neon-blue: #00d2ff;
  --neon-blue-glow: rgba(0, 210, 255, 0.35);
  
  --neon-green: #10b981;
  --neon-green-glow: rgba(16, 185, 129, 0.35);

  --neon-red: #ef4444;
  --neon-red-glow: rgba(239, 68, 68, 0.35);

  --neon-yellow: #f59e0b;
  --neon-yellow-glow: rgba(245, 158, 11, 0.35);

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Layout Principal */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.2rem;
}

.app-header .logo i {
  font-size: 2rem;
  color: var(--neon-blue);
  text-shadow: 0 0 10px var(--neon-blue-glow);
}

.app-header h1 {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.app-header h1 span {
  font-weight: 300;
  color: var(--text-secondary);
  font-size: 0.95rem;
  display: block;
  margin-top: -2px;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.online {
  background-color: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green-glow);
}

/* Main Grid */
.app-main {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  flex: 1;
}

@media (max-width: 1024px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

/* Estilos de Cards (Glassmorphism) */
.card-glass {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.card-glass h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.card-glass h2 i {
  color: var(--neon-blue);
}

/* Formulário de Informações */
.panel-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

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

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"] {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 8px var(--neon-blue-glow);
  background: rgba(0, 0, 0, 0.35);
}

/* Botões */
.btn {
  font-family: var(--font-family);
  font-weight: 600;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0082c8 0%, var(--neon-blue) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.2);
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--neon-blue-glow);
}

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

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

.btn-success {
  background: linear-gradient(135deg, #059669 0%, var(--neon-green) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--neon-green-glow);
}

.btn-large {
  padding: 15px 30px;
  font-size: 1.1rem;
  border-radius: 12px;
}

/* QR Code Card */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-instructions {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.4;
}

.qr-code-wrapper {
  background: white;
  padding: 15px;
  border-radius: 16px;
  margin-bottom: 20px;
  position: relative;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 210px;
  height: 210px;
}

.qr-code-wrapper img {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.9);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.qr-overlay span {
  font-size: 0.85rem;
  color: var(--neon-blue);
  font-weight: 500;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 210, 255, 0.2);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

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

.qr-link-copy {
  display: flex;
  gap: 8px;
  width: 100%;
}

.qr-link-copy input {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.4);
}

.qr-link-copy button {
  width: 44px;
  height: 44px;
  padding: 0;
}

/* Card Cabeçalho do Monitoramento */
.test-results-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.test-results-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 15px;
}

.test-results-card .card-header h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.connection-badge.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--neon-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.connection-badge.connected {
  background: rgba(16, 185, 129, 0.1);
  color: var(--neon-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Progresso */
.progress-container {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.progress-bar-wrapper {
  background: rgba(255, 255, 255, 0.05);
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-blue) 0%, var(--neon-green) 100%);
  box-shadow: 0 0 8px var(--neon-blue-glow);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.progress-label #progress-text {
  color: var(--text-secondary);
}

.progress-label #progress-percentage {
  font-weight: 700;
  color: var(--neon-blue);
}

/* Grade de Testes */
.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

/* Card do Teste */
.test-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.test-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: transparent;
  transition: all 0.3s ease;
}

.test-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.25rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.test-info {
  flex: 1;
}

.test-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text-primary);
}

.test-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.test-status .badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

/* Estados dos Cards de Teste */
/* PENDENTE */
.test-card.pending {
  border-color: rgba(255, 255, 255, 0.04);
}
.test-card.pending .badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* EM EXECUÇÃO */
.test-card.running {
  background: rgba(245, 158, 11, 0.03);
  border-color: rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.05);
}
.test-card.running::before {
  background: var(--neon-yellow);
}
.test-card.running .test-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--neon-yellow);
  animation: pulse-yellow-icon 1.5s infinite;
}
.test-card.running .badge {
  background: rgba(245, 158, 11, 0.2);
  color: var(--neon-yellow);
}

@keyframes pulse-yellow-icon {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); opacity: 0.8; }
  100% { transform: scale(1); }
}

/* SUCESSO / PASS */
.test-card.pass {
  background: rgba(16, 185, 129, 0.03);
  border-color: rgba(16, 185, 129, 0.25);
}
.test-card.pass::before {
  background: var(--neon-green);
}
.test-card.pass .test-icon {
  background: rgba(16, 185, 129, 0.15);
  color: var(--neon-green);
}
.test-card.pass .badge {
  background: rgba(16, 185, 129, 0.2);
  color: var(--neon-green);
}

/* FALHA / FAIL */
.test-card.fail {
  background: rgba(239, 68, 68, 0.03);
  border-color: rgba(239, 68, 68, 0.35);
}
.test-card.fail::before {
  background: var(--neon-red);
}
.test-card.fail .test-icon {
  background: rgba(239, 68, 68, 0.15);
  color: var(--neon-red);
}
.test-card.fail .badge {
  background: rgba(239, 68, 68, 0.25);
  color: var(--neon-red);
}

/* Laudo / Conclusão */
.laudo-container {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 15px;
  animation: slide-up 0.4s ease;
}

@keyframes slide-up {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.laudo-alert {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.laudo-alert i {
  font-size: 1.8rem;
  margin-top: 2px;
}

.laudo-alert h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.laudo-alert p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.laudo-container .btn-success {
  width: 100%;
}

.text-neon-blue { color: var(--neon-blue); }
.text-neon-green { color: var(--neon-green); }
.text-neon-red { color: var(--neon-red); }

.hidden {
  display: none !important;
}

/* Utilitários para Impressão */
.print-only {
  display: none;
}

/* Folha de Estilos de Impressão */
@media print {
  body {
    background: white !important;
    background-image: none !important;
    color: black !important;
    font-size: 12pt;
  }

  .app-container > *:not(#printable-report) {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  #printable-report {
    width: 100%;
    color: #333;
    font-family: Arial, sans-serif;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
  }

  .print-logo h2 {
    font-size: 20pt;
    font-weight: bold;
    color: #111;
  }

  .print-logo p {
    font-size: 10pt;
    color: #666;
  }

  .print-meta {
    text-align: right;
    font-size: 10pt;
  }

  .print-section {
    margin-bottom: 20px;
  }

  .print-section h3 {
    font-size: 14pt;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-bottom: 10px;
    color: #111;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
  }

  .print-table td {
    padding: 8px 0;
    width: 50%;
    font-size: 11pt;
    border-bottom: 1px dashed #eee;
  }

  .print-table-checklist {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
  }

  .print-table-checklist th, 
  .print-table-checklist td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
    font-size: 10pt;
  }

  .print-table-checklist th {
    background-color: #f5f5f5;
    font-weight: bold;
  }

  .print-table-checklist td span.pass {
    color: #059669;
    font-weight: bold;
  }

  .print-table-checklist td span.fail {
    color: #dc2626;
    font-weight: bold;
  }

  .print-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
  }

  .sig-box {
    width: 40%;
    text-align: center;
  }

  .sig-line {
    border-top: 1px solid #333;
    margin-bottom: 8px;
    width: 100%;
  }

  .sig-box p {
    font-size: 10pt;
    color: #666;
  }
}
