:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #10b981;
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #020617;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #f43f5e;
  --glass: rgba(30, 41, 59, 0.7);
  --border: rgba(255, 255, 255, 0.1);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 10;
}

.logo {
  padding: 0 24px;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo i {
  font-size: 24px;
  color: var(--primary);
}

.logo h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-menu {
  flex: 1;
  list-style: none;
}

.nav-item {
  padding: 4px 16px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-footer {
  padding: 0 24px;
  margin-top: auto;
}

.status-card {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.header {
  height: 80px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  z-index: 5;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 16px;
}

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.view-container {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  position: relative;
}

/* Sections */
.section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dashboard Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--border);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.stat-info h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-info p {
  font-size: 28px;
  font-weight: 700;
}

/* QR Code Section */
.qr-card {
  background: white;
  padding: 24px;
  border-radius: 24px;
  max-width: 300px;
  margin: 0 auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.qr-card img {
  width: 100%;
  border-radius: 12px;
}

.qr-placeholder {
  height: 250px;
  background: #f1f5f9;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  flex-direction: column;
  gap: 16px;
}

/* Trigger Table */
.data-card {
  background: var(--bg-card);
  border-radius: 24px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 16px 24px;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

td {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-info {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.actions-cell {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.icon-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Funnel Steps */
.funnel-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s;
}

.step-card:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
}

.step-content {
  flex: 1;
}

.step-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.step-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  width: 100%;
  max-width: 500px;
  border-radius: 24px;
  border: 1px solid var(--border);
  overflow: hidden;
  animation: modalScale 0.3s ease;
}

@keyframes modalScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.form-field {
  margin-bottom: 20px;
}

.form-field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 10px;
  color: white;
  outline: none;
  font-size: 14px;
}

.form-field input:focus {
  border-color: var(--primary);
}

/* Chat Styles */
.chat-container {
  display: flex;
  height: calc(100vh - 80px);
}

.chat-sidebar {
  width: 350px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.chat-item.active {
  background: rgba(99, 102, 241, 0.1);
}

.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0b0f19;
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
}

.msg-sent {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg-received {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* Progress Spinner */
.loader {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Depoimentos Grid */
.depo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.depo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--bg-dark);
}

.depo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.depo-item:hover img {
  opacity: 1;
}

.depo-item.selected {
  border-color: var(--primary);
}

.depo-item.selected img {
  opacity: 1;
}

.depo-item input {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 18px;
  height: 18px;
  z-index: 2;
  cursor: pointer;
}

.media-preview-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-area {
  border: 2px dashed var(--border);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-area:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

/* Chat Media */
.msg-image {
  max-width: 250px;
  border-radius: 12px;
  margin-top: 8px;
  display: block;
}

.msg-audio {
  width: 100%;
  margin-top: 8px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Switch Toggle UI */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked+.slider {
  background-color: var(--primary);
}

input:focus+.slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
  transform: translateX(16px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.availability-card textarea:focus {
  border-color: var(--primary) !important;
}

.day-start,
.day-end {
  background: var(--bg-dark) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border) !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.3s;
}

.day-start:focus,
.day-end:focus {
  border-color: var(--primary) !important;
}

/* Esconder ícone de relógio nativo em alguns browsers se desejar, ou manter */
::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}