/* =========================================================
   AGROMAQ - Modales
   Archivo: assets/css/modal.css
========================================================= */

.agx-modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: grid;
  place-items: center;
  padding: 18px;
  visibility: hidden;
  pointer-events: none;
}

.agx-modal.open {
  visibility: visible;
  pointer-events: auto;
}

.agx-modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 18%, rgba(227, 27, 35, 0.16), transparent 34%),
    rgba(17, 19, 21, 0.72);
  opacity: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.24s ease;
}

.agx-modal.open .agx-modal-backdrop {
  opacity: 1;
}

.agx-modal-box {
  position: relative;
  z-index: 2;
  width: min(720px, 100%);
  max-height: min(90dvh, 860px);
  overflow: hidden auto;
  color: var(--ag-dark-950, #111315);
  background: linear-gradient(135deg, #ffffff 0%, #fbfbf8 58%, #f1f1ef 100%);
  border: 1px solid rgba(227, 27, 35, 0.28);
  border-radius: 16px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.38);
  transform: translateY(14px) scale(0.985);
  opacity: 0;
  transition:
    transform 0.26s cubic-bezier(.2,.8,.2,1),
    opacity 0.26s ease;
}

.agx-modal.open .agx-modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.agx-modal-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(17, 19, 21, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 19, 21, 0.03) 1px, transparent 1px);
  background-size: 38px 38px;
  pointer-events: none;
}

.agx-modal-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 28px;
  color: var(--ag-white, #ffffff);
  background:
    linear-gradient(145deg, var(--ag-dark-950, #111315), var(--ag-dark-800, #282d32)),
    radial-gradient(circle at 18% 0%, rgba(227, 27, 35, 0.24), transparent 38%);
  border-bottom: 3px solid var(--ag-red-500, #e31b23);
}

.agx-modal-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--ag-red-400, #ff3138);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agx-modal-head h2 {
  margin: 0;
  color: var(--ag-white, #ffffff);
  font-size: clamp(27px, 4vw, 38px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.agx-modal-head p {
  margin: 9px 0 0;
  max-width: 520px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 750;
}

.agx-icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ag-white, #ffffff);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease;
}

.agx-icon-btn:hover {
  transform: translateY(-2px);
  background: rgba(227, 27, 35, 0.2);
  border-color: rgba(227, 27, 35, 0.55);
}

.agx-auth-tabs {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 20px 28px 0;
}

.agx-auth-tab {
  min-height: 48px;
  padding: 0 14px;
  color: var(--ag-dark-950, #111315);
  background: #ffffff;
  border: 1px solid rgba(17, 19, 21, 0.12);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    color 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease;
}

.agx-auth-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(227, 27, 35, 0.35);
}

.agx-auth-tab.active {
  color: var(--ag-white, #ffffff);
  background: linear-gradient(135deg, var(--ag-red-700, #a90f16), var(--ag-red-500, #e31b23));
  border-color: rgba(227, 27, 35, 0.5);
}

.agx-form-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 22px 28px 28px;
}

.agx-full {
  grid-column: 1 / -1;
}

.agx-field {
  display: grid;
  gap: 7px;
}

.agx-field label {
  color: var(--ag-dark-950, #111315);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.agx-field input,
.agx-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ag-dark-950, #111315);
  background: #ffffff;
  border: 1px solid rgba(17, 19, 21, 0.13);
  border-radius: 9px;
  outline: 0;
  font-size: 14px;
  font-weight: 800;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.agx-field textarea {
  min-height: 92px;
  padding-top: 12px;
  resize: vertical;
}

.agx-field input:focus,
.agx-field textarea:focus {
  border-color: rgba(227, 27, 35, 0.52);
  box-shadow: 0 0 0 4px rgba(227, 27, 35, 0.1);
}

.agx-notice {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  color: rgba(17, 19, 21, 0.72);
  background: rgba(227, 27, 35, 0.07);
  border: 1px solid rgba(227, 27, 35, 0.16);
  border-left: 4px solid var(--ag-red-500, #e31b23);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 750;
}

.agx-notice i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--ag-white, #ffffff);
  background: var(--ag-red-600, #c9161d);
  border-radius: 8px;
}

#checkoutModal .agx-notice {
  margin: 20px 28px 0;
}

.agx-form-submit {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--ag-white, #ffffff);
  background: linear-gradient(135deg, var(--ag-red-700, #a90f16), var(--ag-red-500, #e31b23));
  border: 1px solid rgba(227, 27, 35, 0.55);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(227, 27, 35, 0.26);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease;
}

.agx-form-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 42px rgba(227, 27, 35, 0.34);
}

@media (max-width: 680px) {
  .agx-modal {
    padding: 0;
    place-items: stretch;
  }

  .agx-modal-box {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }

  .agx-modal-head {
    min-height: auto;
    padding: 18px 18px 16px;
    align-items: flex-start;
  }

  .agx-modal-kicker {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .agx-modal-head h2 {
    max-width: 250px;
    font-size: 30px;
    line-height: 0.95;
  }

  .agx-modal-head p {
    max-width: 260px;
    margin-top: 7px;
    font-size: 12.5px;
    line-height: 1.35;
  }

  .agx-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .agx-auth-tabs {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px 16px 0;
  }

  .agx-auth-tab {
    min-height: 42px;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1.15;
  }

  .agx-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 16px 16px;
    align-content: start;
    overflow-y: auto;
  }

  .agx-field {
    gap: 5px;
  }

  .agx-field label {
    font-size: 10.5px;
  }

  .agx-field input,
  .agx-field textarea {
    min-height: 40px;
    padding: 0 11px;
    font-size: 13px;
    border-radius: 8px;
  }

  .agx-field textarea {
    min-height: 58px;
    padding-top: 9px;
  }

  .agx-notice {
    grid-template-columns: 30px 1fr;
    gap: 9px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.3;
    border-radius: 9px;
  }

  .agx-notice i {
    width: 30px;
    height: 30px;
  }

  .agx-form-submit {
    min-height: 42px;
    font-size: 13px;
    border-radius: 8px;
  }

  #checkoutModal .agx-notice {
    margin: 14px 16px 0;
  }

  #checkoutModal .agx-modal-box {
    grid-template-rows: auto auto minmax(0, 1fr);
  }
}

@media (max-width: 380px) {
  .agx-modal-head {
    padding: 15px 14px 13px;
  }

  .agx-modal-head h2 {
    font-size: 27px;
  }

  .agx-modal-head p {
    font-size: 12px;
  }

  .agx-auth-tabs,
  .agx-form-grid {
    padding-left: 12px;
    padding-right: 12px;
  }

  #checkoutModal .agx-notice {
    margin-left: 12px;
    margin-right: 12px;
  }

  .agx-form-grid {
    gap: 8px;
  }

  .agx-field input,
  .agx-field textarea {
    min-height: 38px;
  }

  .agx-form-submit {
    min-height: 40px;
  }
}

@media (max-height: 700px) and (max-width: 680px) {
  .agx-modal-head {
    padding-top: 12px;
    padding-bottom: 11px;
  }

  .agx-modal-head h2 {
    font-size: 25px;
  }

  .agx-modal-head p {
    display: none;
  }

  .agx-auth-tabs {
    padding-top: 10px;
  }

  .agx-auth-tab {
    min-height: 38px;
  }

  .agx-form-grid {
    padding-top: 10px;
    gap: 8px;
  }

  .agx-field input,
  .agx-field textarea {
    min-height: 36px;
  }

  .agx-field textarea {
    min-height: 48px;
  }

  .agx-form-submit {
    min-height: 38px;
  }

  .agx-notice {
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agx-modal-backdrop,
  .agx-modal-box,
  .agx-auth-tab,
  .agx-field input,
  .agx-field textarea,
  .agx-form-submit,
  .agx-icon-btn {
    transition: none !important;
  }
}