:root {
  --bg-main: #07090E;
  --bg-card: rgba(15, 20, 32, 0.75);
  --bg-card-hover: rgba(22, 30, 48, 0.85);
  --border-color: rgba(255, 255, 255, 0.09);
  --border-focus: #8B5CF6;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --primary: #8B5CF6;
  --primary-hover: #7C3AED;
  --primary-glow: rgba(139, 92, 246, 0.4);
  --cyan: #06B6D4;
  --success: #10B981;
  --danger: #EF4444;
  --danger-glow: rgba(239, 68, 68, 0.4);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* PAINEL DE VIDRO */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* TELA DE LOGIN */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px;
  text-align: center;
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-brand .logo-icon {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #fff;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.login-brand h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
  margin-bottom: 24px;
}

/* INPUTS E FORMUL?RIOS */
.input-group {
  text-align: left;
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: rgba(7, 10, 18, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
  background: rgba(10, 14, 25, 0.95);
}

.url-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(7, 10, 18, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s;
}

.url-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.url-prefix {
  padding: 12px 14px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border-color);
  user-select: none;
}

.url-input-wrap input {
  border: none;
  background: transparent;
  padding: 12px 16px;
}

.url-input-wrap input:focus {
  box-shadow: none;
}

/* BOT?ES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6D28D9);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #5B21B6);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #DC2626);
  color: #fff;
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--danger-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger-ghost {
  background: transparent;
  color: #F87171;
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.full-width { width: 100%; }

/* LAYOUT PRINCIPAL */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  margin-bottom: 28px;
}

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

.header-left .logo-icon {
  width: 44px;
  height: 44px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-pill.standby {
  background: rgba(16, 185, 129, 0.1);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-pill.recording {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: pulseRecording 1.5s infinite;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.stats-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

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

/* BANNER DE GRAVA??O ATIVA */
.active-banner {
  display: grid;
  grid-template-columns: auto 1fr 200px auto;
  align-items: center;
  gap: 24px;
  padding: 22px 28px;
  margin-bottom: 30px;
  border-left: 4px solid var(--danger);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, rgba(15, 20, 32, 0.85) 100%);
}

.banner-pulse-indicator {
  position: relative;
  width: 24px;
  height: 24px;
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--danger);
  animation: ringScale 2s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pulse-core {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--danger);
}

.banner-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #F87171;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.active-url {
  font-size: 1.15rem;
  font-weight: 700;
  word-break: break-all;
}

.active-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.active-meta strong {
  color: #fff;
  font-family: var(--font-mono);
}

.banner-preview-box {
  position: relative;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #000;
}

.banner-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* SE??O DE CONFIGURA??O */
.config-section {
  padding: 30px;
  margin-bottom: 40px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--primary-glow);
}

.section-title-wrap h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.section-title-wrap p {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.span-2 { grid-column: span 2; }

.btn-col {
  grid-column: span 4;
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

/* MODAL DE CALIBRA??O / PREVIEW */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 24px;
}

.preview-modal-card {
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInDown 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.preview-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}

.preview-url-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.preview-monitor {
  position: relative;
  min-height: 420px;
  background: #020408;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
}

.preview-frame {
  width: 100%;
  display: flex;
  justify-content: center;
}

.preview-frame img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
}

.preview-spinner-wrap {
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-footer.space-between { justify-content: space-between; }

.footer-actions {
  display: flex;
  gap: 12px;
}

.preview-tip {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 450px;
}

/* GALERIA DE GRAVA??ES */
.gallery-section {
  margin-top: 10px;
}

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

.gallery-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.gallery-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.video-card {
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
}

.video-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.video-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover .video-thumb-wrap img {
  transform: scale(1.04);
}

.duration-tag {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 4px;
}

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.play-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--primary-glow);
}

.video-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-url {
  font-size: 0.78rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.video-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
}

.gallery-empty {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 14px;
}

.gallery-empty h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.gallery-empty p {
  color: var(--text-muted);
  margin-top: 6px;
}

/* PLAYER MODAL */
.video-player-card {
  width: 100%;
  max-width: 900px;
}

.video-container {
  background: #000;
  max-height: 70vh;
  display: flex;
  justify-content: center;
}

.video-container video {
  width: 100%;
  max-height: 70vh;
  outline: none;
}

.small-modal {
  max-width: 400px;
}

.error-msg {
  color: #F87171;
  font-size: 0.84rem;
  margin-bottom: 14px;
}

.pass-msg {
  font-size: 0.84rem;
  margin-top: 10px;
}

.pass-msg.success { color: var(--success); }
.pass-msg.error { color: var(--danger); }

/* ANIMA??ES */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ringScale {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes pulseRecording {
  0%, 100% { border-color: rgba(239, 68, 68, 0.3); }
  50% { border-color: rgba(239, 68, 68, 0.8); box-shadow: 0 0 15px rgba(239, 68, 68, 0.3); }
}

/* RESPONSIVIDADE */
@media (max-width: 900px) {
  .setup-grid { grid-template-columns: 1fr; }
  .span-2, .btn-col { grid-column: span 1; }
  .active-banner { grid-template-columns: 1fr; }
  .banner-preview-box { height: 140px; }
  .app-header { flex-direction: column; gap: 16px; align-items: flex-start; }
}

/* ESTILOS DO NAVEGADOR REMOTO INTERATIVO */
.interactive-modal-card {
  width: 96vw;
  max-width: 1400px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.browser-navbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(10, 14, 24, 0.95);
  border-bottom: 1px solid var(--border-color);
}

.nav-controls {
  display: flex;
  gap: 6px;
}

.browser-url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(4, 7, 13, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.url-secure-lock {
  font-size: 0.8rem;
  margin-right: 6px;
  user-select: none;
}

.browser-url-bar input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 6px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.browser-url-bar input:focus {
  box-shadow: none;
}

.interactive-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

.interactive-status-badge.connecting {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.interactive-status-badge.live {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.screencast-container {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #020408;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  outline: none;
}

.screencast-canvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  cursor: crosshair;
}

.browser-input-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(10, 14, 24, 0.95);
  border-top: 1px solid var(--border-color);
}

.quick-type-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 500px;
  background: rgba(4, 7, 13, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}

.quick-type-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  font-size: 0.88rem;
}

.quick-type-wrap input:focus {
  box-shadow: none;
}

.browser-footer-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.browser-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.glow-btn {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.45);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* SMART ACTIONS & CLICK FEEDBACK */
.smart-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-accent {
  background: linear-gradient(135deg, #EC4899, #8B5CF6);
  color: #fff;
  font-weight: 700;
  border: none;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.4);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.6);
}

.click-ripple {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.2);
  animation: clickRippleAnim 0.35s ease-out forwards;
  z-index: 1000;
}

@keyframes clickRippleAnim {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}
