/* =============================================
   Santo Rango Express — Estilos Globais
   ============================================= */
:root {
  --primary: #e53e3e;
  --primary-dark: #c53030;
  --primary-light: #fc8181;
  --secondary: #fff5f5;
  --bg: #f7fafc;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --success: #38a169;
  --warning: #d69e2e;
  --danger: #e53e3e;
  --info: #3182ce;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

/* ── Header ── */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.app-header .logo { font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.app-header .search-box {
  flex: 1;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 24px;
  padding: 6px 14px;
  color: #fff;
  font-size: 14px;
  outline: none;
  max-width: 320px;
}
.app-header .search-box::placeholder { color: rgba(255,255,255,0.7); }
.app-header .search-box:focus { background: rgba(255,255,255,0.3); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-icon {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer; font-size: 1.1rem;
  transition: background .2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.35); }
.cart-count {
  background: #fff;
  color: var(--primary);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  position: absolute;
  top: -4px; right: -4px;
}
.cart-btn-wrap { position: relative; }

/* ── Botões ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: var(--primary); border: 1px solid var(--primary-light); }
.btn-secondary:hover:not(:disabled) { background: #fed7d7; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #2f855a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c53030; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--border); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 16px; }

/* ── Modais ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex; align-items: flex-end;
  animation: fadeIn .2s ease;
}
.modal-overlay.center { align-items: center; justify-content: center; }
.modal {
  background: var(--card-bg);
  width: 100%; max-width: 560px;
  border-radius: var(--radius) var(--radius) 0 0;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .25s ease;
}
.modal-overlay.center .modal {
  border-radius: var(--radius);
  max-height: 90vh;
  margin: 16px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--card-bg);
  z-index: 1;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Formulários ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); }
.form-control.error { border-color: var(--danger); }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Toast ── */
#toast-container {
  position: fixed; top: 70px; right: 16px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #1a202c;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: fadeIn .2s ease;
  max-width: 300px;
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #c6f6d5; color: var(--success); }
.badge-danger { background: #fed7d7; color: var(--danger); }
.badge-warning { background: #fefcbf; color: var(--warning); }
.badge-info { background: #bee3f8; color: var(--info); }
.badge-primary { background: #fff5f5; color: var(--primary); }

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #edf2f7 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 500;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text-muted);
}
#loading-overlay.visible { display: flex; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Utilitários ── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.d-none { display: none !important; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }

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

/* ── Input group ── */
.input-group { display: flex; }
.input-group .form-control { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; white-space: nowrap; }
