/* =========================
   RESET BÁSICO (seguro)
========================= */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --accent: #3b82f6;
  --bg: #ffffff;
  --text: #1f2937;
}

body.modal-open {
  overflow: hidden;
}

/* =========================
   MODAL CONTENEDOR
========================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  overflow: hidden; /* 🔥 evita ensanchamiento del documento */
}

.hidden {
  display: none;
}

/* =========================
   OVERLAY
========================= */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}

/* =========================
   CAJA DEL MODAL
========================= */
.modal-box {
  position: absolute;
  top: 85px;                 /* respeta header */
  left: -100%;               /* 🔥 NO usar translate */
  width: 50%;
  max-width: 100%;
  height: calc(100% - 85px); /* 🔥 NO 100vh */
  background: var(--bg);
  color: var(--text);
  /*border-radius: 0 14px 14px 0;*/
  box-shadow: 0 25px 60px rgba(0,0,0,.25);

  display: flex;
  flex-direction: column;

  transition: left .35s ease;
}

/* visible */
.modal.show .modal-box {
  left: 0;
}

/* =========================
   HEADER
========================= */
.modal-header {
  background: var(--accent);
  color: #fff;
  font-family: 'Roboto';
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.modal-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.modal-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

/* =========================
   CONTEXTO
========================= */
.modal-context {
  padding: 1rem 1.4rem;
  background: #f9fafb;
  font-family: 'Roboto';
  font-size: .95rem;
}

/* =========================
   FORMULARIO
========================= */
form {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  overflow: hidden;
}

/* campos */
.field {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 1.4rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: .9rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: 'Roboto';
  font-size: .95rem;
  background: #fff;
}

/* textarea flexible */
.field.textarea {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.field.textarea textarea {
  flex: 1;
  resize: none;
}

/* label flotante */
.field label {
  position: absolute;
  top: -.6rem;
  left: .7rem;
  background: #fff;
  padding: 0 .4rem;
  font-size: .75rem;
  font-family: 'Roboto';
  color: #6b7280;
}

/* botón */
.btn-submit {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .9rem;
  border-radius: 10px;
  font-family: 'Roboto';
  font-size: 1rem;
  cursor: pointer;
}

/* =========================
   FOOTER DEL MODAL
========================= */
.modal-footer {
  width: 100%;
  font-family: 'Roboto';
  padding: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: .85rem;
  color: #6b7280;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 520px) {
  .modal-box {
    width: 100%;
    border-radius: 0;
  }
}

@media (orientation: landscape) and (max-width: 900px) {
  .modal-box {
    top: 0;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }

  .modal-header {
    font-size: .75rem;
    padding: .1rem;
  }
  .modal-context {
    padding: 0.0625rem 0.19rem;
    font-size: .75rem;
  }
  .modal-footer {
    display:none;
  }

  form {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 1rem;
  }

  .field {
    margin-bottom: 0;
  }

  .field.textarea {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .btn-submit {
    grid-column: 1 / -1;
  }
}
