/* ============================================================
   BazzanTech · Registro Taller · CSS enchulado
   Paleta: Rojo #E11D22 / Azul #009FE3 / Negro #1A1A1A / Gris #F5F5F5
   ============================================================ */

:root {
  --rojo: #E11D22;
  --rojo-dark: #B3141A;
  --rojo-glow: rgba(225,29,34,.45);
  --azul: #009FE3;
  --azul-dark: #007BB3;
  --negro: #1A1A1A;
  --negro-soft: #2a2a2a;
  --gris-fondo: #F2F2F4;
  --gris-card: #FFFFFF;
  --gris-borde: #E1E1E5;
  --gris-texto: #555;
  --verde: #25D366;
  --verde-ok: #16A34A;
  --verde-soft: #EFFBF3;
  --sombra-sm: 0 1px 3px rgba(0,0,0,.06);
  --sombra: 0 4px 16px rgba(0,0,0,.08);
  --sombra-lg: 0 12px 32px rgba(0,0,0,.14);
  --radius: 14px;
  --radius-sm: 10px;
  --max-w: 760px;
  --trans: .18s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  background: var(--gris-fondo);
  color: var(--negro);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}
body { min-height: 100vh; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* Scroll suave */
html { scroll-behavior: smooth; }

/* ============================================================
   LOGIN — fondo rojo BazzanTech, card flotante
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 80% 10%, rgba(0,159,227,.25), transparent 55%),
    radial-gradient(circle at 10% 90%, rgba(0,159,227,.18), transparent 50%),
    linear-gradient(160deg, #1A1A1A 0%, #2a1010 60%, #4a1216 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
  text-align: center;
  animation: pop .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop { from { opacity:0; transform: translateY(10px) scale(.95); } to { opacity:1; transform: none; } }
.login-logo {
  width: 130px; height: 130px; object-fit: contain;
  margin: 0 auto 10px;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.15));
}
.tagline {
  margin: 0 0 26px;
  color: var(--gris-texto);
  font-size: 14px;
  letter-spacing: .3px;
}
#login-form .input-wrap { margin-bottom: 18px; }
.login-card .msg-error {
  color: var(--rojo); font-weight: 600; margin: 8px 0 0;
  animation: shake .4s;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ============================================================
   INPUT WRAP — icono + input
   ============================================================ */
.input-wrap {
  position: relative;
  display: flex; align-items: center;
}
.input-wrap.textarea-wrap { align-items: flex-start; }
.input-icon {
  position: absolute;
  left: 14px;
  width: 22px; height: 22px;
  color: #B0B0B6;
  pointer-events: none;
  flex-shrink: 0;
  transition: color var(--trans);
}
.textarea-wrap .input-icon { top: 14px; }
.input-wrap input,
.input-wrap textarea {
  width: 100%;
  padding: 16px 14px 16px 46px;
  font-size: 17px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radius-sm);
  font-family: inherit;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
  background: #fff;
  resize: vertical;
}
.textarea-wrap textarea { padding-top: 14px; padding-bottom: 14px; }
.input-wrap input:focus,
.input-wrap textarea:focus {
  border-color: var(--rojo);
  box-shadow: 0 0 0 4px var(--rojo-glow);
}
.input-wrap input:focus ~ .input-icon,
.input-wrap textarea:focus ~ .input-icon { color: var(--rojo); }
.input-wrap input::placeholder, .input-wrap textarea::placeholder { color: #B0B0B6; }

/* ============================================================
   APP GENERAL
   ============================================================ */
.app {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px 80px;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #1A1A1A, #232323);
  color: #fff;
  padding: 12px 18px;
  margin: 0 -16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  animation: slideDown .3s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: none; } }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo-small {
  height: 38px; width: auto; object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.badge {
  background: var(--rojo);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .6px;
  box-shadow: 0 2px 6px var(--rojo-glow);
}

/* ============================================================
   SECCIONES — cards con sombra generosa
   ============================================================ */
.form-section, .list-section {
  background: var(--gris-card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--sombra);
  margin-bottom: 20px;
}
.list-section { padding-bottom: 28px; }
.section-title {
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--negro);
  padding-left: 14px;
  border-left: 4px solid var(--rojo);
  line-height: 1.1;
}
.sep { display: none; }

/* ============================================================
   FORMULARIO — fieldsets con sub-títulos
   ============================================================ */
.grupo {
  border: none;
  padding: 4px 0 6px;
  margin: 0 0 18px;
  border-top: 1px dashed var(--gris-borde);
  padding-top: 18px;
}
.grupo:first-of-type { border-top: none; padding-top: 4px; margin-top: 0; }
.grupo legend {
  font-size: 14px;
  font-weight: 700;
  color: var(--gris-texto);
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.legend-icon { font-size: 16px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--negro);
}
#in-patente {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 19px;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn-grande {
  display: block; width: 100%;
  padding: 18px 16px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .5px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .08s, background var(--trans), box-shadow var(--trans);
  margin-top: 8px;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-grande:active { transform: translateY(1px) scale(.99); }
.btn-gris { background: #E8E8EC; color: var(--negro); }
.btn-gris:hover { background: #DCDCE2; }
.btn-rojo {
  background: linear-gradient(180deg, var(--rojo), var(--rojo-dark));
  color: #fff;
  box-shadow: 0 6px 18px var(--rojo-glow);
}
.btn-rojo:hover { box-shadow: 0 8px 22px var(--rojo-glow); transform: translateY(-1px); }
.btn-rojo:active { transform: translateY(1px); box-shadow: 0 4px 10px var(--rojo-glow); }
.btn-icon { font-size: 22px; line-height: 1; }

.btn-chico {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .08s, background var(--trans);
}
.btn-chico:active { transform: scale(.96); }
.btn-azul { background: var(--azul); color: #fff; box-shadow: 0 3px 8px rgba(0,159,227,.3); }
.btn-azul:hover { background: var(--azul-dark); }
.btn-icon-sm { width: 14px; height: 14px; }
.topbar .btn-gris {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,.25);
  padding: 8px 14px;
}
.topbar .btn-gris:hover { background: rgba(255,255,255,.1); }

/* ============================================================
   BUSCADOR
   ============================================================ */
.search-wrap {
  position: relative; display: flex; align-items: center;
  margin-bottom: 16px;
}
.search-wrap .input-icon { left: 14px; }
.search-wrap input {
  width: 100%;
  padding: 14px 14px 14px 46px;
  font-size: 16px;
  border: 2px solid var(--gris-borde);
  border-radius: 12px;
  outline: none;
  background: var(--gris-fondo);
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
}
.search-wrap input:focus {
  border-color: var(--azul);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,159,227,.18);
}
.search-wrap input:focus ~ .input-icon { color: var(--azul); }

/* ============================================================
   LISTA DE AUTOS — card con sombra, animación de entrada, hover
   ============================================================ */
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.list-header .section-title { margin: 0; }
.lista { display: flex; flex-direction: column; gap: 14px; }

.card-auto {
  background: var(--gris-card);
  border: 2px solid var(--gris-borde);
  border-left: 6px solid var(--rojo);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  box-shadow: var(--sombra-sm);
  animation: fadeIn .35s ease both;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card-auto:hover { transform: translateY(-2px); box-shadow: var(--sombra); }
.card-auto.flash { animation: flash 1.6s ease; }
@keyframes flash {
  0%   { background-color: var(--verde-soft); border-left-color: var(--verde-ok); box-shadow: 0 0 0 4px rgba(22,163,74,.2); }
  100% { background-color: #fff; border-left-color: var(--rojo); }
}

.card-patente {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1.5px;
  color: #fff;
  background: var(--negro);
  padding: 5px 12px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 6px;
}
.card-marca { font-size: 15px; color: var(--gris-texto); margin-top: 4px; }
.card-nombre { font-weight: 700; font-size: 16px; margin-top: 10px; color: var(--negro); }
.card-motivo {
  margin-top: 8px;
  font-size: 15px;
  color: #333;
  background: #F9FAFB;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--azul);
  white-space: pre-wrap; word-wrap: break-word;
}

/* Footer de la card: tel + iconos + fecha */
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; gap: 8px; flex-wrap: wrap;
}
.card-tel { font-size: 15px; font-weight: 600; color: var(--gris-texto); }
.card-fecha { font-size: 12px; color: #999; margin-left: auto; font-weight: 500; }
.iconos-tel { display: flex; gap: 10px; align-items: center; }
.icono-tel {
  display: inline-flex; flex-direction: column; align-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform .12s, box-shadow var(--trans);
  justify-content: center;
  flex-shrink: 0;
}
.icono-tel:hover { transform: translateY(-2px) scale(1.05); }
.icono-tel:active { transform: scale(.95); }
.icono-tel svg { width: 24px; height: 24px; }
.icono-wsp { background: var(--verde); box-shadow: 0 4px 12px rgba(37,211,102,.4); }
.icono-call { background: var(--azul); box-shadow: 0 4px 12px rgba(0,159,227,.4); }
.icono-label { font-size: 9px; font-weight: 700; margin-top: 1px; letter-spacing: .2px; }

/* Acciones admin */
.acciones-admin {
  display: flex; gap: 10px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--gris-borde);
}
.btn-editar, .btn-borrar {
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex: 1;
  transition: transform .08s, background var(--trans);
}
.btn-editar:active, .btn-borrar:active { transform: scale(.97); }
.btn-editar { background: #F1F1F4; color: var(--negro); }
.btn-editar:hover { background: #E5E5EA; }
.btn-borrar { background: var(--rojo); color: #fff; box-shadow: 0 3px 8px var(--rojo-glow); }
.btn-borrar:hover { background: var(--rojo-dark); }
.btn-borrar.confirmar { background: #FF6B00; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.04);} }

/* ============================================================
   TOAST — slide-in con icono
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--negro);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  box-shadow: var(--sombra-lg);
  z-index: 100;
  max-width: 90vw;
  text-align: center;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok  { background: var(--verde-ok); }
.toast.err { background: var(--rojo); }
.toast-ico { font-size: 20px; line-height: 1; }

/* ============================================================
   VACIO + SPINNER
   ============================================================ */
.vacio {
  text-align: center; color: #999;
  padding: 32px 10px;
  font-style: italic;
  font-size: 15px;
}
.cargando {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 28px 10px;
  color: #888; font-size: 14px;
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--gris-borde);
  border-top-color: var(--rojo);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BOTÓN SCROLL-ARRIBA
   ============================================================ */
.btn-top {
  position: fixed;
  right: 20px; bottom: 80px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--rojo);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--rojo-glow);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--trans), opacity .2s;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
}
.btn-top.show { opacity: 1; pointer-events: auto; }
.btn-top:hover { transform: translateY(-3px); }
.btn-top svg { width: 24px; height: 24px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 700px) {
  body { font-size: 18px; }
  .app { padding: 0 24px 90px; }
  .form-section, .list-section { padding: 30px; }
  .field { margin-bottom: 16px; }
  #in-patente, #in-marca { font-size: 19px; }
  .card-patente { font-size: 20px; }
  .btn-top { right: calc(50% - 380px + 20px); }
}
@supports (-webkit-touch-callout: none) {
  .input-wrap input, .input-wrap textarea, .search-wrap input { font-size: 16px; }
}
