/* ===================================================
   REDE 50+ — Sistema Administrativo
   Paleta: Laranja #F15B22 | Ciano #13A9AD | Azul #2A445B
   (cores oficiais do site talentos.rede50mais.com.br)
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=Inter:wght@400;500&display=swap');

:root {
  --orange: #F15B22;
  --orange-dark: #D34712;
  --orange-light: #FF7C4D;
  --teal: #13A9AD;
  --teal-dark: #0E8285;
  --teal-light: #37E7ED;
  --dark: #141414;
  --dark-2: #1E1E1E;
  --dark-3: #252525;
  --dark-4: #2E2E2E;
  --dark-5: #383838;
  --text-primary: #F0F0F0;
  --text-secondary: #A8A8A8;
  --text-muted: #6B6B6B;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --sidebar-width: 250px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 2px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--dark);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-light); }

/* ===== LAYOUT ===== */
.app-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--dark-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  max-width: 160px;
  height: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 16px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--dark-3);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(232,82,42,0.2), rgba(42,191,191,0.1));
  color: var(--text-primary);
  border: 1px solid rgba(232,82,42,0.3);
}

.nav-item.active .nav-icon { color: var(--orange); }

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--dark-3);
  cursor: pointer;
  transition: background 0.2s;
}

.user-card:hover { background: var(--dark-4); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-header {
  height: var(--header-height);
  background: var(--dark-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title { font-size: 18px; font-weight: 600; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 1px; }

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

.page-content { padding: 28px; flex: 1; }

/* ===== CARDS ===== */
.card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-sm { padding: 16px; }
.card-lg { padding: 32px; }

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

.card-title { font-size: 15px; font-weight: 600; }

/* ===== METRIC CARDS ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.metric-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.metric-card.orange::before { background: var(--orange); }
.metric-card.teal::before { background: var(--teal); }
.metric-card.success::before { background: var(--success); }
.metric-card.warning::before { background: var(--warning); }

.metric-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px; }
.metric-value { font-family: 'Sora', sans-serif; font-size: 32px; font-weight: 700; line-height: 1; }
.metric-card.orange .metric-value { color: var(--orange-light); }
.metric-card.teal .metric-value { color: var(--teal-light); }
.metric-card.success .metric-value { color: var(--success); }
.metric-card.warning .metric-value { color: var(--warning); }
.metric-delta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ===== BADGES / STATUS ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-novo { background: rgba(59,130,246,0.15); color: var(--info); border: 1px solid rgba(59,130,246,0.3); }
.badge-em_analise { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-ativo { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-em_pausa { background: rgba(232,82,42,0.15); color: var(--orange-light); border: 1px solid rgba(232,82,42,0.3); }
.badge-inativo { background: rgba(107,107,107,0.2); color: var(--text-muted); border: 1px solid var(--border); }

/* ===== BOTÕES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-dark); color: white; }

.btn-teal { background: var(--teal); color: #0a2020; }
.btn-teal:hover { background: var(--teal-dark); color: #0a2020; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--dark-3); color: var(--text-primary); border-color: var(--border-hover); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ===== TABELAS ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--dark-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--dark-3); }

.td-name { font-weight: 500; }
.td-secondary { font-size: 12px; color: var(--text-muted); }

/* ===== FORMULÁRIOS ===== */
.form-grid { display: grid; gap: 20px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(42,191,191,0.1);
}

textarea { resize: vertical; min-height: 100px; }
select option { background: var(--dark-3); }

.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }

/* ===== FILTROS E PESQUISA ===== */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box input {
  padding-left: 38px;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ===== ALERTAS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #60a5fa; }

/* ===== PAGINAÇÃO ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  justify-content: center;
}

.page-link {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--dark-2);
  transition: all 0.2s;
  padding: 0 10px;
}

.page-link:hover { background: var(--dark-3); color: var(--text-primary); text-decoration: none; }
.page-link.active { background: var(--orange); color: white; border-color: var(--orange); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 24px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 0 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
  font-size: 20px;
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

/* ===== SCORE BAR ===== */
.score-bar {
  width: 100%;
  height: 6px;
  background: var(--dark-4);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.score-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--teal), var(--orange));
  transition: width 0.5s ease;
}

/* ===== WHATSAPP STATUS ===== */
.wa-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.wa-ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.wa-pending { background: var(--warning); }
.wa-error { background: var(--danger); }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--dark);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,82,42,0.08) 0%, transparent 70%);
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -200px; left: -200px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(42,191,191,0.08) 0%, transparent 70%);
}

.login-panel {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 40px;
  position: relative;
  z-index: 1;
}

.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo img { max-width: 180px; }

.login-card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
}

.login-title { font-size: 22px; margin-bottom: 6px; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dark-5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-content { padding: 16px; }

  .filters-bar { flex-direction: column; align-items: stretch; }
}

/* ===== UTILITÁRIOS ===== */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }
.mt-auto { margin-top: auto; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-orange { color: var(--orange); }
.text-teal { color: var(--teal); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }


/* Espaçamento entre cards no cadastro */
.cards-stack { display: flex; flex-direction: column; gap: 20px; }

/* ===================================================
   TEMA CLARO
   Ativado via <html data-theme="light">.
   Redefine as variáveis da paleta escura — o restante
   do CSS continua igual, pois tudo usa var().
   =================================================== */
[data-theme="light"] {
  --dark: #F3F4F6;            /* fundo da página */
  --dark-2: #FFFFFF;          /* cards e sidebar */
  --dark-3: #F1F2F4;          /* inputs e hover */
  --dark-4: #E5E7EB;
  --dark-5: #D1D5DB;
  --text-primary: #2A445B;   /* azul-petróleo dos textos do site (--fontes) */
  --text-secondary: #4A6076;
  --text-muted: #8595A5;
  --border: rgba(42,68,91,0.14);
  --border-hover: rgba(42,68,91,0.28);
  /* Nas versões "light" das cores, escurece: no tema claro elas são usadas
     como cor de texto e precisam de contraste sobre fundo claro */
  --orange-light: #C94510;
  --teal-light: #0E8285;
  --success: #16A34A;
  --warning: #B45309;
  --info: #2563EB;
  --shadow: 0 2px 12px rgba(16,24,40,0.08);
  --shadow-lg: 0 8px 32px rgba(16,24,40,0.14);
}

/* Textos dos alertas: as cores originais são claras (feitas p/ fundo escuro) */
[data-theme="light"] .alert-success { color: #15803D; }
[data-theme="light"] .alert-danger  { color: #B91C1C; }
[data-theme="light"] .alert-warning { color: #92400E; }
[data-theme="light"] .alert-info    { color: #1D4ED8; }

/* Overlay do modal um pouco mais suave no claro */
[data-theme="light"] .modal-overlay { background: rgba(16,24,40,0.45); }

/* Botão de alternância de tema: mostra sol no escuro, lua no claro */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: flex; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: flex; }
