/* ../styles/styles.css
   MELU — Estilo único, compacto y visual para landing / login / register
*/

/* =========== Variables =========== */
:root{
  --bg: #f5f7fb;
  --card: #ffffff;
  --muted: #6b7280;
  --accent: #0f62fe;
  --accent-2: #0b83ff;
  --danger: #d0421b;
  --radius: 14px;
  --pad: 16px;
  --shadow: 0 10px 30px rgba(12,20,40,0.06);
  --text: #0b1220;
  --gap: 12px;
  --maxw: 420px;
  --transition: 180ms ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* =========== Reset base =========== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: url("../images/fondo.png")no-repeat left center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  line-height: 1.35;
}

/* Helpers */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 12px; }
.hidden { display: none !important; }

/* =========== Authentication layout =========== */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

/* Card (single source of truth) */
.card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 18px 40px rgba(2,6,23,0.08);
  border: 1px solid rgba(2,6,23,0.06);
  position: relative;
  text-align: left;
  color: var(--text);
  /* prevent overflowing the viewport */
  
  max-height: calc(100vh - 56px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* subtle top accent bar */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  width: 100%;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  background: linear-gradient(90deg, rgba(12,109,255,0.95), rgba(11,56,255,0.85));
  pointer-events: none;
  z-index: 0;
}

/* Avatar inside card */
.avatar {
  width: 56px;
  height: 56px;
  margin: 10px auto 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--card);
  background: linear-gradient(135deg, rgba(12,109,255,0.06), #ffffff);
  box-shadow: 0 8px 22px rgba(2,6,23,0.06);
  position: relative;
  z-index: 1;
}
.avatar img { width:100%; height:100%; object-fit:cover; border-radius:999px; display:block; }

/* Headings */
.card h1 {
  font-size: 1rem;
  margin: 6px 0 6px;
  font-weight: 700;
  text-align: center;
}
.card .lead {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 10px;
  text-align: center;
}

/* =========== Forms =========== */
.form { display:flex; flex-direction:column; gap:10px; margin-top:4px; }
.field { display:flex; flex-direction:column; gap:6px; }
.label-text { font-size:0.82rem; color:var(--muted); }

/* Grid for register (single column on mobile, two columns on desktop) */
.form-grid { display:flex; flex-direction:column; gap:12px; }
.grid-row { display:grid; grid-template-columns: 1fr; gap:10px; }
.grid-col { display:flex; flex-direction:column; gap:6px; }

/* Reduce vertical footprint of inputs */
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
  border: 1px solid rgba(2,6,23,0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(250,250,250,0.98));
  color: var(--text);
  outline: none;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  height: 40px;
}
input::placeholder { color: rgba(11,18,32,0.35); }
input:focus { border-color: var(--accent); box-shadow: 0 8px 20px rgba(15,98,254,0.06); transform: translateY(-1px); }

/* password row */
.password-row { display:flex; gap:8px; align-items:center; }
.btn-icon {
  padding:6px 8px;
  font-size:0.95rem;
  border-radius:8px;
  border:1px solid rgba(2,6,23,0.06);
  background: transparent;
  cursor:pointer;
  height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

/* small helper row */
.row-sublabel { display:flex; justify-content:space-between; gap:8px; align-items:center; margin-top:4px; }
.hint { color: var(--muted); font-size:0.78rem; }
.link { color: var(--accent); text-decoration:none; font-weight:600; font-size:0.88rem; }

/* Checkbox */
.checkbox-wrap { display:flex; align-items:center; gap:10px; }
.checkbox-wrap input[type="checkbox"]{ width:18px; height:18px; accent-color: var(--accent); }

/* Errors & spacing */
.error { color: var(--danger); font-size:0.82rem; min-height:1em; }

/* =========== Actions / Buttons =========== */
/* Mobile-first: primary full-width, ghost stacked; desktop: row */
.actions {
  display:flex;
  gap:8px;
  flex-direction:column;
  margin-top:8px;
}
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:9px 12px;
  border-radius:10px;
  font-weight:700;
  font-size:0.92rem;
  text-decoration:none;
  border: none;
  cursor: pointer;
  min-height:40px;
}
.btn.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 10px 28px rgba(12,109,255,0.10);
  width:100%;
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(2,6,23,0.06);
  width:100%;
}

/* Separator & footer */
.separator { display:flex; align-items:center; gap:12px; color:var(--muted); font-size:0.82rem; margin-top:10px; }
.separator::before, .separator::after { content:""; height:1px; flex:1; background: linear-gradient(90deg, rgba(2,6,23,0.02), rgba(2,6,23,0.04)); }
.footer-cta { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; color:var(--muted); font-size:0.84rem; }

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  background: #0b1220;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(2,6,23,0.18);
  font-weight:600;
  font-size:0.92rem;
  z-index: 99999;
}
#toast.hidden { display:none; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.45); display:flex; align-items:center; justify-content:center; padding:20px; z-index:1200; }
.modal-backdrop[hidden]{ display:none; visibility:hidden; pointer-events:none; }
.modal { width:100%; max-width:420px; background:var(--card); border-radius:12px; padding:14px; box-shadow:0 14px 40px rgba(12,20,40,0.18); border:1px solid rgba(12,20,40,0.04); position:relative; }
.modal .modal-close { position:absolute; top:10px; right:10px; width:36px; height:36px; border-radius:50%; border:none; background:transparent; font-size:18px; cursor:pointer; }

/* Scrollbar subtle inside card */
.card::-webkit-scrollbar { width:8px; height:8px; }
.card::-webkit-scrollbar-thumb { background: rgba(2,6,23,0.06); border-radius:8px; }
.card::-webkit-scrollbar-track { background: transparent; }

/* =========== Responsive adjustments =========== */
@media (min-width: 720px) {
  .container { max-width: 720px; }
  /* On desktop allow two-column grid for register */
  .grid-row { grid-template-columns: repeat(2, 1fr); gap:12px; }
  .form { gap:12px; }
  .actions { flex-direction:row; align-items:center; }
  .btn.primary { flex:1 1 auto; width:auto; }
  .btn.ghost { flex: 0 0 140px; width:auto; align-self:center; }
  .card { max-width:520px; padding:16px 18px; }
  .card h1, .card .lead { text-align:left; }
  .avatar { margin: 6px 0 12px; }
}

/* Ensure usable viewport on mobile keyboards */
@supports (height: 100dvh) {
  .page { min-height: 100dvh; }
}

/* small helpers */
.visually-hidden { position:absolute !important; height:1px; width:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; }
  
/* ====== Ajuste: inputs a ancho completo ====== */
.form .field input[type="text"],
.form .field input[type="email"],
.form .field input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  display: block;
}

/* La fila de contraseña con el botón 👁 */
.password-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.password-row input {
  flex: 1;              /* ocupa todo el espacio disponible */
  width: 100%;
}

.password-row .btn-icon {
  margin-left: 6px;
  flex-shrink: 0;
}

/* ====== Ajuste: botones mitad de ancho ====== */
.actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.actions .btn {
  flex: 1;            /* ambos ocupan el mismo ancho */
  text-align: center; /* centra el texto en el enlace */
}

/* ====== Nuevo estilo para el botón secundario ====== */
.btn.secondary {
  background: #f0f4fa;
  color: var(--accent);
  border: 1px solid rgba(2,6,23,0.08);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn.secondary:hover {
  background: #e8efff;
  box-shadow: 0 8px 20px rgba(15,98,254,0.08);
  color: #0847b3;
}


/* === Mover el login a la derecha === */
body {
  justify-content: flex-end; /* Mueve el contenido a la derecha */
}

.page {
  justify-content: flex-end; /* Asegura que el contenedor también esté a la derecha */
  padding-right: 5%; /* Margen de respiración con el borde derecho */
}
