/* RESET */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: #000;
}

/* VARIABLES */
:root {
  --bg-gradient: linear-gradient(135deg, #111827, #1f2937, #0f766e);
  --card-bg: rgba(17, 24, 39, 0.95);
  --card-border: rgba(255,255,255,0.08);
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --error: #ef4444;
  --input-bg: rgba(15,23,42,0.9);
  --input-border: #1f2937;
  --input-focus: #0ea5e9;
  --radius-lg: 20px;
  --shadow-soft: 0 18px 50px rgba(0,0,0,0.75);
}

/* LAYOUT */
body {
  display: flex;
  justify-content: center;     /* CENTRADO HORIZONTAL */
  align-items: center;         /* CENTRADO VERTICAL   */
  background: var(--bg-gradient);
  padding: 20px 14px;
  font-family: system-ui, sans-serif;
  color: var(--text-main);
  overflow-x: hidden;
}

/* CARD PRINCIPAL */
.main-container {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  padding: 28px 26px 28px;
  box-shadow: var(--shadow-soft);
  position: relative;
  backdrop-filter: blur(14px);
}

/* CARD MÁS GRANDE (register + recuperar) */
.main-container--wide {
  max-width: 850px;
}

/* HEADER */
.header {
  text-align: center;
  margin-bottom: 22px;
}

.logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  margin-bottom: 10px;
}

.header h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* INPUTS */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

input, select {
  width: 100%;
  padding: 11px 12px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: .18s ease;
}

input:focus, select:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 1px rgba(14,165,233,.4);
}

/* BUTTONS */
.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  transition: .18s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 28px rgba(14,165,233,0.4);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 16px 32px rgba(14,165,233,0.55);
}

/* LINKS */
.text-center {
  text-align: center;
}

.small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.link {
  color: var(--accent);
  cursor: pointer;
  margin-left: 4px;
  transition: .18s;
}

.link:hover {
  color: #38bdf8;
}

/* GRID (Register) */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 850px) {
  .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 22px;
  }

  .full-width {
    grid-column: 1 / -1;
  }
}

/* TELÉFONO (Register + Recuperar) */
.telefono-group label {
  margin-bottom: 5px;
}

.telefono-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.telefono-row select {
  max-width: 120px;
}

.telefono-row input {
  flex: 1;
}

/* POPUPS (Recuperar) */
.popup-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  z-index: 99998;
}

.popup-box {
  background: #fff;
  padding: 25px;
  border-radius: 12px;
  width: 90%;
  max-width: 380px;
  text-align: center;
}

/* LOADER GLOBAL */
#loader-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 99999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  color: #fff;
  font-size: 1.1rem;
}

#loader-spinner {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 7px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loader-check {
  display: none;
  width: 90px;
  height: 90px;
  background: #28c76f;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  font-size: 60px;
  opacity: 0;
  transform: scale(0);
  transition: .4s ease;
}

#loader-check.visible {
  opacity: 1;
  transform: scale(1);
}

/* ===== FIX CHROME: registro demasiado largo ===== */
@media (max-width: 600px) {

  /* Para formularios largos (register + recuperar):
     NO centrar verticalmente */
  .main-container--wide {
    margin-top: 0 !important;
  }

  body {
    justify-content: flex-start !important;
    align-items: center !important;
    padding-top: 20px !important;
  }
}

/* ===============================
   LOADING SCREEN (loading.html)
================================*/

body.page-loading {
  overflow: hidden;
}

.loading-wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.loading-wrap h1 {
  font-size: 1.9rem;
  font-weight: 600;
  margin: 0;
}

.loading-wrap p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

/* SPINNER */
.loader-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.25);
  border-top-color: white;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* MOBILE OPTIMIZATION */
@media (max-width: 600px) {
  .loading-wrap h1 {
    font-size: 1.6rem;
  }
  .loading-wrap p {
    font-size: 0.9rem;
  }
}
