/* ==========================================================
   AI Server · Вход — Стили страницы авторизации
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f2f2f7; --surface: #ffffff; --text: #1c1c1e; --text2: #48484a;
  --dim: #8e8e93; --border: #e5e5ea;
  --accent: #007aff; --red: #ff3b30; --green: #34c759;
  --radius: 16px; --radius-sm: 8px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Обёртка ── */
.login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}

/* ── Карточка ── */
.login-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 4px 32px rgba(0,0,0,0.10);
  padding: 48px 40px; width: 100%; max-width: 400px;
}

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #007aff, #5ac8fa);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  font-size: 24px; color: #fff;
  box-shadow: 0 4px 16px rgba(0,122,255,0.3);
}

.login-title {
  font-size: 22px; font-weight: 700; color: var(--text);
  text-align: center; margin: 0 0 6px;
}
.login-subtitle {
  font-size: 13px; color: var(--dim); text-align: center;
  margin: 0 0 32px; line-height: 1.5;
}

/* ── Поля ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text2); margin-bottom: 6px;
}
.field-inner { display: flex; gap: 6px; }
.form-group input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #d1d1d6; border-radius: 10px;
  font-size: 15px; color: var(--text); background: #fff;
  outline: none; transition: border-color .15s; font-family: inherit;
}
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}
.form-group input[type="password"] { font-family: 'SF Mono', 'Fira Code', monospace; }

.btn-eye {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--dim); cursor: pointer; padding: 0 13px; font-size: 15px;
  flex-shrink: 0; transition: background .15s;
}
.btn-eye:hover { background: var(--border); }

/* ── Сохранённые данные ── */
.saved-creds {
  display: none; background: #e8f5e9; border: 1px solid #c8e6c9;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 16px;
}
.saved-creds.visible { display: block; }
.saved-creds-title {
  font-size: 12px; font-weight: 600; color: #2e7d32;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.saved-creds-info {
  font-size: 13px; color: #1b5e20; margin-bottom: 10px;
  font-family: 'SF Mono', monospace;
}
.saved-creds-actions { display: flex; gap: 8px; }
.saved-btn {
  padding: 6px 14px; border-radius: 8px; font-size: 12px;
  font-weight: 600; cursor: pointer; border: none; transition: opacity .15s;
}
.saved-btn:hover { opacity: .85; }
.saved-btn-use { background: var(--green); color: #fff; }
.saved-btn-del { background: #ffcdd2; color: #c62828; }

/* ── Ошибки ── */
.error-msg {
  display: none; background: #fff2f2; border: 1px solid #ffcdd2;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
  color: #c62828; margin-bottom: 16px; text-align: center;
}
.error-msg.visible { display: block; }

/* ── Кнопка входа ── */
.login-btn {
  width: 100%; padding: 13px; background: var(--accent);
  color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  margin-top: 8px; transition: background .15s, transform .1s;
  font-family: inherit;
}
.login-btn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.login-btn:active:not(:disabled) { transform: translateY(0); }
.login-btn:disabled { opacity: .4; cursor: not-allowed; }
.login-btn.loading::after {
  content: ''; display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
  margin-left: 10px; vertical-align: middle;
}

/* ── Чекбокс запомнить ── */
.save-check {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; font-size: 13px; color: var(--dim);
}
.save-check input { width: auto; }
.save-check label { cursor: pointer; }

footer {
  text-align: center; padding: 20px;
  font-size: 12px; color: var(--dim);
}

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