/* ============================================================
   ZEUS 3.0 | main.css
   Design System Global
   Responsabilidade: Variáveis, reset, tipografia e layout base.
   Não contém estilos de componentes específicos.
   ============================================================ */

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

/* ============================================================
   1. VARIÁVEIS (DESIGN TOKENS)
   ============================================================ */
:root {
  /* Cores Principais */
  --primary:        #2e0249;
  --primary-light:  #4a148c;
  --accent:         #f97316;
  --accent-hover:   #ea580c;

  /* Cores da Marca (Velo) */
  --velo-orange:  #FF3D00;
  --velo-purple:  #591B72;
  --velo-gray:    #707070;
  --velo-hover:   #f5f5f5;

  /* Fundos e Superfícies */
  --bg-body:  #f3f4f6;
  --bg-card:  #ffffff;

  /* Texto */
  --text-main:  #1f2937;
  --text-muted: #6b7280;

  /* Feedback */
  --success:      #10b981;
  --success-dark: #059669;
  --danger:       #ef4444;
  --danger-dark:  #b91c1c;
  --warning:      #f59e0b;
  --warning-dark: #d97706;

  /* Bordas e Sombras */
  --border:     #e5e7eb;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.1);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height:  64px;

  /* Fontes */
  --font-main: 'Inter', sans-serif;
  --font-menu: 'Roboto', sans-serif;
}

/* ============================================================
   2. RESET
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}

/* ============================================================
   3. BASE
   ============================================================ */
html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Permite rolagem no body do PDV (modo especial) */
body.pdv-mode {
  overflow: hidden !important;
}

/* ============================================================
   4. TIPOGRAFIA
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

p {
  line-height: 1.6;
  color: var(--text-muted);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

/* ============================================================
   5. LAYOUT PRINCIPAL
   ============================================================ */

/* Shell da aplicação: sidebar + main */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Área principal à direita da sidebar */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
  overflow: hidden;
  min-width: 0; /* Evita overflow em grids */
}

/* ============================================================
   6. TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.topbar h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

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

.date-badge {
  background: var(--bg-body);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.date-badge i {
  color: var(--accent);
}

/* ============================================================
   7. CONTENT BODY (área rolável de conteúdo)
   ============================================================ */
.content-body {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============================================================
   8. CARDS GENÉRICOS
   ============================================================ */
.content-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fcfcfc;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

/* ============================================================
   9. INPUTS E FORMULÁRIOS
   ============================================================ */
.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.input-modern,
.input-select,
.input-search,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-main);
  color: var(--text-main);
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-modern:focus,
.input-select:focus,
.input-search:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* Linha de formulário com múltiplos campos */
.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

/* ============================================================
   10. BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-main);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--primary);
  color: #fff;
}
.btn-secondary:hover { background: var(--primary-light); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: var(--success-dark); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-dark); }

.btn-outline {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger-outline {
  border: 1px solid var(--danger);
  background: var(--bg-card);
  color: var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger);
  color: #fff;
}

.btn-block { width: 100%; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.85rem 1.8rem;
  font-size: 1rem;
}

/* Botão ícone pequeno */
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 4px;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--primary);
  background: var(--bg-body);
}

.btn-icon.danger:hover {
  color: var(--danger);
}

/* Botão flutuante */
.floating-add {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  border: none;
  box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.4);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  z-index: 100;
}

.floating-add:hover { transform: scale(1.1); }

/* ============================================================
   11. UTILITÁRIOS
   ============================================================ */

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Margens e Paddings */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Texto */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary) !important; }
.text-accent  { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.75rem; }
.fw-bold      { font-weight: 700; }
.fw-black     { font-weight: 900; }

/* Fundos */
.bg-body  { background: var(--bg-body) !important; }
.bg-white { background: var(--bg-card) !important; }

/* Divisor */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* Tag de Status genérica */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-tag.success { background: #dcfce7; color: var(--success-dark); }
.status-tag.danger  { background: #fee2e2; color: var(--danger-dark); }
.status-tag.warning { background: #fef3c7; color: var(--warning-dark); }
.status-tag.info    { background: #e0f2fe; color: #0284c7; }
.status-tag.neutral { background: var(--bg-body); color: var(--text-muted); }

/* Acessibilidade */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   12. GRIDS DE DASHBOARD
   ============================================================ */
.dashboard-header-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.kpi-info h3 {
  font-size: 1.8rem;
  font-weight: 900;
  margin: 0;
  line-height: 1.1;
  color: var(--text-main);
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
  display: block;
}

/* Variantes de KPI */
.kpi-card.purple .kpi-icon { background: #f3e8ff; color: var(--primary); }
.kpi-card.orange .kpi-icon { background: #fff7ed; color: var(--accent); }
.kpi-card.green  .kpi-icon { background: #ecfdf5; color: var(--success); }
.kpi-card.red    .kpi-icon { background: #fef2f2; color: var(--danger); }
.kpi-card.blue   .kpi-icon { background: #eff6ff; color: #2563eb; }

/* ============================================================
   13. TABELA PADRÃO (Velo Table)
   ============================================================ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.velo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.velo-table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.velo-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.velo-table tbody tr:hover {
  background: #fdf4ff;
}

.velo-table td {
  padding: 0.85rem 1rem;
  color: var(--text-main);
  vertical-align: middle;
}

.velo-table td small {
  display: block;
  color: var(--text-muted);
  margin-top: 2px;
  font-size: 0.8rem;
}

/* ============================================================
   14. TELA DE LOGIN
   ============================================================ */
#loginOverlay {
  position: fixed;
  inset: 0;
  background-color: #f3f4f6;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.login-bg-shape {
  position: absolute;
  width: 90vh;
  height: 90vh;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a148c 0%, #880e4f 100%);
  left: -25vh;
  top: 50%;
  transform: translateY(-50%);
  mask: radial-gradient(transparent 45%, black 46%);
  -webkit-mask: radial-gradient(transparent 45%, black 46%);
  z-index: 0;
}

.login-box {
  background: var(--bg-card);
  padding: 3rem 2.5rem;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  position: relative;
  z-index: 10;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  max-width: 140px;
  height: auto;
}

.form-group-login {
  margin-bottom: 1.5rem;
}

.form-group-login label {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary-light);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.form-group-login input {
  width: 100%;
  padding: 0.9rem 1rem;
  background-color: #eef2f6;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  color: #333;
  transition: all 0.2s;
}

.form-group-login input:focus {
  background-color: #e2e8f0;
  box-shadow: 0 0 0 2px rgba(74, 0, 114, 0.1);
}

.password-wrapper { position: relative; }
.toggle-pass {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  cursor: pointer;
  background: none;
  border: none;
}

.login-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.forgot-pass {
  font-size: 0.85rem;
  color: #64748b;
  text-decoration: none;
  font-weight: 600;
}

#loginBtn {
  width: 100%;
  padding: 1rem;
  background-color: var(--velo-orange);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
}

#loginBtn:hover { background-color: #e03e00; transform: translateY(-2px); }

#loginError {
  margin-top: 1rem;
  padding: 0.8rem;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
  display: none;
}

/* Checkbox customizado */
.checkbox-container {
  display: block;
  position: relative;
  padding-left: 25px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #475569;
  user-select: none;
}
.checkbox-container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark {
  position: absolute;
  top: 0; left: 0;
  height: 18px; width: 18px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
.checkbox-container input:checked ~ .checkmark { background: var(--primary-light); border-color: var(--primary-light); }
.checkmark::after { content: ""; position: absolute; display: none; }
.checkbox-container input:checked ~ .checkmark::after { display: block; }
.checkbox-container .checkmark::after {
  left: 6px; top: 2px;
  width: 4px; height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ============================================================
   15. RESPONSIVIDADE GLOBAL
   ============================================================ */
@media (max-width: 1024px) {
  .dashboard-header-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .content-body {
    padding: 1rem;
    gap: 1rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .topbar h2 {
    font-size: 1rem;
  }

  .date-badge {
    display: none;
  }

  .form-row {
    flex-direction: column;
  }

  .dashboard-header-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-info h3 { font-size: 1.5rem; }

  .login-bg-shape {
    width: 60vh;
    height: 60vh;
    left: -30vh;
  }

  .login-box {
    margin: 1.5rem;
    padding: 2rem 1.5rem;
  }
}