/* CSS DESIGN SYSTEM - ACUTIS PAINEL */

:root {
  /* Cores base */
  --bg-main: #080b11;
  --bg-card: rgba(17, 24, 39, 0.55);
  --bg-sidebar: #0d121f;
  --border-color: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  /* Cores de Destaque */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --accent: #a855f7; /* Purple */
  --success: #10b981; /* Emerald */
  --success-bg: rgba(16, 185, 129, 0.1);
  --danger: #ef4444; /* Red */
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b; /* Amber */
  --warning-bg: rgba(245, 158, 11, 0.1);
  --info: #3b82f6; /* Blue */
  --info-bg: rgba(59, 130, 246, 0.1);

  /* Fontes */
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Scrollbars Customizadas */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* EFEITOS GLASSMORPHISM */
.glass-container {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(8, 11, 17, 0.85);
  width: 100%;
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}
.glass-container.active {
  display: flex;
}

/* CARD DE LOGIN */
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.4s ease-out;
}

.brand {
  text-align: center;
  margin-bottom: 32px;
}
.brand .logo-icon {
  font-size: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
}
.brand h1 {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}
.brand h2 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  display: inline-block;
}
.brand p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
  line-height: 1.4;
}

/* INPUTS E FORMULÁRIOS */
.input-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}
.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.input-group input,
.input-group select,
.input-group textarea {
  background: rgba(31, 41, 55, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}
.input-group textarea {
  resize: vertical;
}
.helper-text {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 6px;
  line-height: 1.3;
}

/* SLUG PREFIX */
.slug-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(31, 41, 55, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
}
.slug-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}
.domain-prefix {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  border-right: 1px solid var(--border-color);
}
.slug-input-wrapper input {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* BOTÕES */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
  width: 100%;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-arrow {
  transition: transform 0.2s ease;
}
.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* MENSAGENS DE NOTIFICAÇÃO */
.error-msg {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}
.success-msg {
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}

/* LAYOUT DO PAINEL PRINCIPAL (DASHBOARD) */
.dashboard-layout {
  display: none;
  width: 100%;
  min-height: 100vh;
}
.dashboard-layout.active {
  display: flex;
}

/* SIDEBAR */
.sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  width: 280px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 40px;
  text-align: left;
}
.sidebar .brand .logo-icon {
  margin-bottom: 0;
  font-size: 24px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}
.nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}
.nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.15);
  font-weight: 600;
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-info .avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}
.user-info .details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.user-info .details .name {
  font-weight: 600;
  font-size: 14px;
}
.user-info .details .email {
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
}
.btn-logout:hover {
  background: var(--danger-bg);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* CONTEÚDO PRINCIPAL */
.main-content {
  margin-left: 280px;
  flex-grow: 1;
  min-height: 100vh;
  padding: 48px;
  display: flex;
  flex-direction: column;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
}
.content-header h1 {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* BADGE STATUS WHATSAPP */
.whatsapp-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(31, 41, 55, 0.45);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
}
.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background-color: var(--text-muted);
}
.whatsapp-badge.connected {
  border-color: rgba(16, 185, 129, 0.25);
  background: var(--success-bg);
  color: #a7f3d0;
}
.whatsapp-badge.connected .badge-dot {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.whatsapp-badge.disconnected {
  border-color: rgba(239, 68, 68, 0.25);
  background: var(--danger-bg);
  color: #fca5a5;
}
.whatsapp-badge.disconnected .badge-dot {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}
.whatsapp-badge.connecting {
  border-color: rgba(245, 158, 11, 0.25);
  background: var(--warning-bg);
  color: #fde68a;
}
.whatsapp-badge.connecting .badge-dot {
  background-color: var(--warning);
  animation: pulse-warn 1.5s infinite;
}

/* PANELS */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-bottom: 32px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.panel-header h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
}
.panel-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: -16px;
  margin-bottom: 24px;
}

/* GRID DE METRICAS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
}
.stat-card .icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.stat-card .icon-wrapper.blue { background: var(--info-bg); }
.stat-card .icon-wrapper.green { background: var(--success-bg); }
.stat-card .icon-wrapper.purple { background: var(--accent-bg); background-color: rgba(168, 85, 247, 0.1); }
.stat-card .icon-wrapper.orange { background: var(--warning-bg); }

.stat-card .info h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card .info p {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 800;
  margin-top: 4px;
}

/* TABELAS */
.table-container {
  overflow-x: auto;
  width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}
th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.8px;
}
td {
  color: var(--text-main);
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.loading-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
  font-style: italic;
}

/* BADGES EM TABELAS */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.success {
  background: var(--success-bg);
  color: #34d399;
}
.badge.failed {
  background: var(--danger-bg);
  color: #f87171;
}
.badge.pending {
  background: var(--warning-bg);
  color: #fbbf24;
}

/* SEÇÃO WHATSAPP */
.whatsapp-container {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
}
.whatsapp-profile-panel {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
}
.profile-pic-container img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.05);
}
.profile-details h2 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
}
.profile-details p {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 4px;
}
.instance-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-top: 8px;
}
.instance-badge strong {
  color: var(--primary);
}

.connection-status-panel {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.status-info, .webhook-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.status-label, .webhook-label {
  color: var(--text-muted);
  font-weight: 500;
}
.status-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.status-value.connected { color: var(--success); }
.status-value.disconnected { color: var(--danger); }
.status-value.connecting { color: var(--warning); }
.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.connected .pulse-indicator {
  animation: pulse-success 1.5s infinite;
}
.webhook-info code {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  color: #a5b4fc;
}

.instructions-panel h2 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}
.steps-list {
  padding-left: 20px;
}
.steps-list li {
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
}
.steps-list li strong {
  color: #a5b4fc;
}

/* SETTINGS PANEL */
.settings-panel form {
  display: flex;
  flex-direction: column;
}

/* MODAL LAYOUT */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modalSlide 0.3s ease-out;
}
.modal-box.large {
  max-width: 800px;
}
.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s;
}
.btn-close:hover {
  color: var(--text-main);
}
.modal-overlay form {
  padding: 32px;
}
.modal-body {
  padding: 32px;
  max-height: 480px;
  overflow-y: auto;
}
.modal-body pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
}
.modal-body code {
  font-family: monospace;
  font-size: 13px;
  color: #34d399;
}
.modal-footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}
.modal-footer .btn-secondary,
.modal-footer .btn-primary {
  width: auto;
}

/* CONTROLE DE EXIBIÇÃO DE PANES */
.tab-pane {
  display: none;
  animation: tabFade 0.25s ease-in-out;
}
.tab-pane.active {
  display: block;
}

/* ANIMATIONS */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes modalSlide {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes tabFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-success {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes pulse-warn {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* RESPONSIVIDADE */
@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
  }
  .main-content {
    margin-left: 240px;
    padding: 32px;
  }
  .whatsapp-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 20px;
  }
  .sidebar .brand {
    margin-bottom: 20px;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .main-content {
    margin-left: 0;
    padding: 24px 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
