/**
 * Login JS Market — ejecutivo moderno (claro / oscuro)
 */
@import url('jsm-tokens.css');

:root {
  --login-bg: #F9FAFB;
  --login-surface: #ffffff;
  --login-border: #E5E7EB;
  --login-text: #111827;
  --login-muted: #6B7280;
  --login-input-bg: #ffffff;
  --login-input-border: #E5E7EB;
  --login-card-shadow: 0 4px 24px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --login-glow: rgba(26, 123, 196, 0.15);
}

html[data-theme="dark"] {
  --login-bg: #0B1929;
  --login-surface: #112240;
  --login-border: #1A3A60;
  --login-text: #F0F7FF;
  --login-muted: #7AADD4;
  --login-input-bg: #1A3A60;
  --login-input-border: #234570;
  --login-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --login-glow: rgba(58, 173, 223, 0.2);
}

*, *::before, *::after {
  box-sizing: border-box;
}

.jsm-login-page {
  font-family: var(--fb-font);
  margin: 0;
  min-height: 100vh;
  background: var(--login-bg);
  color: var(--login-text);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.jsm-login-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

@media (min-width: 992px) {
  .jsm-login-shell {
    grid-template-columns: 1.05fr 1fr;
  }
}

/* Panel marca */
.jsm-login-brand {
  display: none;
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, #062848 0%, #0A4070 35%, #1A7BC4 70%, #3AADDF 100%);
  color: #fff;
}

@media (min-width: 992px) {
  .jsm-login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
  }
}

.jsm-login-brand-glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  top: 10%;
  right: -80px;
  pointer-events: none;
  animation: jsm-login-pulse 8s ease-in-out infinite;
}

@keyframes jsm-login-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.08); }
}

.jsm-login-brand-grid {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.jsm-login-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 24rem;
  text-align: center;
}

.jsm-login-brand-logo {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  object-fit: contain;
  background: #fff;
  padding: 6px;
  margin-bottom: 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.jsm-login-brand-name {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.jsm-login-brand-tag {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

/* Panel formulario */
.jsm-login-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.25rem 2rem;
  background: var(--login-bg);
  transition: background-color 0.25s ease;
}

.jsm-login-toolbar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

@media (min-width: 992px) {
  .jsm-login-toolbar {
    top: 1.25rem;
    right: 1.5rem;
  }
}

.jsm-login-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--login-muted);
  background: var(--login-surface);
  border: 1px solid var(--login-border);
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.jsm-login-theme-btn:hover {
  color: var(--fb-primary);
  border-color: var(--fb-primary);
  box-shadow: 0 0 0 3px var(--login-glow);
}

.jsm-login-theme-btn i {
  font-size: 0.9375rem;
}

.jsm-login-theme-label {
  display: none;
}

@media (min-width: 480px) {
  .jsm-login-theme-label {
    display: inline;
  }
}

.jsm-login-form-wrap {
  width: 100%;
  max-width: 440px;
  margin-top: 2.5rem;
}

@media (min-width: 992px) {
  .jsm-login-form-wrap {
    margin-top: 0;
  }
}

.jsm-login-card {
  position: relative;
  background: var(--login-surface);
  border: 1px solid var(--login-border);
  border-radius: 16px;
  box-shadow: var(--login-card-shadow);
  padding: 2rem 2rem 1.75rem;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.jsm-login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, transparent, var(--fb-primary), transparent);
  opacity: 0.85;
}

.jsm-login-card-head {
  margin-bottom: 1.75rem;
  text-align: center;
}

@media (min-width: 992px) {
  .jsm-login-card-head {
    text-align: left;
  }
}

.jsm-login-card-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

@media (min-width: 992px) {
  .jsm-login-card-logo-wrap {
    display: none;
  }
}

.jsm-login-card-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 4px 12px var(--login-glow);
}

.jsm-login-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  color: var(--login-text);
}

.jsm-login-subtitle {
  font-size: 0.9375rem;
  color: var(--login-muted);
  margin: 0;
  line-height: 1.5;
}

/* Campos con icono */
.jsm-login-field {
  margin-bottom: 1.25rem;
}

.jsm-login-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--login-muted);
  margin-bottom: 0.5rem;
}

.jsm-login-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.jsm-login-input-icon {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--login-muted);
  font-size: 0.9375rem;
  pointer-events: none;
  z-index: 1;
}

.jsm-login-input {
  width: 100%;
  min-height: 48px;
  padding: 0.625rem 0.875rem 0.625rem 2.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  border: 1px solid var(--login-input-border);
  border-radius: 10px;
  background: var(--login-input-bg);
  color: var(--login-text);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.jsm-login-input--password {
  padding-right: 2.75rem;
}

.jsm-login-input:focus {
  border-color: var(--fb-primary);
  box-shadow: 0 0 0 4px var(--login-glow);
  outline: none;
}

.jsm-login-input-group:focus-within .jsm-login-input-icon {
  color: var(--fb-primary);
}

.jsm-login-input::placeholder {
  color: var(--login-muted);
  opacity: 0.75;
}

.jsm-login-eye {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--login-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.jsm-login-eye:hover {
  color: var(--fb-primary);
  background: var(--login-glow);
}

.jsm-login-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.jsm-login-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--login-muted);
  cursor: pointer;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.jsm-login-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--fb-primary);
}

.jsm-login-forgot {
  color: var(--fb-primary);
  font-weight: 500;
  text-decoration: none;
  font-size: 0.875rem;
}

.jsm-login-forgot:hover {
  color: var(--fb-primary-hover);
  text-decoration: underline;
}

.jsm-login-submit {
  width: 100%;
  min-height: 48px;
  padding: 0 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(180deg, #1A8FCC 0%, #1A7BC4 50%, #0D5A99 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(26, 123, 196, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.jsm-login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 123, 196, 0.45);
}

.jsm-login-submit:active:not(:disabled) {
  transform: translateY(0);
}

.jsm-login-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.jsm-login-submit-arrow {
  font-size: 0.875rem;
  opacity: 0.9;
}

.jsm-login-error {
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #991B1B;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 10px;
}

html[data-theme="dark"] .jsm-login-error {
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.jsm-login-error.jsm-login-error--show {
  display: flex;
}

.jsm-login-footer-note {
  text-align: center;
  margin: 1.5rem 0 0;
  font-size: 0.875rem;
  color: var(--login-muted);
}

.jsm-login-footer-note a {
  color: var(--fb-primary);
  font-weight: 500;
  text-decoration: none;
}

.jsm-login-footer-note a:hover {
  text-decoration: underline;
}

.jsm-login-copyright {
  text-align: center;
  margin: 1.25rem 0 0;
  font-size: 0.75rem;
  color: var(--login-muted);
  opacity: 0.85;
}

.jsm-login-spin {
  display: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: jsm-login-spin 0.7s linear infinite;
}

@keyframes jsm-login-spin {
  to { transform: rotate(360deg); }
}

/* Compatibilidad body.dark-mode / light-mode */
body.dark-mode.jsm-login-page,
html[data-theme="dark"] .jsm-login-page {
  background: var(--login-bg);
  color: var(--login-text);
}

body.light-mode.jsm-login-page {
  background: var(--login-bg);
}

@media (max-width: 991px) {
  .jsm-login-main {
    padding-top: 3.5rem;
  }
}
