@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --amber: #e8a317;
  --amber-glow: #f5c84c;
  --ink-950: #0c1117;
  --ink-900: #121820;
  --ink-800: #1a2330;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
}

.font-display { font-family: 'Space Grotesk', system-ui, sans-serif; }

/* ── Background ── */
.garage-bg {
  background:
    radial-gradient(ellipse 70% 50% at 20% -5%, rgba(232,163,23,.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(56,189,248,.06), transparent 50%),
    linear-gradient(180deg, #0c1117 0%, #0f141c 45%, #0c1117 100%);
}

.garage-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.015'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,163,23,.25); }
  50% { box-shadow: 0 0 20px 4px rgba(232,163,23,.12); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.view-section {
  animation: fadeInUp 0.45s ease both;
}

.view-section.hidden { animation: none; }

.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(26,35,48,.95) 0%, rgba(18,24,32,.85) 100%);
  border: 1px solid rgba(255,255,255,.06);
  padding: 1.25rem;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  animation: fadeInUp 0.5s ease both;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(232,163,23,.2);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

.stat-card .stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: .75rem;
}

.stat-card .stat-value {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  margin-top: .5rem;
}

.panel-card {
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(26,35,48,.7) 0%, rgba(18,24,32,.5) 100%);
  border: 1px solid rgba(255,255,255,.05);
  padding: 1.25rem;
  backdrop-filter: blur(8px);
  transition: border-color var(--transition);
}

.panel-card:hover { border-color: rgba(255,255,255,.08); }

.orden-card {
  animation: fadeInUp 0.45s ease both;
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(26,35,48,.85) 0%, rgba(18,24,32,.7) 100%);
  border: 1px solid rgba(255,255,255,.05);
  padding: 1.25rem;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.orden-card:hover {
  border-color: rgba(232,163,23,.15);
  box-shadow: 0 12px 32px rgba(0,0,0,.3);
}

.inv-card {
  animation: fadeInUp 0.4s ease both;
  border-radius: .875rem;
  background: rgba(18,24,32,.6);
  border: 1px solid rgba(255,255,255,.05);
  padding: 1rem;
  transition: transform var(--transition), border-color var(--transition);
}

.inv-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.1); }
.inv-card.low-stock { border-color: rgba(248,113,113,.35); background: rgba(127,29,29,.12); }

/* ── Navigation ── */
.nav-active {
  background: linear-gradient(90deg, rgba(232,163,23,.15) 0%, rgba(232,163,23,.05) 100%);
  color: #f5c84c;
  border-left: 3px solid #e8a317;
  padding-left: calc(1rem - 3px) !important;
}

.nav-btn {
  transition: background var(--transition), color var(--transition), transform 0.15s ease;
}

.nav-btn:hover:not(.nav-active) {
  background: rgba(255,255,255,.04);
  transform: translateX(2px);
}

.nav-section-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #5c6b7a;
  padding: .5rem 1rem;
  margin-top: .5rem;
}

/* ── Forms & buttons ── */
.field {
  display: block;
  width: 100%;
  border-radius: .75rem;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(12,17,23,.7);
  padding: .65rem .9rem;
  color: #e8eef4;
  font-size: .95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field:focus {
  border-color: rgba(232,163,23,.55);
  box-shadow: 0 0 0 3px rgba(232,163,23,.12);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border-radius: .75rem;
  background: linear-gradient(180deg, #f0b429 0%, #e8a317 100%);
  color: #0c1117;
  font-weight: 600;
  padding: .7rem 1.25rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow var(--transition), filter var(--transition);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232,163,23,.35);
  filter: brightness(1.05);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .75rem;
  background: #1a2330;
  color: #e8eef4;
  font-weight: 500;
  padding: .65rem 1.25rem;
  border: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-secondary:hover { background: #222d3d; border-color: rgba(255,255,255,.15); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border-radius: .75rem;
  background: transparent;
  color: #a8b4c0;
  font-weight: 500;
  padding: .7rem 1.1rem;
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-ghost:hover {
  background: rgba(255,255,255,.05);
  color: #e8eef4;
  border-color: rgba(255,255,255,.18);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .75rem;
  background: transparent;
  color: #f87171;
  font-weight: 500;
  font-size: .85rem;
  padding: .45rem .75rem;
  border: 1px solid rgba(248,113,113,.25);
  cursor: pointer;
  transition: background var(--transition);
}

.btn-danger:hover { background: rgba(248,113,113,.1); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: .5rem;
}

.badge-espera { background: rgba(56,189,248,.15); color: #7dd3fc; }
.badge-proceso { background: rgba(232,163,23,.18); color: #f5c84c; }
.badge-terminado { background: rgba(52,211,153,.15); color: #6ee7b7; }

/* ── Tables ── */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

table.data th {
  text-align: left;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #5c6b7a;
  padding: .6rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

table.data td {
  padding: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: #e8eef4;
}

table.data tbody tr {
  transition: background var(--transition);
}

table.data tbody tr:hover { background: rgba(255,255,255,.02); }

/* ── Timeline (historial) ── */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: .35rem;
  top: .5rem;
  bottom: .5rem;
  width: 2px;
  background: linear-gradient(180deg, rgba(232,163,23,.4), rgba(255,255,255,.08));
}

.timeline-item {
  position: relative;
  padding-bottom: 1rem;
  animation: slideInLeft 0.35s ease both;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.15rem;
  top: .35rem;
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  background: #e8a317;
  border: 2px solid var(--ink-900);
  box-shadow: 0 0 8px rgba(232,163,23,.4);
}

.timeline-item:last-child { padding-bottom: 0; }

/* ── Camera ── */
.camera-widget {
  border-radius: 1rem;
  border: 1px dashed rgba(232,163,23,.35);
  background: rgba(12,17,23,.5);
  padding: 1rem;
  transition: border-color var(--transition);
}

.camera-widget.has-photo { border-style: solid; border-color: rgba(52,211,153,.3); }

.camera-preview {
  width: 100%;
  max-height: 240px;
  border-radius: .75rem;
  background: #0c1117;
  object-fit: cover;
  display: none;
}

.camera-preview.active { display: block; }

.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2rem;
  color: #5c6b7a;
  text-align: center;
}

.camera-placeholder.hidden { display: none; }

.moto-thumb {
  width: 5rem;
  height: 5rem;
  border-radius: .75rem;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.moto-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* ── Quick actions ── */
.quick-action {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  border-radius: .875rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.15s ease;
  text-align: left;
  width: 100%;
  color: inherit;
}

.quick-action:hover {
  background: rgba(232,163,23,.08);
  border-color: rgba(232,163,23,.25);
  transform: translateX(4px);
}

.quick-action-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Modals ── */
.modal-overlay {
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  animation: fadeInUp 0.3s ease;
}

/* ── Login ── */
#login-screen .rounded-2xl {
  animation: fadeInUp 0.6s ease;
  backdrop-filter: blur(12px);
}

#login-screen .rounded-2xl:hover {
  animation: pulseGlow 3s ease infinite;
}

/* ── Toast ── */
#toast {
  animation: fadeInUp 0.3s ease;
  backdrop-filter: blur(8px);
}

#toast.show { display: block; }
#toast.ok { background: rgba(26,58,42,.95); color: #6ee7b7; border: 1px solid rgba(110,231,183,.3); }
#toast.err { background: rgba(58,26,26,.95); color: #fca5a5; border: 1px solid rgba(252,165,165,.3); }

/* ── Sidebar ── */
#sidebar-nav { animation: slideInLeft 0.4s ease; }

/* ── Page header ── */
.page-header {
  animation: fadeInUp 0.4s ease;
}

.page-header h1 {
  background: linear-gradient(135deg, #fff 0%, #a8b4c0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Activity feed ── */
.activity-item {
  transition: background var(--transition);
  border-radius: .5rem;
  margin: 0 -.5rem;
  padding: .75rem .5rem;
}

.activity-item:hover { background: rgba(255,255,255,.03); }

/* ── Tracking page ── */
.tracking-hero { animation: fadeInUp 0.5s ease; }
.tracking-result { animation: fadeInUp 0.45s ease 0.1s both; }

.status-step {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 0;
  opacity: .4;
  transition: opacity var(--transition);
}

.status-step.active { opacity: 1; }
.status-step.done { opacity: .7; }

.status-dot {
  width: .75rem;
  height: .75rem;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  flex-shrink: 0;
}

.status-step.active .status-dot {
  background: #e8a317;
  box-shadow: 0 0 10px rgba(232,163,23,.5);
}

.status-step.done .status-dot { background: #34d399; }

/* ── Print ── */
@media print {
  body * { visibility: hidden !important; }
  #print-ticket, #print-ticket * { visibility: visible !important; }
  #print-ticket {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 24px;
    background: #fff !important;
    color: #1a1a1a !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
