:root {
  --bg: #1a2332;
  --card: #1f2937;
  --primary: #38bdf8;
  --text: #f1f5f9;
  --muted: #cbd5e1;
  --success: #22c55e;
  --danger: #ef4444;
  --error: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: radial-gradient(circle at top left, #243447, #1a2332 40%);
  color: var(--text);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  margin-left: 220px; /* Espaço para o sidebar */
  padding: 24px;
  transition: margin-left 0.3s ease;
}

header {
  margin-bottom: 16px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
}

.header-left {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.header-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  flex-shrink: 0;
  display: block;
  margin: 0;
  padding: 0;
  align-self: flex-start;
}

/* Links desabilitados durante execução */
.sidebar-menu-link.disabled,
.sidebar-nav-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-menu-link.disabled:hover,
.sidebar-nav-link.disabled:hover {
  background: transparent;
  border-left-color: transparent;
  padding-left: 20px;
  color: var(--muted);
}

/* ============================================
   Seletor de Idioma
   ============================================ */
.language-selector {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0.6;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-selector .fi {
  width: 24px;
  height: 18px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.lang-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.lang-btn.active {
  opacity: 1;
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.lang-btn:active {
  transform: translateY(0);
}

.logo-img {
  max-height: 60px;
  max-width: 200px;
  height: auto;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0;
  padding: 0;
}

h1 {
  margin: 0 0 8px 0;
  padding: 0;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: row;
    align-items: flex-start;
  }
  
  .header-logo {
    align-self: flex-start;
  }
  
  .logo-img {
    max-height: 50px;
    max-width: 150px;
  }
}

p {
  margin: 0;
  color: var(--muted);
}

.form-card,
.status-card {
  background: var(--card);
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.test-data-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #374151;
  transition: opacity 0.3s ease, max-height 0.3s ease;
  overflow: hidden;
}

.test-data-section[style*="display: none"] {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.test-data-title {
  margin: 0 0 12px 0;
  font-size: 1em;
  color: var(--text);
  font-weight: 600;
}

.test-data-group.test-data-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr 1fr !important;
  gap: 16px !important;
}

.test-data-group.test-data-grid.hidden {
  display: none !important;
}

.test-data-grid .form-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.test-data-grid .form-field-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.test-data-grid .form-field-wrapper label {
  display: block;
  margin: 8px 0 4px;
}

.test-data-grid .form-field-wrapper input {
  width: 100%;
}

@media (max-width: 1200px) {
  .test-data-group.test-data-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 768px) {
  .test-data-group.test-data-grid {
    grid-template-columns: 1fr !important;
  }
}

.execution-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.browser-view-card,
.log-card {
  background: var(--card);
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  min-height: 600px;
}

@media (max-width: 1200px) {
  .execution-view {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  margin: 8px 0 4px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
}

input[readonly] {
  background-color: #2d3748;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.7;
}
  border: 1px solid #374151;
  background: #1f2937;
  color: var(--text);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.help-text {
  display: block;
  color: var(--muted);
  font-size: 0.85em;
  margin-bottom: 8px;
  font-style: italic;
}

button {
  margin-top: 12px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #0ea5e9, #06b6d4);
  color: white;
  font-weight: bold;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.progress {
  width: 100%;
  background: #0b1221;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #1f2937;
}

.progress-bar {
  height: 20px;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #38bdf8);
  text-align: center;
  color: #0b1221;
  font-weight: bold;
  transition: width 0.3s ease, background 0.3s ease;
}

.progress-bar.failed {
  background: linear-gradient(90deg, #c2410c, #dc2626);
}

.status-text {
  margin-top: 8px;
  color: var(--muted);
}

.status-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #374151;
}

.status-column,
.result-column {
  display: flex;
  flex-direction: column;
}

.status-label,
.result-label {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.execution-result {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--primary);
  padding: 12px;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.execution-result .pedido-number {
  font-weight: bold;
  color: var(--primary);
  font-size: 16px;
  letter-spacing: 0.5px;
}

.execution-result .copy-btn {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-left: 6px;
  line-height: 1.2;
  min-width: auto;
  height: auto;
}

.execution-result .copy-btn .copy-btn-text {
  font-size: 11px;
  white-space: nowrap;
}

.execution-result .copy-btn:hover {
  background: var(--primary);
  color: var(--bg);
}

.execution-result .copy-btn:active {
  transform: scale(0.95);
}

.execution-result:empty::before {
  content: "-";
  color: var(--muted);
}

/* Resultados detalhados */
.detailed-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(56, 189, 248, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.result-item-label {
  font-weight: 600;
  color: var(--primary);
  min-width: 70px;
  font-size: 14px;
}

.result-input {
  flex: 1;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
}

.result-input:focus {
  outline: none;
  border-color: var(--primary);
}

.copy-btn {
  background: var(--primary);
  color: #1a1a1a;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.copy-btn:hover {
  background: #60d5f8;
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn-small {
  padding: 6px 12px !important;
  font-size: 11px !important;
  min-width: auto !important;
}

@media (max-width: 768px) {
  .status-result-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .result-item {
    flex-direction: column;
    align-items: stretch;
  }
  
  .result-item-label {
    min-width: auto;
  }
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.log-header h2 {
  margin: 0;
  font-size: 1.2em;
}

.execution-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 0.9em;
  font-weight: bold;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.logs {
  flex: 1;
  overflow-y: auto;
  background: #1a2332;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #1f2937;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.6;
  min-height: 500px;
  max-height: 800px;
}

.log-placeholder {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.log-line {
  padding: 6px 8px;
  margin: 2px 0;
  border-left: 3px solid transparent;
  border-radius: 4px;
  transition: background 0.2s;
}

.log-line:hover {
  background: rgba(56, 189, 248, 0.05);
}

.log-time {
  color: #6b7280;
  margin-right: 8px;
  font-size: 0.85em;
}

.log-icon {
  margin-right: 6px;
}

.log-info {
  border-left-color: #38bdf8;
  color: #93c5fd;
}

.log-running {
  border-left-color: #fbbf24;
  color: #fde68a;
  animation: slideIn 0.3s ease-out;
}

.log-success {
  border-left-color: #22c55e;
  color: #86efac;
}

.log-error {
  border-left-color: #ef4444;
  color: #fca5a5;
}

.log-final {
  font-size: 1.05em;
  padding: 10px;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 6px;
  margin-top: 8px;
}

.log-default {
  color: var(--text);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.browser-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.browser-header h2 {
  margin: 0;
  font-size: 1.2em;
}

.browser-status {
  color: var(--muted);
  font-size: 0.9em;
}

.browser-container {
  position: relative;
  background: #1a2332;
  border-radius: 8px;
  border: 1px solid #374151;
  flex: 1;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  max-height: 800px;
}

.browser-placeholder {
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

.browser-placeholder .placeholder-icon {
  font-size: 4em;
  margin-bottom: 16px;
  opacity: 0.5;
}

.browser-placeholder p {
  margin: 8px 0;
  font-size: 1.1em;
}

.browser-placeholder small {
  display: block;
  margin-top: 8px;
  font-style: italic;
}

.browser-screenshot {
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  /* Removida transição de opacity para evitar piscar */
  border: 2px solid #1f2937;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background: #000;
  image-rendering: crisp-edges;
  /* Suaviza a renderização da imagem */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.result-area {
  margin-top: 10px;
  font-weight: bold;
}

.links {
  margin-top: 8px;
}

.hidden {
  display: none;
}

.footer {
  margin-top: 60px;
  padding: 20px;
  background: #243447;
  border-top: 1px solid #374151;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-content {
  text-align: center;
  width: 100%;
  max-width: 1600px;
}

.footer-text {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.9em;
  letter-spacing: 0.3px;
  text-align: center;
  font-weight: 400;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 220px;
  z-index: 1000;
  background: linear-gradient(180deg, #1f2937 0%, #1a2332 100%);
  border-right: 1px solid #374151;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid #374151;
}

.sidebar-title {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.sidebar-user-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.9em;
  color: var(--primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal de confirmacao de logout */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--card);
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 0;
  min-width: 400px;
  max-width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #374151;
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.2em;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin: 0;
  color: var(--muted);
  font-size: 1em;
  line-height: 1.5;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #374151;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn-cancel {
  background: var(--card);
  color: var(--text);
  border: 1px solid #374151;
}

.modal-btn-cancel:hover {
  background: #374151;
}

.modal-btn-confirm {
  background: var(--danger);
  color: white;
}

.modal-btn-confirm:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu-item {
  margin: 0;
  padding: 0;
}

.sidebar-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95em;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-menu-link:hover {
  background: rgba(56, 189, 248, 0.1);
  color: var(--text);
  border-left-color: var(--primary);
  padding-left: 24px;
}

.sidebar-menu-link:active {
  background: rgba(56, 189, 248, 0.15);
}

.sidebar-menu-icon {
  font-size: 1em;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: var(--primary);
  font-weight: bold;
}

.sidebar-menu-text {
  flex: 1;
  white-space: nowrap;
}

.sidebar-menu-link-danger {
  color: var(--muted);
}

.sidebar-menu-link-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: var(--danger);
  color: var(--danger);
}

.sidebar-menu-link-danger .sidebar-menu-icon {
  color: var(--danger);
}

/* Ajuste do container para não sobrepor o sidebar em telas menores */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }
  
  .container {
    margin-left: 200px;
  }
  
  .sidebar-menu-link {
    padding: 12px 16px;
    font-size: 0.9em;
  }
}

@media (max-width: 600px) {
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    width: 100%;
    border-right: none;
    border-top: 1px solid #374151;
    flex-direction: row;
  }
  
  .sidebar-header {
    display: none;
  }
  
  .sidebar-nav {
    padding: 0;
  }
  
  .sidebar-menu {
    display: flex;
    flex-direction: row;
    width: 100%;
  }
  
  .sidebar-menu-item {
    flex: 1;
  }
  
  .sidebar-menu-link {
    border-left: none;
    border-top: 3px solid transparent;
    justify-content: center;
    padding: 12px 8px;
  }
  
  .sidebar-menu-link:hover {
    border-left: none;
    border-top-color: var(--primary);
    padding-left: 8px;
  }
  
  .sidebar-menu-link-danger:hover {
    border-top-color: var(--danger);
  }
  
  .container {
    margin-left: 0;
    margin-bottom: 70px;
  }
}

/* Dashboard Table Header Styles */
.table-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 20px;
  gap: 15px;
}

.table-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.5em;
  line-height: 1.4;
}

.table-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-self: end;
}

.user-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
}

.user-filter label {
  color: #a0a0a0;
  font-size: 11px;
  white-space: nowrap;
  line-height: 36px;
  margin: 0;
}

.user-filter select {
  background: #2e2f35;
  color: #ffffff;
  border: 1px solid #3a3b42;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.3s ease;
  max-width: 140px;
  min-width: 120px;
  height: 36px;
  line-height: 1;
}

.user-filter select:hover {
  border-color: var(--primary);
}

.user-filter select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.1);
}

.refresh-btn {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 36px;
  line-height: 1;
  white-space: nowrap;
}

.refresh-btn:hover {
  background: var(--primary);
  color: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* Responsividade para Dashboard */
@media (max-width: 1100px) {
  .table-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .table-header-actions {
    justify-self: start;
  }
}

@media (max-width: 768px) {
  .table-header h2 {
    font-size: 1.3em;
  }
}

@media (max-width: 600px) {
  .table-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .user-filter {
    flex: 1;
    min-width: 200px;
  }
  
  .user-filter select {
    flex: 1;
  }
  
  .refresh-btn {
    flex: 1;
    min-width: 100px;
  }
}

