/* ============================================
   MotoEntrega Vape - Global CSS
   Tema: Claro | Fonte: Poppins | Icons: Font Awesome
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --secondary: #7c3aed;
  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0891b2;
  --info-soft: #cffafe;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-input: #f1f5f9;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;

  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: #3b82f6;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

button { font-family: inherit; cursor: pointer; border: none; outline: none; }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  border: none;
  outline: none;
  background: var(--bg-input);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  width: 100%;
  transition: all var(--transition);
}
input:focus, textarea:focus, select:focus {
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input::placeholder { color: var(--text-muted); }

textarea { resize: vertical; min-height: 100px; }

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* ---- Layout ---- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-sm { max-width: 480px; }
.container-md { max-width: 640px; }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 50%, #dbeafe 100%);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37,99,235,0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(124,58,237,0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(37,99,235,0.3);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
}

.login-logo p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form .input-wrapper {
  position: relative;
}

.login-form .input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.login-form .input-wrapper input {
  padding-left: 2.75rem;
}

.login-form .toggle-password {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  background: none;
  padding: 0.25rem;
}
.login-form .toggle-password:hover { color: var(--text-secondary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

.btn-sm { padding: 0.5rem 0.875rem; font-size: 0.8125rem; }

.btn-icon { width: auto; padding: 0.625rem; border-radius: var(--radius); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

/* ---- Loading Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  max-width: 400px;
  animation: toastIn 0.3s ease-out;
  pointer-events: auto;
  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-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.toast.success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast.warning .toast-icon { background: var(--warning-soft); color: var(--warning); }

.toast-content { flex: 1; }
.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.toast-message {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}
.toast-close {
  background: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.25rem;
  cursor: pointer;
}
.toast-close:hover { color: var(--text); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 0.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }

.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- Loading Overlay ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 9998;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
  border-color: rgba(37,99,235,0.2);
  border-top-color: var(--primary);
}

.loading-text {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 1.5rem; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }

/* ---- Status colors ---- */
.status-pendente { color: var(--warning); background: var(--warning-soft); }
.status-em_rota { color: var(--info); background: var(--info-soft); }
.status-em_entrega { color: var(--primary); background: var(--primary-soft); }
.status-entregue { color: var(--success); background: var(--success-soft); }
.status-cancelado { color: var(--danger); background: var(--danger-soft); }

/* ---- Bottom Nav (Mobile) ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all var(--transition);
  background: none;
}

.bottom-nav-item i { font-size: 1.25rem; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:hover:not(.active) { color: var(--text-secondary); background: var(--bg-hover); }

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Sidebar (Desktop) ---- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}

.sidebar-logo {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--text);
}

.sidebar-logo i {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  background: none;
  width: 100%;
}

.sidebar-item:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.sidebar-item i { width: 20px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ---- Content area ---- */
.content {
  flex: 1;
  padding: 1.25rem;
  padding-bottom: 5rem;
}

/* ---- Desktop layout ---- */
@media (min-width: 1024px) {
  .has-sidebar .content {
    margin-left: 260px;
    padding: 2rem;
  }
  .has-sidebar .bottom-nav { display: none; }
  .has-sidebar .topbar { margin-left: 260px; }
}

@media (max-width: 1023px) {
  .sidebar { display: none; }
}

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeInUp 0.4s ease-out; }

/* ---- Map container ---- */
.map-container {
  width: 100%;
  height: 300px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Selection ---- */
::selection {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* ---- Utility classes ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.5rem; }

.hidden { display: none !important; }
.w-full { width: 100%; }

/* ---- Moto marker on map ---- */
.moto-marker {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.125rem;
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
  border: 3px solid white;
  animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); }
  70% { box-shadow: 0 0 0 10px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}