/* ============================================================
   /assets/css/style.css
   Sistema MeuMotoboy - Design Moderno Mobile-First
   Fonte: Syne (display) + DM Sans (body)
   ============================================================ */

/* ── Variables ── */
:root {
  --c-bg:          #0d0f14;
  --c-surface:     #161922;
  --c-surface-2:   #1e2130;
  --c-border:      #282d3e;
  --c-text:        #e8eaf0;
  --c-muted:       #7a809a;
  --c-accent:      #f97316;     /* laranja principal */
  --c-accent-2:    #fb923c;
  --c-green:       #22c55e;
  --c-red:         #ef4444;
  --c-blue:        #3b82f6;
  --c-yellow:      #eab308;

  --sidebar-w:     260px;
  --topbar-h:      60px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,.35);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.2);

  --font-display:  'Syne', sans-serif;
  --font-body:     'DM Sans', sans-serif;

  --transition:    .18s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { color: var(--c-accent-2); }

img { max-width: 100%; display: block; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--c-surface); }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 99px; }

/* ── Layout Principal ── */
body {
  display: flex;
}

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.main-layout {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Sidebar Brand ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.brand-icon { font-size: 1.6rem; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--c-text);
  letter-spacing: -.02em;
}

/* ── Sidebar Nav ── */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--c-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

.nav-item.active {
  background: rgba(249,115,22,.12);
  color: var(--c-accent);
}

.nav-icon  { font-size: 1rem; width: 20px; text-align: center; }
.nav-label { flex: 1; }

/* ── Sidebar Footer ── */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--c-accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-name {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { font-size: .75rem; color: var(--c-muted); }

.btn-logout {
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--c-muted);
  font-size: 1.1rem;
  transition: color var(--transition);
}
.btn-logout:hover { color: var(--c-red); }

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--c-text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

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

.saldo-badge {
  background: rgba(249,115,22,.12);
  color: var(--c-accent);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid rgba(249,115,22,.2);
}

/* ── Content Area ── */
.content-area {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.03em;
}

.page-subtitle { color: var(--c-muted); font-size: .9rem; margin-top: 2px; }

/* ── Cards / Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--c-accent);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--c-text);
}

.stat-label { font-size: .8rem; color: var(--c-muted); margin-top: 2px; }

.stat-card.accent  { border-color: rgba(249,115,22,.3); }
.stat-card.green   { border-color: rgba(34,197,94,.3); }
.stat-card.blue    { border-color: rgba(59,130,246,.3); }
.stat-card.yellow  { border-color: rgba(234,179,8,.3); }

/* ── Card genérico ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

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

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

/* ── Table ── */
.table-responsive { overflow-x: auto; }

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

th {
  background: var(--c-surface-2);
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 700;
  color: var(--c-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── Badges/Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pendente   { background: rgba(234,179,8,.15); color: var(--c-yellow); }
.badge-aceito     { background: rgba(59,130,246,.15); color: var(--c-blue); }
.badge-em_rota    { background: rgba(249,115,22,.15); color: var(--c-accent); }
.badge-entregue   { background: rgba(34,197,94,.15);  color: var(--c-green); }
.badge-cancelado  { background: rgba(239,68,68,.15);  color: var(--c-red); }
.badge-aprovado   { background: rgba(34,197,94,.15);  color: var(--c-green); }
.badge-pago       { background: rgba(34,197,94,.15);  color: var(--c-green); }
.badge-recusado   { background: rgba(239,68,68,.15);  color: var(--c-red); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.btn-primary:hover {
  background: var(--c-accent-2);
  color: #fff;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--c-surface-2);
  color: var(--c-text);
  border-color: var(--c-border);
}
.btn-secondary:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.btn-success  { background: var(--c-green); color: #fff; }
.btn-success:hover { opacity: .85; color: #fff; }

.btn-danger   { background: var(--c-red);  color: #fff; }
.btn-danger:hover  { opacity: .85; color: #fff; }

.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--c-muted);
  letter-spacing: .02em;
}

input, select, textarea {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: .9rem;
  padding: 10px 14px;
  transition: border-color var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}

input::placeholder, textarea::placeholder { color: var(--c-muted); }

select option { background: var(--c-surface-2); }

textarea { resize: vertical; min-height: 90px; }

.input-hint { font-size: .78rem; color: var(--c-muted); }
.input-error { font-size: .78rem; color: var(--c-red); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 0 24px 16px;
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-sucesso {
  background: rgba(34,197,94,.1);
  border-color: rgba(34,197,94,.2);
  color: var(--c-green);
}

.alert-erro {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.2);
  color: var(--c-red);
}

.alert-info {
  background: rgba(59,130,246,.1);
  border-color: rgba(59,130,246,.2);
  color: var(--c-blue);
}

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: .9rem;
  opacity: .7;
  flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }

/* ── Pedido Card (motoboy view) ── */
.pedidos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.pedido-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color var(--transition), transform var(--transition);
}

.pedido-card:hover {
  border-color: var(--c-accent);
  transform: translateY(-2px);
}

.pedido-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 8px;
}

.pedido-empresa { font-size: .78rem; color: var(--c-muted); }
.pedido-cliente { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.pedido-endereco { font-size: .85rem; color: var(--c-muted); margin-bottom: 4px; }
.pedido-valor {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--c-green);
  margin: 12px 0;
}

.pedido-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Login Page ── */
/* Sobrescreve o display:flex do body usado no layout do sistema */
body:has(.login-page) {
  display: block;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  padding: 20px;
  background-image:
    radial-gradient(ellipse 60% 50% at 20% 40%, rgba(249,115,22,.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 80% 70%, rgba(59,130,246,.05) 0%, transparent 60%);
}

.login-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 18px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon { font-size: 2.8rem; display: block; margin-bottom: 8px; }
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.04em;
}
.login-logo p { color: var(--c-muted); font-size: .88rem; margin-top: 4px; }

.login-tabs {
  display: flex;
  background: var(--c-surface-2);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--c-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.login-tab.active {
  background: var(--c-accent);
  color: #fff;
}

.login-links {
  text-align: center;
  margin-top: 18px;
  font-size: .85rem;
  color: var(--c-muted);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--c-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { font-family: var(--font-display); font-weight: 700; color: var(--c-text); margin-bottom: 6px; }

/* ── Loading Spinner ── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

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

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

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-link {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  font-size: .85rem;
  color: var(--c-muted);
  transition: all var(--transition);
}

.page-link:hover, .page-link.active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

/* ── Utilities ── */
.text-muted     { color: var(--c-muted); }
.text-green     { color: var(--c-green); }
.text-red       { color: var(--c-red); }
.text-accent    { color: var(--c-accent); }
.text-center    { text-align: center; }
.fw-bold        { font-weight: 700; }
.mt-1           { margin-top: 8px; }
.mt-2           { margin-top: 16px; }
.mt-3           { margin-top: 24px; }
.mb-1           { margin-bottom: 8px; }
.mb-2           { margin-bottom: 16px; }
.d-flex         { display: flex; }
.align-center   { align-items: center; }
.gap-1          { gap: 8px; }
.gap-2          { gap: 16px; }
.flex-wrap      { flex-wrap: wrap; }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-layout {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .content-area {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .pedidos-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card { padding: 16px; }

  .login-card { padding: 28px 20px; }

  .table-responsive { margin: 0 -16px; }
  table { font-size: .82rem; }
  th, td { padding: 10px 10px; }

  .alert { margin: 0 16px 12px; }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .login-card { padding: 20px 16px; }
  .btn-lg { padding: 10px 20px; font-size: .9rem; }
}

/* ── Print / PDF (comprovantes) ── */
@media print {
  .sidebar, .topbar, .btn, .alert-close { display: none !important; }
  .main-layout { margin-left: 0; }
  .content-area { padding: 0; }
  body { background: #fff; color: #000; }
  .card {
    background: #fff;
    border: 1px solid #ccc;
    color: #000;
    break-inside: avoid;
  }
  .badge { border: 1px solid #999; }
  table { font-size: 11pt; }
  th { background: #eee !important; color: #000 !important; }
}
