/* ===== PALETA DE COLORES ===== */
:root {
  --rojo-capi: #E30613;
  --rojo-oscuro: #b1000e;
  --gris-claro: #d9d9d9;
  --gris-medio: #a8a8a8;
  --gris-oscuro: #5a5a5a;
  --carbon: #1a1a1a;
  --blanco: #fff;
  --verde-success: #28a745;
  --azul-primary: #007bff;
  --chilapa-primary: #2196F3;
}

/* ===== RESETEO BÁSICO ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--blanco);
  overflow-x: hidden;
  background:
    radial-gradient(1400px 900px at -8% -8%, rgba(227, 6, 19, .12), transparent 65%),
    radial-gradient(1100px 700px at 108% 8%, rgba(217, 217, 217, .10), transparent 60%),
    #0d0d0d;
}

/* ===== PARTÍCULAS ===== */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ===== BARRA DE PROGRESO ===== */
#scroll-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 5px;
  width: 0%;
  background: linear-gradient(90deg, var(--rojo-capi), var(--gris-claro), var(--rojo-capi));
  background-size: 200% 100%;
  z-index: 1000;
  box-shadow: 0 0 15px rgba(227, 6, 19, .6), 0 0 30px rgba(217, 217, 217, .3);
  animation: shimmer-bar 3s linear infinite;
}

@keyframes shimmer-bar {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== NAVBAR ===== */
.logo {
  height: 48px;
  filter: drop-shadow(0 2px 8px rgba(227, 6, 19, .5));
}

.navbar.transparent-nav {
  background: transparent;
  transition: background .4s, box-shadow .4s, backdrop-filter .4s;
  z-index: 1001;
}

.navbar.navbar-scrolled {
  background: rgba(13, 13, 13, .90);
  backdrop-filter: blur(12px) saturate(180%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(227, 6, 19, .25);
}

.navbar-brand span {
  font-weight: 700;
  background: linear-gradient(90deg, var(--blanco), var(--gris-claro));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.navbar .nav-link {
  color: var(--blanco) !important;
  margin-left: 12px;
  padding: 8px 16px !important;
  border-radius: 8px;
  transition: all .3s;
  position: relative;
}

.navbar .nav-link:hover {
  color: var(--rojo-capi) !important;
  text-shadow: 0 0 12px rgba(227, 6, 19, .6);
  transform: translateY(-2px);
}

/* ===== HERO ===== */
.hero-resumen {
  position: relative;
  z-index: 1;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 120px;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, .6);
  background: linear-gradient(135deg, rgba(227, 6, 19, .1) 0%, rgba(13, 13, 13, 0) 100%);
}

.hero-resumen h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  margin-bottom: 20px;
  font-weight: 700;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--gris-claro);
  opacity: .9;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== GRADIENT SHINE ===== */
.gradient-shine {
  background: linear-gradient(90deg, var(--gris-claro), #fff, var(--gris-medio), #fff, var(--gris-claro));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% auto;
  animation: shine 6s linear infinite;
}

@keyframes shine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ===== MAIN ===== */
.resumen-main {
  position: relative;
  z-index: 1;
  padding: 60px 0 100px;
}

/* ===== TARJETAS ===== */
.resumen-card {
  border: 1px solid rgba(227, 6, 19, .2);
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: all .4s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-bottom: 24px;
}

.resumen-card:hover {
  background: rgba(227, 6, 19, .08);
  border-color: rgba(227, 6, 19, .5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .4), 0 0 40px rgba(227, 6, 19, .25);
  transform: translateY(-8px);
}

.resumen-card .card-header {
  background: rgba(227, 6, 19, .08);
  border-bottom: 1px solid rgba(227, 6, 19, .2);
  padding: 20px 24px;
}

.resumen-card .card-header h5 {
  color: var(--gris-claro);
  font-weight: 700;
  font-size: 1.3rem;
}

.resumen-card .btn-link {
  color: var(--rojo-capi);
  font-size: .9rem;
  font-weight: 600;
}

.resumen-card .btn-link:hover {
  opacity: .8;
}

.resumen-card .card-body {
  padding: 24px;
}

/* ===== TABLA DE ITEMS (MEJORADA) ===== */
.tabla-items-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(227, 6, 19, .05), rgba(227, 6, 19, .02));
  border: 1px solid rgba(227, 6, 19, .15);
  margin-bottom: 20px;
}

.tabla-items {
  margin-bottom: 0;
}

.tabla-items thead {
  background: linear-gradient(135deg, rgba(227, 6, 19, .15), rgba(227, 6, 19, .08));
  backdrop-filter: blur(10px);
}

.tabla-items thead tr {
  border-bottom: 2px solid rgba(227, 6, 19, .25);
}

.tabla-items th {
  color: var(--gris-claro);
  font-weight: 700;
  font-size: .95rem;
  padding: 16px 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tabla-items tbody tr {
  border-bottom: 1px solid rgba(227, 6, 19, .1);
  transition: all .3s;
}

.tabla-items tbody tr:hover {
  background: rgba(227, 6, 19, .08);
  box-shadow: inset 0 0 0 1px rgba(227, 6, 19, .15);
}

.tabla-items tbody tr:last-child {
  border-bottom: none;
}

.tabla-items td {
  padding: 16px 12px;
  color: var(--blanco);
  font-weight: 500;
}

.tabla-items td strong {
  color: var(--rojo-capi);
  font-weight: 700;
}

.tabla-items td div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabla-items td div small {
  color: var(--blanco) !important;
  font-weight: 400;
  font-size: .85rem;
}

/* ===== BOTONES ITEM ===== */
.btn-item-editar {
  padding: 6px 12px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--rojo-capi);
  background: none;
  border: 1.5px solid var(--rojo-capi);
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
}

.btn-item-editar:hover {
  background: rgba(227, 6, 19, .2);
  transform: scale(1.05);
  box-shadow: 0 0 8px rgba(227, 6, 19, .3);
}

.btn-item-eliminar {
  padding: 6px 10px;
  font-size: .8rem;
  color: #ff6b6b;
  background: none;
  border: 1.5px solid #ff6b6b;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-item-eliminar:hover {
  background: rgba(255, 107, 107, .2);
  transform: scale(1.05);
  box-shadow: 0 0 8px rgba(255, 107, 107, .3);
}

/* ===== UBICACIÓN HÍBRIDA GPS + MANUAL ===== */
#btnUbicacionGPS,
#btnUbicacionManual {
  padding: 8px 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all .3s;
  border: 1.5px solid rgba(33, 150, 243, .5);
}

#btnUbicacionGPS {
  background: var(--chilapa-primary);
  color: var(--blanco);
}

#btnUbicacionGPS:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, .4);
}

#btnUbicacionManual {
  background: transparent;
  border: 1.5px solid rgba(33, 150, 243, .5);
  color: var(--gris-claro);
}

#btnUbicacionManual:hover {
  background: rgba(33, 150, 243, .1);
  border-color: var(--chilapa-primary);
  color: var(--chilapa-primary);
}

#btnUbicacionManual.active,
#btnUbicacionGPS.active {
  background: var(--chilapa-primary);
  color: var(--blanco);
  border-color: var(--chilapa-primary);
}

#formGPS,
#formManual {
  margin-top: 16px;
}

#resultadoGPS {
  padding: 12px;
  background: rgba(33, 150, 243, .08);
  border-radius: 8px;
  border-left: 3px solid var(--chilapa-primary);
  display: none;
}

#btnDetectarGPS {
  background: var(--chilapa-primary);
  color: var(--blanco);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all .3s;
  width: 100%;
}

#btnDetectarGPS:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(33, 150, 243, .4);
}

#btnDetectarGPS:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#latitud,
#longitud,
#distancia {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(33, 150, 243, .3);
  color: var(--blanco);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: monospace;
  margin-bottom: 8px;
}

#latitud:focus,
#longitud:focus,
#distancia:focus {
  border-color: var(--chilapa-primary);
  box-shadow: 0 0 0 0.25rem rgba(33, 150, 243, .25);
  outline: none;
}

/* ===== ALERTAS DE ESTADO ===== */
#statusUbicacion {
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  font-weight: 500;
}

.alert-info {
  background-color: rgba(33, 150, 243, .15);
  border: 1px solid #2196F3;
  color: #64B5F6;
}

.alert-success {
  background-color: rgba(76, 175, 80, .15);
  border: 1px solid #4CAF50;
  color: #81C784;
}

.alert-warning {
  background-color: rgba(251, 146, 60, .15);
  border: 1px solid #FB923C;
  color: #FED7AA;
}

.alert-danger {
  background-color: rgba(227, 6, 19, .15);
  border: 1px solid var(--rojo-capi);
  color: #FF6B6B;
}

#msgUbicacion {
  display: inline-block;
  animation: fadeIn .3s ease-in;
  color: var(--blanco) !important;
  font-size: .95rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== AUTOCOMPLETE COLONIAS ===== */
#autocomplete-colonias {
  position: absolute;
  background: rgba(13, 13, 13, .95);
  border: 1px solid rgba(227, 6, 19, .3);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  top: 100%;
  left: 0;
  margin-top: 4px;
}

#autocomplete-colonias div {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(227, 6, 19, .1);
  color: var(--gris-claro);
  transition: background .2s;
}

#autocomplete-colonias div:hover {
  background: rgba(227, 6, 19, .08);
  color: var(--rojo-capi);
}

#autocomplete-colonias div:last-child {
  border-bottom: none;
}

/* ===== FORMULARIO ===== */
.form-label {
  color: var(--gris-claro);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: .95rem;
}

.form-control,
.form-select {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(227, 6, 19, .3);
  color: var(--blanco);
  border-radius: 10px;
  transition: all .3s;
  padding: 10px 14px;
  position: relative;
}

.form-control:focus,
.form-select:focus {
  background: rgba(255, 255, 255, .12);
  border-color: var(--rojo-capi);
  box-shadow: 0 0 0 0.25rem rgba(227, 6, 19, .25);
  outline: none;
}

.form-control::placeholder {
  color: rgba(255, 255, 255, .5);
}

.form-control option {
  background: var(--carbon);
  color: var(--blanco);
}

.input-group-text {
  background: rgba(227, 6, 19, .1);
  border-color: rgba(227, 6, 19, .3);
  color: var(--rojo-capi);
  font-weight: 600;
}

/* ===== RADIO Y CHECKBOX ===== */
.form-check {
  margin-bottom: 12px;
}

.form-check-input {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(227, 6, 19, .5);
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all .2s;
}

.form-check-input:checked {
  background: var(--rojo-capi);
  border-color: var(--rojo-capi);
  box-shadow: 0 0 8px rgba(227, 6, 19, .5);
}

.form-check-input:focus {
  border-color: var(--rojo-capi);
  box-shadow: 0 0 12px rgba(227, 6, 19, .3);
}

.form-check-label {
  color: var(--gris-claro);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

/* ===== PROPINA ===== */
.propina-grupo {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-propina {
  transition: all .2s;
  border-color: rgba(227, 6, 19, .5);
  color: var(--gris-claro);
  font-weight: 600;
  padding: 8px 14px;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid;
}

.btn-propina:hover,
.btn-propina.active {
  background: linear-gradient(135deg, var(--rojo-capi), var(--rojo-oscuro));
  border-color: var(--rojo-capi);
  color: var(--blanco);
  box-shadow: 0 0 12px rgba(227, 6, 19, .4);
  transform: scale(1.05);
}

.propina-custom {
  width: auto;
  min-width: 110px;
}

#propinaManual {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(227, 6, 19, .3);
  color: var(--blanco);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 500;
}

#propinaManual:focus {
  background: rgba(255, 255, 255, .12);
  border-color: var(--rojo-capi);
  box-shadow: 0 0 0 0.25rem rgba(227, 6, 19, .25);
  outline: none;
}

#agendaHora {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(227, 6, 19, .3);
  color: var(--blanco);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 500;
}

#agendaHora:focus {
  background: rgba(255, 255, 255, .12);
  border-color: var(--rojo-capi);
  box-shadow: 0 0 0 0.25rem rgba(227, 6, 19, .25);
  outline: none;
}

/* ===== SIDEBAR STICKY (RESUMEN) ===== */
.resumen-sticky {
  position: sticky;
  top: 120px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.resumen-totales {
  padding: 16px 0;
  border-bottom: 1px solid rgba(227, 6, 19, .2);
  list-style: none;
}

.resumen-totales li {
  padding: 12px 0;
  color: rgba(255, 255, 255, .85);
  font-size: 1rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

.resumen-totales li strong {
  color: var(--gris-claro);
  font-weight: 700;
}

.total-row {
  border-top: 2px solid rgba(227, 6, 19, .2);
  border-bottom: 2px solid rgba(227, 6, 19, .2);
  padding: 12px 12px !important;
  margin-top: 12px !important;
  font-size: 1.1rem;
  background: rgba(227, 6, 19, .05);
  border-radius: 10px;
}

.total-row strong {
  font-size: 1.5rem;
  color: var(--rojo-capi);
}

/* ===== BOTONES ===== */
.btn {
  transition: all .3s;
  font-weight: 600;
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--rojo-capi), var(--rojo-oscuro));
  border: none;
  color: var(--blanco);
  padding: 10px 20px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(227, 6, 19, .3);
  background: linear-gradient(135deg, var(--rojo-oscuro), var(--rojo-capi));
}

.btn-primary:focus {
  box-shadow: 0 0 0 0.25rem rgba(227, 6, 19, .25);
}

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

.btn-outline-light {
  border: 1.5px solid rgba(227, 6, 19, .5);
  color: var(--gris-claro);
  background: none;
}

.btn-outline-light:hover {
  border-color: var(--rojo-capi);
  color: var(--rojo-capi);
  background: rgba(227, 6, 19, .1);
}

.btn-outline-danger {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.btn-outline-danger:hover {
  background: rgba(255, 107, 107, .15);
  border-color: #ff6b6b;
}

.btn-sm {
  padding: 6px 12px;
  font-size: .85rem;
}

.btn-lg {
  padding: 14px 24px !important;
  font-size: 1rem;
}

.btn-link {
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  color: var(--rojo-capi);
}

/* ===== REVEAL ANIMATION ===== */
.reveal {
  animation: revealCard 0.6s ease-out forwards;
  opacity: 0;
}

@keyframes revealCard {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal.show {
  opacity: 1;
  transform: none;
}

/* ===== MODAL ===== */
.modal-content {
  border: 1px solid rgba(227, 6, 19, .3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}

.modal-header {
  background: rgba(227, 6, 19, .08);
  border-bottom: 1px solid rgba(227, 6, 19, .2);
}

.modal-title {
  color: var(--gris-claro);
  font-weight: 700;
}

.modal-body {
  color: rgba(255, 255, 255, .85);
  padding: 30px 24px;
}

.modal-footer {
  border-top: 1px solid rgba(227, 6, 19, .2);
}

/* ===== FOOTER ===== */
.footer {
  background: rgba(0, 0, 0, .92);
  border-top: 2px solid rgba(227, 6, 19, .3);
  box-shadow: 0 -18px 45px rgba(0, 0, 0, .6);
  position: relative;
  z-index: 1;
}

.footer p {
  color: rgba(255, 255, 255, .82);
}

.social-icons a {
  color: var(--gris-claro);
  margin: 0 14px;
  font-size: 1.6rem;
  transition: all .35s;
  display: inline-block;
}

.social-icons a:hover {
  color: var(--rojo-capi);
  transform: translateY(-5px) scale(1.25);
  filter: drop-shadow(0 5px 14px rgba(227, 6, 19, .7));
}

/* ===== BOTÓN ARRIBA ===== */
#btnTop {
  position: fixed;
  right: 26px;
  bottom: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: none;
  background: linear-gradient(135deg, var(--rojo-capi), var(--rojo-oscuro));
  color: #fff;
  font-size: 28px;
  box-shadow: 0 0 22px rgba(227, 6, 19, .5);
  z-index: 1001;
  transition: all .35s;
  align-items: center;
  justify-content: center;
}

#btnTop:hover {
  transform: scale(1.14) translateY(-5px);
  box-shadow: 0 0 40px rgba(227, 6, 19, .8);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
  .resumen-sticky {
    position: static;
    top: auto;
    max-height: none;
  }

  .propina-grupo {
    flex-direction: column;
  }

  .propina-custom {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .hero-resumen {
    min-height: 40vh;
    padding-top: 100px;
  }

  .hero-resumen h1 {
    font-size: 1.8rem;
  }

  .tabla-items th,
  .tabla-items td {
    padding: 12px 8px;
    font-size: .9rem;
  }

  .tabla-items th {
    font-size: .85rem;
  }

  .resumen-card .card-body {
    padding: 16px;
  }

  .form-control,
  .form-select {
    font-size: 1rem;
  }

  .btn-propina {
    font-size: .8rem;
    padding: 6px 12px;
  }

  .btn-lg {
    padding: 12px 20px !important;
    font-size: .95rem;
  }
}

@media (max-width: 576px) {
  .hero-resumen h1 {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: .9rem;
  }

  .tabla-items th,
  .tabla-items td {
    padding: 10px 6px;
    font-size: .8rem;
  }

  .resumen-card {
    margin-bottom: 16px;
    border-radius: 12px;
  }

  .resumen-card .card-header {
    padding: 14px 12px;
  }

  .btn-propina {
    font-size: .75rem;
    padding: 5px 10px;
    flex: 1;
    min-width: 0;
  }

  .propina-custom {
    width: 100%;
    min-width: auto;
  }

  .btn {
    padding: 8px 16px;
    font-size: .9rem;
  }

  .total-row {
    font-size: 1rem;
  }

  .total-row strong {
    font-size: 1.3rem;
  }

  .resumen-totales li {
    font-size: .95rem;
    padding: 10px 0;
  }
}

/* ===== OVERRIDE PARA TEXTO ===== */
.text-muted {
  color: var(--blanco) !important;
}

.text-success {
  color: var(--blanco) !important;
}

input.form-control,
textarea.form-control,
select.form-control {
  color: var(--blanco) !important;
}