/* PassGen – minimal, used-only CSS */

:root {
  --app-max-width: 1400px;

  /* Colors */
  --page-bg: radial-gradient(circle at 15% 15%, #fff 0%, #f4f6fb 46%, #e2e8f0 85%);
  --surface: #fff;
  --surface-muted: #f8fafc;
  --border-soft: rgba(15, 23, 42, 0.06);
  --border-subtle: rgba(15, 23, 42, 0.025);
  --border-faint: rgba(15, 23, 42, 0.02);
  --primary: #2563eb;
  --text: #0f172a;
  --text-muted: #64748b;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Effects */
  --radius-lg: 22px;
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.07);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.11);

  /* Buttons */
  --copy-btn-bg: #eef2ff;
  --copy-btn-bg-hover: #b2c7f9;
}

/* Base */
*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 1.7rem;
  font-family: var(--font-sans);
  background: var(--page-bg);
  color: var(--text);
}

code { font-family: var(--font-mono); font-size: 0.6rem; }

/* Accessibility helpers */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Shared width */
.app-warning,
.topbar,
.container,
footer,
.footer-notice {
  width: min(var(--app-max-width), 96vw);
  margin: 0 auto;
}

/* Topbar */
.topbar {
  margin: 1.35rem auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.topbar-title { display: flex; gap: 0.65rem; align-items: center; }
.topbar h1 { margin: 0; font-size: clamp(1.3rem, 3.3vw, 1.7rem); }
.topbar small { color: var(--text-muted); font-size: 0.68rem; }
.topbar-nav { display: flex; gap: 0.4rem; }
.topbar-link {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.28rem 0.7rem 0.33rem;
  font-size: 0.68rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s, border 0.1s, box-shadow 0.1s;
}
.topbar-link:hover { background: rgba(255, 255, 255, 0.3); }
.topbar-link.is-active {
  border-color: rgba(15, 23, 42, 0.05);
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

/* Notices / Footer */
.app-warning {
  margin-top: 0.7rem;
  padding: 0.4rem 0.65rem 0.45rem;
  background: #fff5f5;
  border: 1px solid #ffe4e6;
  border-radius: 14px;
  color: #b91c1c;
  font-size: 0.63rem;
  line-height: 1.4;
  text-align: center;
}
.footer-notice { margin-top: 1rem; text-align: center; }
footer { margin-top: 1.15rem; font-size: 0.7rem; color: var(--text-muted); }

/* App Shell */
.container {
  position: relative;
  margin-top: 0.5rem;
  padding: 1.3rem clamp(1rem, 2.1vw, 1.6rem) 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.page-desc { margin: 0 0 1.1rem; font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* Fields */
.field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.85rem 0.9rem;
  background: var(--surface-muted);
  border: 1px solid var(--border-faint);
  border-radius: 16px;
}
.field label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.78rem;
}
.inline-label { cursor: pointer; user-select: none; }
.inline-label input { margin: 0 0.35rem 0 0; }
.field small { color: var(--text-muted); line-height: 1.4; }
.field-body { position: relative; display: flex; flex-direction: column; }

textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.65rem 0.6rem;
  font-size: 0.92rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  outline: none;
  transition: border 0.12s, box-shadow 0.12s, background 0.12s;
}
input[type="text"] { padding-right: 4.2rem; }
textarea {
  min-height: 120px;
  max-height: 240px;
  resize: vertical;
  font-family: var(--font-mono);
}
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  border-color: rgba(37, 99, 235, 0.85);
  box-shadow: var(--focus-ring);
  background: #fff;
}

/* Password output uses Verdana for readability */
.password-output {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  letter-spacing: 0.03em;
}

/* Buttons */
.buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  align-items: center;
}
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.52rem 1.2rem 0.58rem;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
  transition: transform 0.085s, box-shadow 0.085s, background 0.1s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(37, 99, 235, 0.25); }
.btn.secondary {
  background: var(--copy-btn-bg);
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: none;
}
.btn.secondary:hover {
  background: var(--copy-btn-bg-hover);
  transform: translateY(-1px);
  box-shadow: none;
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.7rem;
  background: var(--copy-btn-bg);
  color: var(--text);
  font-size: 0.7rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
}
.copy-btn:hover { background: var(--copy-btn-bg-hover); transform: translateY(-1px); }

/* Doc text (used in descriptions / status) */
.doc-text {
  margin: 0.1rem 0 0.2rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.doc-text.ok { color: #047857; }
.doc-text.bad { color: #b91c1c; }

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 280px;
  padding: 0.5rem 0.85rem 0.45rem;
  background: #fff;
  color: var(--text);
  font-size: 0.72rem;
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 14px;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.1);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.22s, opacity 0.22s;
  z-index: 200;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.1rem;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(2px);
  z-index: 400;
}
.modal {
  width: min(430px, 100%);
  padding: 1rem 1rem 0.6rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}
.modal h3 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.modal p { margin: 0 0 0.8rem; font-size: 0.76rem; color: var(--text-muted); }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.4rem; margin-bottom: 0.35rem; }
.modal.success { border-color: rgba(16, 185, 129, 0.25); }

/* Loading Overlay */
#loadingOverlay {
  position: absolute;
  inset: 0;
  display: none;
  gap: 0.65rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(243, 244, 246, 0.85);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(1px);
  z-index: 20;
}
.loading-text { font-size: 0.78rem; color: var(--text); opacity: 0.8; }
.spinner {
  width: 46px;
  height: 46px;
  border: 3.5px solid rgba(37, 99, 235, 0.15);
  border-top-color: rgba(37, 99, 235, 1);
  border-radius: 999px;
  animation: spin 0.55s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Utilities */
.is-hidden { display: none !important; }

/* PassGen specific */
.pg-panel .grid {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}
#pgOutput + .copy-btn { top: 8px; right: 10px; }

/* Responsive */
@media (max-width: 950px) {
  .buttons-row { flex-direction: column; align-items: flex-start; }
  .btn { justify-content: center; }
  .topbar { flex-wrap: wrap; }
}
