/* Gouty Revisão Pro — Design System v2 */

:root {
  --bg: #0a0a0f;
  --bg-card: #111118;
  --bg-elevated: #16161f;
  --bg-hover: #1c1c28;
  --border: rgba(139,92,246,0.15);
  --border-hover: rgba(139,92,246,0.4);
  --purple: #8b5cf6;
  --purple-light: #a78bfa;
  --purple-dark: #6d28d9;
  --purple-glow: rgba(139,92,246,0.3);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139,92,246,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 100% 80%, rgba(168,85,247,0.06) 0%, transparent 50%);
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--purple-dark); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* Glass Cards */
.glass-card {
  background: rgba(17,17,24,0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.glass-card:hover { border-color: var(--border-hover); }

/* Glow Effects */
.glow-purple { box-shadow: 0 0 30px var(--purple-glow), 0 0 60px rgba(139,92,246,0.1); }
.glow-green { box-shadow: 0 0 20px rgba(16,185,129,0.3); }
.glow-red { box-shadow: 0 0 20px rgba(239,68,68,0.3); }

/* Gradient Button */
.btn-primary {
  background: linear-gradient(135deg, var(--purple-dark), var(--purple-light));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px var(--purple-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px var(--purple-glow);
  filter: brightness(1.1);
}
.btn-primary:active { transform: translateY(0); }

/* Input */
.input-dark {
  background: rgba(10,10,15,0.8);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 14px;
}
.input-dark:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}
.input-dark::placeholder { color: var(--text-muted); }

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, #0e0e18 0%, #0a0a0f 100%);
  border-right: 1px solid var(--border);
  width: 240px;
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin: 1px 0;
}
.sidebar-link:hover {
  background: rgba(139,92,246,0.12);
  color: var(--purple-light);
}
.sidebar-link.active {
  background: rgba(139,92,246,0.2);
  color: var(--purple-light);
  box-shadow: inset 3px 0 0 var(--purple);
}
.sidebar-link .icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 15px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
}
.sidebar-link.active .icon {
  background: rgba(139,92,246,0.25);
}

/* Status Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-recebida { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-analise { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-manutencao { background: rgba(249,115,22,0.15); color: #fb923c; border: 1px solid rgba(249,115,22,0.3); }
.badge-finalizada { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-alta { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-media { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-baixa { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-card:hover::before { opacity: 1; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table td { padding: 14px 16px; font-size: 13.5px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.data-table tr:hover td { background: rgba(139,92,246,0.04); }
.data-table tr:last-child td { border-bottom: none; }

/* Product Card */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 30px rgba(139,92,246,0.1);
}
.product-card .img-wrap {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  overflow: hidden;
  position: relative;
}
.product-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.product-card:hover .img-wrap img { transform: scale(1.05); }
.product-card .img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(168,85,247,0.05));
}

/* Chat */
.chat-bubble-mine { background: linear-gradient(135deg, var(--purple-dark), var(--purple)); color: white; border-radius: 16px 16px 4px 16px; padding: 10px 14px; max-width: 70%; }
.chat-bubble-other { background: var(--bg-elevated); color: var(--text-primary); border-radius: 16px 16px 16px 4px; border: 1px solid var(--border); padding: 10px 14px; max-width: 70%; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-purple { 0%,100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.4); } 50% { box-shadow: 0 0 0 8px rgba(139,92,246,0); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-up { animation: fadeInUp 0.4s ease both; }
.animate-fade { animation: fadeIn 0.3s ease both; }
.pulse-notify { animation: pulse-purple 2s infinite; }

/* Progress Steps */
.step-active { background: var(--purple); color: white; }
.step-done { background: rgba(16,185,129,0.2); color: var(--green); border: 1px solid var(--green); }
.step-pending { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.step-line-done { background: var(--green); }
.step-line-pending { background: var(--border); }

/* Topbar */
.topbar {
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 16px;
}

/* Main content area with sidebar offset */
.main-with-sidebar { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-with-sidebar { margin-left: 0; }
  .mobile-overlay { display: block; }
}
@media (min-width: 769px) {
  .mobile-overlay { display: none !important; }
  #mobile-toggle { display: none; }
}

/* WhatsApp Button */
.btn-whatsapp {
  background: linear-gradient(135deg, #128C7E, #25D366);
  color: white;
  border-radius: 12px;
  padding: 14px 24px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(37,211,102,0.3);
}
.btn-whatsapp:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(37,211,102,0.4); }

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  z-index: 9999;
  animation: fadeInUp 0.3s ease;
  max-width: 360px;
}

/* PWA Install Banner */
#pwa-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9998;
  animation: fadeInUp 0.4s ease;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 30px var(--purple-glow);
  white-space: nowrap;
}

/* Form section */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }

/* Select */
select.input-dark { cursor: pointer; }
select.input-dark option { background: #1a1a2e; }

/* Textarea */
textarea.input-dark { resize: vertical; min-height: 80px; }

/* Notification dot */
.notif-dot { width: 8px; height: 8px; background: var(--red); border-radius: 50%; display: inline-block; }

/* Image upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-area:hover { border-color: var(--purple); background: rgba(139,92,246,0.05); }

/* Skeleton loading */
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px; }

/* =============================================
   GOUTY — Melhorias v3: Logo + novas funções
   ============================================= */

/* Sidebar: logo da empresa */
.sidebar-logo-wrap {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.sidebar-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(139,92,246,0.1);
  padding: 2px;
  box-shadow: 0 4px 15px rgba(139,92,246,0.3);
  flex-shrink: 0;
}
.sidebar-brand {
  display: block;
  font-weight: 800;
  font-size: 15px;
  color: #f1f5f9;
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.sidebar-sub {
  display: block;
  font-size: 9px;
  color: #8b5cf6;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-top: 1px;
}

/* Sidebar: user card */
.sidebar-user-card {
  margin: 10px;
  padding: 10px 12px;
  background: rgba(139,92,246,0.08);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 99px;
}
.sidebar-role-admin    { background: rgba(139,92,246,0.2); color: #a78bfa; }
.sidebar-role-mecanico { background: rgba(59,130,246,0.2); color: #60a5fa; }
.sidebar-role-cliente  { background: rgba(16,185,129,0.2); color: #34d399; }

/* Sidebar: nav */
.sidebar-nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 4px 4px;
}
.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 6px;
}
.nav-label { flex: 1; }

/* Sidebar: footer / logout */
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #f87171;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.1); }
.sidebar-logout .icon { background: rgba(239,68,68,0.1); }

/* Topbar refinamentos */
.topbar-toggle {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
}
.topbar-toggle:hover { background: rgba(255,255,255,0.06); }
.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-logo-mobile {
  display: none;
  align-items: center;
  gap: 6px;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.15s;
}
.topbar-btn:hover { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.4); color: #a78bfa; }
.topbar-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #ef4444;
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}
.topbar-badge-purple { background: var(--purple); }
.topbar-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  cursor: default;
}

/* Flash toast */
.flash-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  transition: opacity 0.3s, transform 0.3s;
  animation: fadeInUp 0.3s ease;
  max-width: 360px;
}
.flash-success { border-color: rgba(16,185,129,0.4); }
.flash-error   { border-color: rgba(239,68,68,0.4); }

/* Page main */
.page-main { flex: 1; padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* Mobile overlay */
.mobile-overlay {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

/* Timer badge */
.timer-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  color: #34d399;
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* Checklist */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 6px;
}
.checklist-status-ok     { color: #34d399; }
.checklist-status-atencao{ color: #fbbf24; }
.checklist-status-ruim   { color: #f87171; }

/* Avaliação estrelas */
.star-rating { display: flex; gap: 4px; }
.star { font-size: 22px; cursor: pointer; color: #475569; transition: color 0.1s; }
.star.active,.star:hover { color: #f59e0b; }

/* Diário de serviço */
.diario-entry {
  border-left: 3px solid var(--purple);
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: 0 10px 10px 0;
  margin-bottom: 8px;
}
.diario-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

/* Relatório */
.receita-bar {
  height: 8px;
  background: linear-gradient(90deg, var(--purple-dark), var(--purple-light));
  border-radius: 99px;
  transition: width 0.4s;
}

/* Peças da ordem */
.peca-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  color: #60a5fa;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVIDADE COMPLETA — Mobile first
   ═══════════════════════════════════════════════════ */

/* Topbar mobile */
@media (max-width: 768px) {
  .topbar-logo-mobile { display: flex; }
  .topbar-title { font-size: 14px; }

  /* Página principal */
  .page-main { padding: 14px; }

  /* Grids de cards viram coluna única */
  [style*="grid-template-columns:repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }

  /* Stat cards menores */
  .stat-card { padding: 16px !important; }
  .stat-card p:first-of-type { font-size: 22px !important; }

  /* Tabelas: scroll horizontal */
  .data-table { min-width: 540px; }
  [style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; }

  /* Glass card padding menor */
  .glass-card { border-radius: 12px; }

  /* Formulários empilhados */
  form[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  form > div[style*="grid-column:1/-1"] {
    grid-column: 1 !important;
  }

  /* Botões full-width em forms pequenos */
  .btn-primary { width: 100%; justify-content: center; }

  /* Formulários de filtro empilhados */
  form[style*="display:flex"][style*="flex-wrap:wrap"] {
    flex-direction: column;
  }

  /* Estoque: inline edit scroll */
  #add-form form { display: flex !important; flex-direction: column !important; }
  #add-form form > div[style*="grid-column"] { order: 99; }

  /* Ordem: painel de ações em coluna */
  .ordem-actions-grid { grid-template-columns: 1fr !important; }

  /* Mensagens: input mais compacto */
  form[style*="display:flex;gap:8px"] { flex-direction: column; }
  form[style*="display:flex;gap:8px"] input { width: 100% !important; }

  /* Topbar avatar texto truncado */
  .topbar-avatar { width: 32px; height: 32px; font-size: 13px; }

  /* Badges menores */
  .badge { font-size: 10px; padding: 2px 7px; }

  /* Sidebar overlay mais rápido */
  .sidebar { transition: transform 0.2s ease; }
}

/* ── Tablet (769-1024) ──────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .main-with-sidebar { margin-left: 220px; }
  .sidebar { width: 220px; }
  .page-main { padding: 20px; }

  [style*="grid-template-columns:repeat(auto-fit,minmax(200px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── Ajustes gerais de acessibilidade e touch ───── */
@media (max-width: 1024px) {
  /* Links e botões com área de toque maior */
  .sidebar-link { min-height: 44px; }
  .btn-primary  { min-height: 44px; }
  .topbar-btn   { min-width: 44px; min-height: 44px; }

  /* Inputs mais fáceis de tocar */
  .input-dark { min-height: 44px; font-size: 16px; } /* 16px evita zoom no iOS */
  select.input-dark { min-height: 44px; }

  /* Formulários de ver_ordem: empilhar colunas */
  [style*="display:flex;flex-wrap:wrap;gap:24px"] {
    flex-direction: column !important;
  }
}

/* ── Utilitários responsivos ──────────────────────── */
.hide-mobile  { display: block; }
.show-mobile  { display: none; }

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}

