/* ===================================================
   SafePass SA — styles.css
   Beginner-friendly: every section is clearly labelled
   =================================================== */

/* ---------- 1. GOOGLE FONT IMPORT ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ---------- 2. CSS VARIABLES (theme colours) ---------- */
:root {
  /* Dark theme (default) */
  --bg:          #0f1117;
  --bg-card:     #1a1d27;
  --bg-input:    #232736;
  --border:      rgba(255,255,255,0.08);
  --text:        #e8eaf0;
  --text-muted:  #8b90a0;
  --text-label:  #c0c5d5;
  --accent:      #f97316;   /* orange */
  --accent-dim:  rgba(249,115,22,0.15);
  --radius:      14px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);

  /* Strength colours */
  --weak:        #ef4444;
  --medium:      #f59e0b;
  --strong:      #22c55e;

  /* Transitions */
  --speed:       0.25s;
}

/* Light theme overrides */
body.light {
  --bg:          #f3f4f8;
  --bg-card:     #ffffff;
  --bg-input:    #eef0f6;
  --border:      rgba(0,0,0,0.08);
  --text:        #111827;
  --text-muted:  #6b7280;
  --text-label:  #374151;
  --shadow:      0 4px 24px rgba(0,0,0,0.08);
  --accent-dim:  rgba(249,115,22,0.10);
}

/* ---------- 3. RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--speed), color var(--speed);
}

/* ---------- 4. HEADER ---------- */
header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon { font-size: 28px; }

.logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

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

.tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Theme toggle button */
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--speed), transform 0.15s;
}
.theme-toggle:hover { background: var(--accent-dim); transform: rotate(20deg); }

/* ---------- 5. MAIN LAYOUT ---------- */
main {
  flex: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
}

/* Stack to single column on smaller screens */
@media (max-width: 640px) {
  main { grid-template-columns: 1fr; padding: 20px 16px; gap: 16px; }
}

/* ---------- 6. CARD ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: background var(--speed);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-label);
}

/* ---------- 7. PASSWORD INPUT ROW ---------- */
.input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color var(--speed);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
}

#passwordInput {
  flex: 1;
  padding: 12px 14px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

#passwordInput::placeholder { color: var(--text-muted); font-family: 'Inter', sans-serif; }

.show-btn {
  background: none;
  border: none;
  padding: 0 14px;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.show-btn:hover { opacity: 1; }

.char-count {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* ---------- 8. STRENGTH METER ---------- */
.meter-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meter-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}

/* The animated fill */
.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--weak);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s;
}

.strength-label {
  font-size: 13px;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
  color: var(--text-muted);
  transition: color var(--speed);
}

/* ---------- 9. FEEDBACK LIST ---------- */
.feedback-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.feedback-list li {
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.tip-placeholder { color: var(--text-muted); font-style: italic; }

/* "good" tips = green tick, "bad" tips = red cross */
.tip-good { color: var(--strong); }
.tip-bad  { color: var(--weak);   }
.tip-warn { color: var(--medium); }

/* ---------- 10. GENERATOR OPTIONS ---------- */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.full-width { grid-column: 1 / -1; }

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.option-row label {
  font-size: 13px;
  color: var(--text-label);
  white-space: nowrap;
}

/* Range slider */
input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

/* Custom checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-label);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.custom-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.checkbox-label input:checked + .custom-check {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input:checked + .custom-check::after {
  content: '✓';
  color: white;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- 11. GENERATE BUTTON ---------- */
.btn-generate {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.3px;
}
.btn-generate:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-generate:active { transform: translateY(0); }

/* ---------- 12. OUTPUT BOX ---------- */
.output-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: fadeSlide 0.3s ease;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

#generatedPw {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--strong);
  word-break: break-all;
  flex: 1;
}

.copy-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.copy-btn:hover { background: var(--accent); color: white; }

.copy-feedback {
  font-size: 12px;
  color: var(--strong);
  min-height: 18px;
  text-align: center;
  transition: opacity 0.3s;
}

/* ---------- 13. HISTORY ---------- */
.history-wrap {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  animation: fadeSlide 0.3s ease;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--weak);
  font-size: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.clear-btn:hover { text-decoration: underline; }

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.history-list li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 6px 10px;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 14. FOOTER ---------- */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 24px 20px;
  transition: background var(--speed);
}

.footer-tips {
  max-width: 780px;
  margin: 0 auto 12px;
}

.footer-tips p {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-label);
  margin-bottom: 8px;
}

.footer-tips ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.footer-tips li {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 4px;
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  line-height: 1.5;
}

.footer-credit {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- 15. SCROLLBAR (subtle) ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
