/* ==========================================================================
   BarberAI OS - Design System & Main Stylesheet (Dark Luxury Barber Club)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Paleta Dark Luxury Barber */
  --bg-main: #0b0f17;
  --bg-surface: #111827;
  --bg-card: #151e2e;
  --bg-card-hover: #1b263b;
  --bg-input: #0e141f;
  
  /* Cores de Destaque */
  --gold-primary: #f59e0b;
  --gold-hover: #d97706;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --gold-subtle: rgba(245, 158, 11, 0.1);
  
  --emerald: #10b981;
  --emerald-subtle: rgba(16, 185, 129, 0.15);
  --ruby: #ef4444;
  --ruby-subtle: rgba(239, 68, 68, 0.15);
  --sapphire: #3b82f6;
  --sapphire-subtle: rgba(59, 130, 246, 0.15);
  --purple: #a855f7;
  
  /* Textos */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  /* Bordas & Sombras */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(245, 158, 11, 0.3);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 8px 25px -4px rgba(245, 158, 11, 0.25);
  
  /* Dimensões */
  --sidebar-width: 260px;
  --topbar-height: 70px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Transições */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

a {
  color: var(--gold-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--gold-hover);
}

/* ==========================================================================
   Layout Estrutural
   ========================================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  padding: 24px 16px;
}

.brand-logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-hover));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-gold);
}

.brand-text h1 {
  font-size: 19px;
  line-height: 1.1;
}
.brand-badge {
  font-size: 10px;
  text-transform: uppercase;
  background: var(--gold-subtle);
  color: var(--gold-primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: 0.05em;
  display: inline-block;
  margin-top: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 24px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  color: #ffffff;
  background: var(--bg-card);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), transparent);
  border-left: 3px solid var(--gold-primary);
}

.nav-item.active .nav-icon {
  color: var(--gold-primary);
  transform: scale(1.1);
}

.nav-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.nav-badge-alert {
  margin-left: auto;
  background: var(--ruby);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.shop-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* Main Content Area */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.app-topbar {
  height: var(--topbar-height);
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Content Container */
.view-container {
  padding: 32px;
  flex: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Componentes & Elementos Visuais
   ========================================================================== */

.card-luxury {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-hover));
  color: #0b0f17;
  font-weight: 700;
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -2px rgba(245, 158, 11, 0.4);
}

.btn-outline-gold {
  background: transparent;
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}
.btn-outline-gold:hover {
  background: var(--gold-subtle);
}

.btn-outline-green {
  background: transparent;
  border-color: var(--emerald);
  color: var(--emerald);
}
.btn-outline-green:hover {
  background: var(--emerald-subtle);
}

.btn-success-green {
  background: var(--emerald);
  color: #0b0f17;
  font-weight: 700;
}
.btn-success-green:hover {
  background: #059669;
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: #243042;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}
.btn-outline:hover, .btn-outline.active {
  border-color: var(--gold-primary);
  color: #ffffff;
}

.btn-danger-outline {
  background: transparent;
  border-color: var(--ruby);
  color: var(--ruby);
}
.btn-danger-outline:hover {
  background: var(--ruby-subtle);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }

/* Formulários */
.app-form .form-group {
  margin-bottom: 16px;
}

.app-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-subtle);
}

.form-row {
  display: flex;
  gap: 14px;
}
.col-6 { flex: 1; }

/* Tags & Badges */
.crm-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tag-vip { background: rgba(245, 158, 11, 0.2); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); }
.tag-recorrente { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.tag-novo { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.tag-em-risco, .tag-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.tag-inativo { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
.tag-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.badge-status-micro {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 700;
}
.badge-status-micro.completed { background: var(--emerald-subtle); color: var(--emerald); }
.badge-status-micro.confirmed { background: var(--gold-subtle); color: var(--gold-primary); }
.badge-status-micro.scheduled { background: var(--sapphire-subtle); color: var(--sapphire); }

/* Tabelas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.app-table th {
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.app-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13.5px;
}

.app-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.user-avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-gold);
}
.user-meta-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.text-gold { color: var(--gold-primary); }
.text-green { color: var(--emerald); }
.text-danger { color: var(--ruby); }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 11px; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.w-100 { width: 100%; }

/* ==========================================================================
   Modais
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-window {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-close-btn:hover { color: #ffffff; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
.modal-actions.space-between {
  justify-content: space-between;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-card {
  background: #1e293b;
  border-left: 4px solid var(--gold-primary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-normal);
}

.toast-card.toast-show {
  transform: translateX(0);
  opacity: 1;
}

.toast-card.toast-success { border-left-color: var(--emerald); }
.toast-card.toast-danger { border-left-color: var(--ruby); }
.toast-card.toast-info { border-left-color: var(--sapphire); }

/* Switch Toggle */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch-toggle input { opacity: 0; width: 0; height: 0; }
.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  transition: .3s;
  border-radius: 24px;
}
.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider-round { background-color: var(--gold-primary); }
input:checked + .slider-round:before { transform: translateX(20px); }

/* ==========================================================================
   WhatsApp Real Connection & QR Code
   ========================================================================== */

.badge-wa-status {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-wa-status.status-online {
  background: var(--emerald-subtle);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-wa-status.status-waiting {
  background: var(--gold-subtle);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-wa-status.status-offline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.pulse-dot-online {
  width: 8px;
  height: 8px;
  background: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald);
}

.pulse-dot-waiting {
  width: 8px;
  height: 8px;
  background: var(--gold-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold-primary);
}

.pulse-dot-offline {
  width: 8px;
  height: 8px;
  background: var(--text-dim);
  border-radius: 50%;
}

.wa-qr-box-wrap {
  background: #090d14;
  border: 1px dashed var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.wa-qr-inner {
  text-align: center;
}

.wa-qr-img {
  width: 230px;
  height: 230px;
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.wa-disconnected-prompt {
  text-align: center;
  padding: 20px;
}

.wa-instructions-box {
  background: rgba(255, 255, 255, 0.02);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.wa-live-logs-scroll {
  flex: 1;
  background: #0b141a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: inherit;
}

.wa-log-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  display: flex;
  gap: 8px;
}

.wa-log-item .log-time {
  color: var(--text-dim);
  font-size: 10.5px;
  font-family: monospace;
  white-space: nowrap;
}

.wa-log-item .log-text {
  flex: 1;
}

.wa-log-item.log-type-user {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid var(--sapphire);
  color: #93c5fd;
}

.wa-log-item.log-type-bot {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--gold-primary);
  color: #fde68a;
}

.wa-log-item.log-type-success {
  background: rgba(16, 185, 129, 0.15);
  border-left: 3px solid var(--emerald);
  color: #6ee7b7;
  font-weight: 600;
}



/* Acoes no cabecalho do card de conexao do WhatsApp.
   Agrupa o selo de status com os botoes Conectar / Atualizar QR,
   que nao existiam no HTML apesar de o JS ja os procurar. */
.wa-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
