/* ============================================================
   notepad.css — Encrypted Notepad styles
   Inherits: Roboto Mono font, #00aa00 accent from style.css
   ============================================================ */

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

:root {
  --green:      #00aa00;
  --green-dim:  #007700;
  --green-glow: rgba(0, 170, 0, 0.25);
  --bg:         #000;
  --bg-panel:   #0d0d0d;
  --bg-input:   #0a0a0a;
  --border:     #00aa00;
  --text:       #00aa00;
  --text-dim:   #ccc;
  --text-muted: #555;
  --error:      #cc0000;
  --error-glow: rgba(204, 0, 0, 0.25);
  --font:       'Roboto Mono', monospace;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
}

/* ---------- Canvas spider-web background ---------- */
#notepad-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  /* Must be negative so the canvas never renders above any UI element */
  z-index: -1;
  pointer-events: none;
}

/* ---------- Site logo (top-left, matches index.html) ---------- */
.site-logo {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
  display: block;
}
.site-logo img {
  width: 40px;
  height: 40px;
  display: block;
  transition: opacity 0.2s ease;
}
.site-logo:hover img { opacity: 0.8; }

/* ---------- Page wrapper (sits above canvas) ---------- */
#app {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   LOCK SCREEN
   ============================================================ */
#lock-screen {
  width: 100%;
  max-width: 460px;
  padding: 20px;
  animation: fadeSlideIn 0.5s ease forwards;
}

/* Terminal prompt heading */
.lock-title {
  color: var(--green);
  font-size: 22px;
  letter-spacing: -1px;
  margin-bottom: 6px;
}
.lock-title .cursor {
  font-weight: 700;
  animation: 1s blink step-end infinite;
}

.lock-subtitle {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 28px;
  opacity: 0.7;
}

/* Form fields */
.lock-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.lock-field label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.lock-field input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--green);
  font-family: var(--font);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
  width: 100%;
  caret-color: var(--green);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lock-field input::placeholder {
  color: var(--text-muted);
}
.lock-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

/* Password strength bar */
.strength-bar-wrap {
  height: 3px;
  background: #1a1a1a;
  margin-top: 6px;
  overflow: hidden;
}
.strength-bar {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.strength-label {
  font-size: 10px;
  margin-top: 4px;
  height: 14px;
  transition: color 0.3s;
}

/* Buttons */
.lock-btn {
  display: inline-block;
  width: 100%;
  padding: 11px 0;
  background: transparent;
  border: 1px solid var(--green);
  color: var(--green);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  margin-top: 4px;
}
.lock-btn:hover {
  background: var(--green);
  color: #000;
  box-shadow: 0 0 12px var(--green-glow);
}
.lock-btn:active {
  opacity: 0.85;
}

/* Error message */
.lock-error {
  color: var(--error);
  font-size: 12px;
  min-height: 18px;
  margin-top: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}
.lock-error.visible {
  opacity: 1;
}

/* Disclaimer */
.lock-disclaimer {
  margin-top: 24px;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid #1a1a1a;
  padding-top: 14px;
  line-height: 1.5;
}
.lock-disclaimer span {
  color: #333;
  font-size: 11px;
}
.lock-disclaimer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Shake animation for wrong password */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-8px); }
  30%       { transform: translateX(8px); }
  45%       { transform: translateX(-6px); }
  60%       { transform: translateX(6px); }
  75%       { transform: translateX(-3px); }
  90%       { transform: translateX(3px); }
}
.shake {
  animation: shake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

/* ============================================================
   NOTEPAD EDITOR
   ============================================================ */
#notepad-screen {
  width: 100%;
  max-width: 820px;
  height: 100vh;
  padding: 20px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Top toolbar */
.notepad-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  gap: 12px;
}

/* Status group: save-status + sync-status side by side */
.toolbar-status-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

/* Toolbar button group: sync toggle + lock */
.toolbar-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Generic small toolbar button (same shape as lock-now-btn) */
.toolbar-btn {
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--green-dim);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 5px 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.toolbar-btn:hover {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

.notepad-title {
  font-size: 17px;
  color: var(--green);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.notepad-title .cursor {
  font-weight: 700;
  animation: 1s blink step-end infinite;
}

/* Status badge (saved / saving…) */
.save-status {
  font-size: 11px;
  color: var(--text-muted);
  transition: color 0.3s, opacity 0.3s;
  opacity: 0;
  min-width: 80px;
  text-align: center;
}
.save-status.visible {
  opacity: 1;
}
.save-status.saving {
  color: var(--text-muted);
}
.save-status.saved {
  color: var(--green);
}

/* Lock button in toolbar */
.lock-now-btn {
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--green-dim);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 5px 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.lock-now-btn:hover {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

/* Word / char stats bar */
.notepad-stats {
  font-size: 10px;
  color: var(--text-muted);
  padding: 7px 0 8px;
  border-bottom: 1px solid #111;
  display: flex;
  gap: 20px;
  flex-shrink: 0;
}

/* The textarea */
#note-content {
  flex: 1;
  /* Explicit dark background — never transparent so the canvas cannot bleed through */
  background: var(--bg-input);
  border: none;
  outline: none;
  resize: none;
  /* Explicit green text per design spec */
  color: var(--green);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.75;
  padding: 16px 0;
  caret-color: var(--green);
  /* Subtle left-side scanline feel */
  border-left: 2px solid #111;
  padding-left: 14px;
  transition: border-color 0.3s;
  /* Ensure this element always renders above the canvas */
  position: relative;
  z-index: 1;
}
#note-content:focus {
  border-left-color: var(--green-dim);
}
#note-content::selection {
  background: rgba(0, 170, 0, 0.2);
}

/* Scrollbar */
#note-content::-webkit-scrollbar {
  width: 4px;
}
#note-content::-webkit-scrollbar-track {
  background: #0a0a0a;
}
#note-content::-webkit-scrollbar-thumb {
  background: #1a3d1a;
  border-radius: 2px;
}
#note-content::-webkit-scrollbar-thumb:hover {
  background: var(--green-dim);
}

/* Bottom status bar */
.notepad-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #111;
  flex-shrink: 0;
}
.notepad-disclaimer {
  font-size: 10px;
  color: var(--text-muted);
}
.notepad-time {
  font-size: 10px;
  color: var(--text-muted);
}

/* ============================================================
   SHARED ANIMATIONS
   ============================================================ */

/* Blinking cursor (matches index.html) */
@keyframes blink {
  from, to { color: transparent; }
  50%       { color: var(--green); }
}

/* Page fade-in */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Typewriter line reveal (used when notepad unlocks) */
@keyframes typeReveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Editor entrance: staggered children */
.notepad-screen-enter > * {
  opacity: 0;
  animation: typeReveal 0.35s ease forwards;
}
.notepad-screen-enter > *:nth-child(1) { animation-delay: 0.05s; }
.notepad-screen-enter > *:nth-child(2) { animation-delay: 0.12s; }
.notepad-screen-enter > *:nth-child(3) { animation-delay: 0.19s; }
.notepad-screen-enter > *:nth-child(4) { animation-delay: 0.26s; }
.notepad-screen-enter > *:nth-child(5) { animation-delay: 0.33s; }

/* "[ SAVED ]" flash */
@keyframes savedFlash {
  0%   { opacity: 0; transform: scale(0.92); }
  20%  { opacity: 1; transform: scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}
.save-status.flash {
  animation: savedFlash 1.8s ease forwards;
}

/* ============================================================
   SYNC STATUS BADGE (toolbar)
   ============================================================ */
.sync-status {
  font-size: 11px;
  font-family: var(--font);
  transition: color 0.3s, opacity 0.3s;
  letter-spacing: 0.5px;
  white-space: nowrap;
  cursor: default;
}
.sync-status:empty {
  display: none;
}
.sync-synced {
  color: var(--green);
}
.sync-syncing {
  color: #aaaa00;
  animation: syncPulse 1.2s ease-in-out infinite;
}
.sync-failed {
  color: var(--error);
}

@keyframes syncPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ============================================================
   SYNC SETTINGS PANEL
   ============================================================ */
.sync-panel {
  /* Sits between toolbar and stats bar, full width of the editor */
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  background: var(--bg-panel);
  overflow: hidden;
  /* Slide-down entrance */
  animation: syncPanelSlide 0.2s ease forwards;
}

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

.sync-panel-inner {
  padding: 16px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Panel header row */
.sync-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sync-panel-title {
  font-size: 11px;
  color: var(--green);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sync-panel-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}
.sync-panel-close:hover {
  color: var(--green);
}

/* Instruction text */
.sync-instructions {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  border-left: 2px solid #1a1a1a;
  padding-left: 10px;
}
.sync-instructions strong {
  color: var(--green-dim);
}
.sync-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-style: italic;
}

/* Action buttons row */
.sync-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-btn {
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--green-dim);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 7px 16px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.sync-btn:hover {
  background: var(--green);
  border-color: var(--green);
  color: #000;
  box-shadow: 0 0 10px var(--green-glow);
}
.sync-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Status / feedback text */
.sync-pat-status {
  font-size: 11px;
  min-height: 16px;
  transition: color 0.2s;
}
.sync-pat-ok {
  color: var(--green);
}
.sync-pat-error {
  color: var(--error);
}

/* Last-synced timestamp row */
.sync-last-ts {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.sync-gist-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

#sync-last-ts-display {
  color: var(--text-muted);
}

/* ============================================================
   FETCHING VIEW — auto-restore in progress
   ============================================================ */

/* Subtle pulse on the subtitle text while the fetch runs */
#fetching-status {
  animation: fetchPulse 1.4s ease-in-out infinite;
}

@keyframes fetchPulse {
  0%, 100% { opacity: 0.9; }
  50%       { opacity: 0.45; }
}

/* ============================================================
   LANDING VIEW — "initialize new vault" menu
   ============================================================ */

/* Small note shown when SYNC constants are not configured */
.landing-sync-note {
  font-size: 10px;
  color: #333;
  margin-top: 14px;
  letter-spacing: 0.3px;
}

/* Two-option vertical menu */
.landing-options {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 8px;
}

/* Each option is a full-width button that looks like a menu item */
.landing-option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  padding: 16px 18px;
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--green);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  /* Stack borders flush — no double border between items */
  margin-top: -1px;
}
.landing-option-btn:first-child {
  margin-top: 0;
}
.landing-option-btn:hover {
  background: rgba(0, 170, 0, 0.07);
  border-color: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
  z-index: 1; /* keep hover border above sibling */
  position: relative;
}
.landing-option-btn:active {
  opacity: 0.8;
}

/* The bracketed command text */
.landing-option-label {
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--green);
}

/* The secondary description line */
.landing-option-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 300;
}


/* ============================================================
   UTILITY / HIDDEN
   ============================================================ */
.hidden { display: none !important; }
