@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@400;500&family=Figtree:wght@300;400;500;600;700&display=swap');

:root {
  --bg:       #0f1117;
  --surface:  #181c27;
  --surface2: #1f2536;
  --border:   #2a3045;
  --accent:   #e8c547;
  --accent2:  #4fc3f7;
  --accent3:  #f06a6a;
  --accent4:  #7ed3a6;
  --text:     #e8eaf0;
  --text2:    #8b93a8;
  --text3:    #555f7a;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Figtree', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ── Fondo con grid sutil ── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,197,71,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,197,71,.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Orbes decorativos */
.bg-grid::before,
.bg-grid::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.bg-grid::before {
  width: 400px; height: 400px;
  background: rgba(232,197,71,.06);
  top: -100px; right: -100px;
}
.bg-grid::after {
  width: 350px; height: 350px;
  background: rgba(79,195,247,.05);
  bottom: -80px; left: -80px;
}

/* ── Contenedor principal ── */
.login-wrap {
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
}

/* ── Marca ── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-icon {
  font-size: 28px;
  color: var(--accent);
  background: rgba(232,197,71,.1);
  border: 1px solid rgba(232,197,71,.2);
  border-radius: 12px;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.brand-title {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text);
  line-height: 1.2;
}
.brand-sub {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ── Tarjeta ── */
.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  color: var(--text);
}
.card-desc {
  font-size: 13px;
  color: var(--text2);
  margin-top: -10px;
}

/* ── Alerta ── */
.alert {
  display: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.alert.error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(240,106,106,.1);
  border: 1px solid rgba(240,106,106,.3);
  color: var(--accent3);
  animation: shake .3s ease;
}
.alert.success {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(126,211,166,.1);
  border: 1px solid rgba(126,211,166,.3);
  color: var(--accent4);
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* ── Form ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--text3);
  pointer-events: none;
  line-height: 1;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 11px 12px 11px 38px;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,197,71,.1);
}

input::placeholder { color: var(--text3); }

.toggle-pass {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--text3);
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}
.toggle-pass:hover { color: var(--text2); }

/* ── Row recordarme / link ── */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  user-select: none;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkmark {
  width: 16px; height: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.checkbox-label input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-label input:checked + .checkmark::after {
  content: '✓';
  font-size: 11px;
  color: #0f1117;
  font-weight: 700;
}

.link {
  font-size: 12px;
  color: var(--accent2);
  text-decoration: none;
  transition: opacity .15s;
}
.link:hover { opacity: .75; }
.link-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.link-disabled {
  color: var(--text3);
  cursor: not-allowed;
}

/* ── Botón principal ── */
.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #0f1117;
  border: none;
  border-radius: 9px;
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .1s;
  letter-spacing: .3px;
  margin-top: 2px;
}
.btn-login:hover  { background: #f0d060; }
.btn-login:active { transform: scale(.98); }
.btn-login:disabled { opacity: .5; cursor: not-allowed; }

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: #0f1117;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ── */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text3);
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Roles demo ── */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.role-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 6px;
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all .15s;
  font-family: 'Figtree', sans-serif;
}
.role-btn:hover {
  border-color: var(--accent);
  background: rgba(232,197,71,.06);
}
.role-icon { font-size: 18px; }
.role-label { font-size: 11px; color: var(--text2); font-weight: 600; }

/* ── Footer ── */
.footer-note {
  font-size: 11px;
  color: var(--text3);
  font-family: 'DM Mono', monospace;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  body { align-items: flex-start; overflow-y: auto; }
  .card { padding: 24px 20px; }
  .brand-title { font-size: 17px; }
}
