/* ======================================================================
   EMUTE VENDAS ONLINE (vendas.emute.ao)
   Design System Dark Luxury SaaS (1:1 Padrão talent.emute.ao)
   ====================================================================== */

:root {
  --bg-body: #0b101d;
  --bg-sidebar: #101626;
  --bg-card: #151c2c;
  --bg-card-hover: #192236;
  --bg-surface: #0e1422;
  --bg-input: #0a0e18;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Estrutura Principal / Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.sidebar-logo-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.sidebar-brand-text h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}
.sidebar-brand-text h2 span {
  color: var(--primary);
}
.sidebar-brand-text p {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

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

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 12px 6px;
  letter-spacing: 0.08em;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item .badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.user-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.profile-info {
  overflow: hidden;
}
.profile-info .empresa-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-info .empresa-nif {
  font-size: 11px;
  color: var(--text-dim);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.btn-logout:hover {
  color: var(--accent-red);
}

/* Área de Conteúdo Principal */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.app-topbar {
  height: 70px;
  background: rgba(16, 22, 38, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.company-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
}
.company-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Chips de Filtro Rápido (Inspirado no talent.emute.ao) */
.filter-pills {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  padding: 3px;
  gap: 2px;
}

.filter-pill {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-pill:hover {
  color: #fff;
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-blue) 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
}

/* Corpo do Conteúdo */
.content-body {
  padding: 28px;
  flex: 1;
}

/* Header de Página */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.page-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Grid de KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.kpi-value {
  font-size: 23px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.kpi-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-badge-trend {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.trend-positive {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}
.trend-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

/* Gráficos e Seções Centrais */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

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

.panel-header h3 {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

/* Tabela de Dados Dark */
.data-table-container {
  overflow-x: auto;
}

.dark-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.dark-table th {
  padding: 12px 14px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.dark-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.dark-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges de Documento e Estado */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pago {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pendente {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-anulado {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Cartões de Turno */
.turnos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.turno-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
  cursor: pointer;
}

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

.turno-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.turno-operador {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.turno-data {
  font-size: 11.5px;
  color: var(--text-dim);
}

.turno-metric-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}

.turno-metric-row:last-child {
  border-bottom: none;
}

.turno-metric-label {
  color: var(--text-muted);
}

.turno-metric-val {
  font-weight: 700;
  color: #fff;
}

/* Modais */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}
.modal-close:hover { color: #fff; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* Inputs Dark */
.form-input-dark {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input-dark:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Responsividade */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .mobile-toggle {
    display: block;
  }
  .app-topbar {
    padding: 0 16px;
  }
  .content-body {
    padding: 16px;
  }
  .filter-pills {
    display: none; /* Em mobile usa o selector drop */
  }
}
