/* ============================================================
   GLOBAL CSS — Minha Loja Virtual
   Variáveis, reset, tipografia, componentes base
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@700;800&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Variáveis de cor ─────────────────────────────────────── */
:root {
  --bg-primary: #0A0F0D;
  --bg-secondary: #111814;
  --bg-card: #161D19;
  --accent-green: #00E676;
  --accent-gold: #FFD700;
  --accent-green-muted: #00C956;
  --text-primary: #F0FFF4;
  --text-secondary: #8A9E90;
  --text-muted: #4A5E50;
  --border: #1E2D23;
  --border-active: #00E676;
  --danger: #FF4D4D;
  --success: #00E676;
  --warning: #FFB800;

  /* Tipografia */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Espaçamento */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Sombras com tonalidade verde */
  --shadow-sm: 0 2px 8px rgba(0, 230, 118, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 230, 118, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 230, 118, 0.12);
  --shadow-glow: 0 0 20px rgba(0, 230, 118, 0.3);

  /* Transições */
  --transition: 200ms ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  /* Grain texture overlay subtil */
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-green); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-green-muted); }
button, input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Tipografia ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.mono { font-family: var(--font-mono); }

/* ── Botões ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(255,255,255,0.08);
  transition: opacity var(--transition);
}

.btn:hover::after { opacity: 1; }

.btn-primary {
  background: var(--accent-green);
  color: #0A0F0D;
}

.btn-primary:hover {
  background: var(--accent-green);
  transform: translateY(-1px) scale(1.02);
  box-shadow: var(--shadow-glow);
  color: #0A0F0D;
}

.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: transparent;
  color: var(--accent-green);
  border: 1.5px solid var(--accent-green);
}

.btn-secondary:hover {
  background: rgba(0, 230, 118, 0.08);
  transform: translateY(-1px);
  color: var(--accent-green);
}

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

.btn-danger:hover {
  background: #e63939;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(0, 230, 118, 0.05);
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: 10px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  /* Glassmorphism subtil */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 230, 118, 0.15);
}

.card-sm { padding: 16px; border-radius: var(--radius-md); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green  { background: rgba(0, 230, 118, 0.15); color: var(--accent-green); }
.badge-gold   { background: rgba(255, 215, 0, 0.15);  color: var(--accent-gold); }
.badge-red    { background: rgba(255, 77, 77, 0.15);  color: var(--danger); }
.badge-gray   { background: rgba(74, 94, 80, 0.3);    color: var(--text-secondary); }
.badge-orange { background: rgba(255, 184, 0, 0.15);  color: var(--warning); }

/* ── Inputs ──────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.12);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%238A9E90' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

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

.table th {
  background: var(--bg-secondary);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

.table tr:last-child td { border-bottom: none; }

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-secondary); }
.table tbody tr:nth-child(even) { background: rgba(22, 29, 25, 0.5); }
.table tbody tr:nth-child(even):hover { background: var(--bg-secondary); }

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

.alert-success { background: rgba(0, 230, 118, 0.1); border: 1px solid rgba(0, 230, 118, 0.3); color: var(--accent-green); }
.alert-danger  { background: rgba(255, 77, 77, 0.1);  border: 1px solid rgba(255, 77, 77, 0.3);  color: var(--danger); }
.alert-warning { background: rgba(255, 184, 0, 0.1);  border: 1px solid rgba(255, 184, 0, 0.3);  color: var(--warning); }
.alert-info    { background: rgba(74, 143, 231, 0.1); border: 1px solid rgba(74, 143, 231, 0.3); color: #4A8FE7; }

/* ── Paginação ───────────────────────────────────────────── */
.paginacao {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 20px 0;
}

.paginacao a,
.paginacao span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.paginacao a {
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.paginacao a:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(0, 230, 118, 0.08);
}

.paginacao .ativo {
  background: var(--accent-green);
  color: #0A0F0D;
  font-weight: 700;
}

/* ── Skeleton loaders ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-secondary) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text  { height: 16px; margin-bottom: 8px; }
.skeleton-title { height: 28px; margin-bottom: 12px; }
.skeleton-card  { height: 120px; border-radius: var(--radius-lg); }

/* ── Utilitários ─────────────────────────────────────────── */
.text-green   { color: var(--accent-green); }
.text-gold    { color: var(--accent-gold); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-mono    { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: 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-24 { gap: 24px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.w-full { width: 100%; }
.hidden { display: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── Scrollbar personalizada ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Animações ───────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in  { animation: fadeIn 0.3s ease forwards; }
.animate-fade-up  { animation: fadeInUp 0.4s ease forwards; }
.spin { animation: spin 0.8s linear infinite; }

/* Reveal ao scroll (activado via JS) */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visivel {
  opacity: 1;
  transform: translateY(0);
}

/* ── Spinner de carregamento ─────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 20px; height: 20px; border-width: 2px; }

/* ── Toast / Notificações ────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease;
  font-size: 0.9rem;
}

.toast-success { border-left: 3px solid var(--accent-green); }
.toast-danger  { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }

/* ── Responsividade global ───────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .btn-lg { padding: 14px 24px; }
  .card { padding: 16px; }
  h1 { font-size: clamp(1.8rem, 6vw, 3rem); }
  h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
}
