/* ── rusNAS Login Page — Public Documentation Portal ─────────────────────
   rusnas.su/docs/login — форма ввода серийного номера
   Тёмная тема, оранжевый акцент, system-font stack (no external CDN)
   ───────────────────────────────────────────────────────────────────────── */

/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── CSS Variables ────────────────────────────────────────────────────── */
:root {
  --bg:          #0f1115;
  --card-bg:     #1a1d24;
  --border:      rgba(255, 255, 255, 0.08);
  --border-focus: #ff7a00;
  --text:        #e5e7eb;
  --text-muted:  #9ca3af;
  --accent:      #ff7a00;
  --accent-hover:#e56e00;
  --accent-text: #ffffff;
  --error:       #ef4444;
  --error-bg:    rgba(239, 68, 68, 0.10);
  --input-bg:    #0f1115;
  --input-text:  #e5e7eb;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Ubuntu',
          'Helvetica Neue', Arial, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
}

/* ── Body / Layout ────────────────────────────────────────────────────── */
html, body {
  height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* subtle grid pattern overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,122,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,122,0,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── Main wrapper ─────────────────────────────────────────────────────── */
.login-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 0 0 1px rgba(255,122,0,0.06),
    0 8px 32px rgba(0,0,0,0.5);
}

/* ── Logo / Header ────────────────────────────────────────────────────── */
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.login-logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-logo-text span {
  color: var(--accent);
}

/* ── Title ────────────────────────────────────────────────────────────── */
.login-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

/* ── Form ─────────────────────────────────────────────────────────────── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--input-text);
  font-family: var(--font);
  /* 16px prevents iOS auto-zoom on focus */
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  /* uppercase from JS, but also for native browser autofill */
  text-transform: uppercase;
}

.form-input::placeholder {
  color: rgba(156, 163, 175, 0.45);
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
  font-weight: 400;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.15);
}

.form-input:invalid:not(:placeholder-shown) {
  border-color: var(--error);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Error message ────────────────────────────────────────────────────── */
.login-error {
  display: none;
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  text-align: center;
}

.login-error.visible {
  display: block;
}

/* ── Submit button ────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--accent-text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 13px 20px;
  width: 100%;
  transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
  -webkit-appearance: none;
  appearance: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading spinner inside button */
.btn-primary.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Divider ──────────────────────────────────────────────────────────── */
.login-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0 20px;
}

/* ── Help link ────────────────────────────────────────────────────────── */
.login-help {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.login-help a {
  color: var(--accent);
  text-decoration: none;
}

.login-help a:hover {
  text-decoration: underline;
}

/* ── Footer ───────────────────────────────────────────────────────────── */
footer.login-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px 16px 24px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.login-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.login-footer a:hover {
  color: var(--text);
}

.login-footer .sep {
  opacity: 0.3;
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .login-card {
    padding: 28px 20px 24px;
  }

  .login-logo-text {
    font-size: 20px;
  }

  .login-title {
    font-size: 18px;
  }

  .btn-primary {
    font-size: 16px;
    padding: 14px 20px;
  }
}
