/* ===== style.css ===== */

/* ══════════════════════════════════════════
   CATPPUCCIN TOKENS
══════════════════════════════════════════ */
:root[data-theme="latte"] {
  --rosewater: #dc8a78;
  --flamingo:  #dd7878;
  --pink:      #ea76cb;
  --mauve:     #8839ef;
  --red:       #d20f39;
  --maroon:    #e64553;
  --peach:     #fe640b;
  --yellow:    #df8e1d;
  --green:     #40a02b;
  --teal:      #179299;
  --sky:       #04a5e5;
  --sapphire:  #209fb5;
  --blue:      #1e66f5;
  --lavender:  #7287fd;

  --text:      #4c4f69;
  --subtext1:  #5c5f77;
  --subtext0:  #6c6f85;
  --overlay2:  #7c7f93;
  --overlay1:  #8c8fa1;
  --overlay0:  #9ca0b0;
  --surface2:  #acb0be;
  --surface1:  #bcc0cc;
  --surface0:  #ccd0da;
  --base:      #eff1f5;
  --mantle:    #e6e9ef;
  --crust:     #dce0e8;

  --accent:    var(--pink);
  --accent2:   var(--mauve);
  --card-bg:   #ffffff;
  --input-bg:  #ffffff;
  --shadow:    rgba(76,79,105,0.08);
  --shadow-md: rgba(76,79,105,0.14);

  --login-grad-a: #f5c2e7;
  --login-grad-b: #cba6f7;
  --login-grad-c: #f38ba8;
}

:root[data-theme="mocha"] {
  --rosewater: #f5e0dc;
  --flamingo:  #f2cdcd;
  --pink:      #f5c2e7;
  --mauve:     #cba6f7;
  --red:       #f38ba8;
  --maroon:    #eba0ac;
  --peach:     #fab387;
  --yellow:    #f9e2af;
  --green:     #a6e3a1;
  --teal:      #94e2d5;
  --sky:       #89dceb;
  --sapphire:  #74c7ec;
  --blue:      #89b4fa;
  --lavender:  #b4befe;

  --text:      #cdd6f4;
  --subtext1:  #bac2de;
  --subtext0:  #a6adc8;
  --overlay2:  #9399b2;
  --overlay1:  #7f849c;
  --overlay0:  #6c7086;
  --surface2:  #585b70;
  --surface1:  #45475a;
  --surface0:  #313244;
  --base:      #1e1e2e;
  --mantle:    #181825;
  --crust:     #11111b;

  --accent:    var(--pink);
  --accent2:   var(--mauve);
  --card-bg:   #313244;
  --input-bg:  #45475a;
  --shadow:    rgba(0,0,0,0.25);
  --shadow-md: rgba(0,0,0,0.4);

  --login-grad-a: #313244;
  --login-grad-b: #1e1e2e;
  --login-grad-c: #11111b;
}

/* ══════════════════════════════════════════
   RESET + BASE
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Varela Round', sans-serif;
  font-weight: 400;
  background: var(--base);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ══════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  overflow: hidden;
  background: linear-gradient(135deg,
    var(--login-grad-a),
    var(--login-grad-b),
    var(--login-grad-c)
  );
}

/* animated blobs */
.login-bg-blobs { position: absolute; inset: 0; pointer-events: none; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: blobFloat 8s ease-in-out infinite alternate;
}
.blob-1 { width: 420px; height: 420px; background: var(--pink);    top: -80px;  left: -60px;  animation-delay: 0s; }
.blob-2 { width: 320px; height: 320px; background: var(--mauve);   bottom: -60px; right: -40px; animation-delay: -3s; }
.blob-3 { width: 260px; height: 260px; background: var(--rosewater); top: 40%;   left: 55%;   animation-delay: -5s; }

@keyframes blobFloat {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(30px, 20px) scale(1.08); }
}

.login-card {
  position: relative;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 28px;
  padding: 2.5rem 2.25rem 2rem;
  width: min(92vw, 400px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  animation: cardIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}

:root[data-theme="mocha"] .login-card {
  background: rgba(49,50,68,0.6);
  border-color: rgba(203,166,247,0.2);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-icon { font-size: 2.8rem; line-height: 1; margin-bottom: .5rem; animation: spinPetal 4s ease-in-out infinite; }
@keyframes spinPetal {
  0%,100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}

.login-title {
  font-family: 'Varela Round', 'Verdana', 'Helvetica', serif;
  font-size: 1.85rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.15);
  margin-bottom: .35rem;
}

:root[data-theme="mocha"] .login-title { color: var(--pink); }

.login-subtitle { font-size: .9rem; color: rgba(255,255,255,0.75); margin-bottom: 1.5rem; }
:root[data-theme="mocha"] .login-subtitle { color: var(--subtext1); }

.input-wrapper {
  position: relative;
  margin-bottom: 1rem;
}
.input-icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--pink); font-size: .9rem;
}
.password-input {
  width: 100%;
  padding: .75rem 1rem .75rem 2.75rem;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.35);
  color: #fff;
  font-family: inherit; font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.password-input::placeholder { color: rgba(255,255,255,0.6); }
.password-input:focus {
  border-color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.45);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.15);
}

:root[data-theme="mocha"] .password-input {
  background: rgba(49,50,68,0.7);
  border-color: var(--surface1);
  color: var(--text);
}
:root[data-theme="mocha"] .password-input::placeholder { color: var(--overlay1); }

.login-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .8rem 1.5rem;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--pink), var(--mauve));
  color: #fff;
  font-family: inherit; font-size: 1rem; font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(234,118,203,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(234,118,203,0.5); }
.login-btn:active { transform: translateY(0); }

.login-error {
  margin-top: .9rem;
  font-size: .88rem;
  color: #fff;
  background: rgba(243,139,168,0.4);
  border-radius: 10px;
  padding: .5rem .9rem;
  display: flex; align-items: center; gap: .4rem;
  justify-content: center;
  animation: shake 0.4s ease;
}
:root[data-theme="mocha"] .login-error { background: rgba(243,139,168,0.25); color: var(--red); }

@keyframes shake {
  0%,100%{ transform: translateX(0); }
  20%    { transform: translateX(-6px); }
  40%    { transform: translateX(6px); }
  60%    { transform: translateX(-4px); }
  80%    { transform: translateX(4px); }
}

/* ══════════════════════════════════════════
   APP HEADER
══════════════════════════════════════════ */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--card-bg);
  border-bottom: 1px solid var(--surface0);
  box-shadow: 0 2px 12px var(--shadow);
  transition: background 0.3s, border-color 0.3s;
}
.header-inner {
  max-width: 860px; margin: 0 auto;
  padding: .85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: .6rem; }
.brand-icon { font-size: 1.5rem; }
.brand-title {
  font-family: 'Varela Round', 'Verdana', 'Helvetica', serif;
  font-size: 1.45rem; font-weight: 600;
  background: linear-gradient(135deg, var(--pink), var(--mauve));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-actions { display: flex; align-items: center; gap: .5rem; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--surface0);
  background: transparent;
  color: var(--subtext0);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .95rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: var(--surface0); color: var(--accent); border-color: var(--accent); }

/* ── theme toggle ── */
.theme-toggle {
  background: transparent; border: none; cursor: pointer; padding: 0;
}
.toggle-track {
  display: block;
  width: 52px; height: 28px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--surface1), var(--surface0));
  border: 1px solid var(--surface0);
  position: relative;
  transition: background 0.3s;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--mauve));
  box-shadow: 0 2px 6px var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: #fff;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
[data-theme="mocha"] .toggle-thumb { transform: translateX(24px); }
.sun-icon  { display: block; }
.moon-icon { display: none; }
[data-theme="mocha"] .sun-icon  { display: none; }
[data-theme="mocha"] .moon-icon { display: block; }

/* ══════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════ */
.main-content {
  max-width: 860px; margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}

/* ── Intro ── */
.intro-section {
  background: linear-gradient(135deg, color-mix(in srgb, var(--pink) 12%, transparent), color-mix(in srgb, var(--mauve) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--pink) 25%, transparent);
  border-radius: 18px;
  padding: 1rem 1.4rem;
}
.intro-text { font-size: .97rem; color: var(--subtext1); font-style: italic; }

/* ── Form ── */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--surface0);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  transition: background 0.3s, border-color 0.3s;
}
.form-title {
  font-family: 'Varela Round', 'Verdana', 'Helvetica', serif;
  font-size: 1.1rem; font-weight: 600;
  color: var(--accent);
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1rem;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
}
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field-full { grid-column: 1/-1; }
.score-field { grid-column: 1/-1; }

.form-field label {
  font-size: .82rem; font-weight: 500;
  color: var(--subtext0); text-transform: uppercase; letter-spacing: .05em;
}
.form-field input,
.form-field textarea {
  width: 100%;
  padding: .65rem .9rem;
  border-radius: 12px;
  border: 1.5px solid var(--surface0);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit; font-size: .95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--overlay0); }

/* score slider */
.score-preview {
  display: inline-block;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--mauve));
  color: #fff;
  font-size: .82rem; font-weight: 600;
  text-align: center; line-height: 28px;
  margin-left: .4rem;
  vertical-align: middle;
  transition: background 0.3s;
}
.score-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--red), var(--yellow), var(--green));
  outline: none; border: none;
  padding: 0;
  cursor: pointer;
}
.score-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px var(--shadow-md);
  transition: border-color 0.2s;
}
.score-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px var(--shadow-md);
}
.score-labels {
  display: flex; justify-content: space-between;
  font-size: .78rem; color: var(--overlay1);
  margin-top: .2rem;
}

.form-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: .75rem;
  margin-top: 1.1rem;
}
.btn-primary {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem 1.4rem;
  border-radius: 12px; border: none;
  background: linear-gradient(135deg, var(--pink), var(--mauve));
  color: #fff;
  font-family: inherit; font-size: .95rem; font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(234,118,203,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 7px 20px rgba(234,118,203,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--surface0);
  background: transparent;
  color: var(--subtext0);
  font-family: inherit; font-size: .93rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { border-color: var(--maroon); color: var(--maroon); }

/* ── List ── */
.list-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: .75rem;
}
.list-title {
  font-family: 'Varela Round', 'Verdana', 'Helvetica', serif;
  font-size: 1.25rem; font-weight: 600;
  color: var(--text);
}
.entry-count {
  font-size: .82rem; color: var(--overlay1);
}

.wishlist {
  display: flex; flex-direction: column; gap: .75rem;
}

/* ── Entry Card ── */
.entry-card {
  background: var(--card-bg);
  border: 1px solid var(--surface0);
  border-radius: 18px;
  padding: 1.1rem 1.3rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: .3rem .9rem;
  box-shadow: 0 3px 12px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.3s;
  animation: cardSlideIn 0.35s cubic-bezier(0.34,1.3,0.64,1) both;
  position: relative;
  overflow: hidden;
}
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.entry-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(to bottom, var(--score-color-top, var(--pink)), var(--score-color-bot, var(--mauve)));
  border-radius: 4px 0 0 4px;
}
.entry-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--surface0));
}

.entry-main { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.entry-title {
  font-family: 'Varela Round', 'Verdana', 'Helvetica', serif;
  font-size: 1.03rem; font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}
.entry-title:hover { color: var(--accent); }

.entry-note {
  grid-column: 1; grid-row: 2;
  font-size: .88rem; color: var(--subtext1);
  line-height: 1.5;
}

.entry-side {
  grid-column: 2; grid-row: 1/3;
  display: flex; flex-direction: column;
  align-items: flex-end; justify-content: space-between;
  gap: .6rem;
}

.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-weight: 700; font-size: .92rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
}

.entry-actions { display: flex; gap: .4rem; }
.action-btn {
  width: 30px; height: 30px;
  border-radius: 8px; border: 1px solid var(--surface0);
  background: transparent;
  color: var(--overlay1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .78rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.action-btn.edit:hover  { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); border-color: var(--blue); }
.action-btn.copy:hover  { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); border-color: var(--green); }
.action-btn.trash:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-color: var(--red); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--overlay1);
}
.empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { font-size: .95rem; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card-bg);
  border: 1px solid var(--surface0);
  border-radius: 22px;
  width: min(90vw, 500px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: modalIn 0.3s cubic-bezier(0.34,1.4,0.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--surface0);
}
.modal-header h3 {
  font-family: 'Varela Round', 'Verdana', 'Helvetica', serif;
  font-size: 1.05rem; font-weight: 600;
  color: var(--accent);
  display: flex; align-items: center; gap: .5rem;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px; border: none;
  background: var(--surface0);
  color: var(--subtext0);
  cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: var(--maroon); color: #fff; }

.modal-body { padding: 1.3rem 1.4rem 1.6rem; }
.modal-desc { font-size: .88rem; color: var(--subtext1); margin-bottom: .5rem; }

.bookmarklet-anchor {
  display: inline-block;
  padding: .55rem 1.1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), var(--mauve));
  color: #fff;
  text-decoration: none;
  font-size: .92rem; font-weight: 500;
  cursor: grab;
  transition: transform 0.2s;
}
.bookmarklet-anchor:hover { transform: translateY(-2px); }

.code-block {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  padding: .9rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: .75rem;
  color: var(--subtext1);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 140px;
  overflow-y: auto;
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--surface0);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: .75rem 1.1rem;
  font-size: .9rem; color: var(--text);
  box-shadow: 0 8px 28px var(--shadow-md);
  z-index: 900;
  max-width: 300px;
  animation: toastIn 0.3s cubic-bezier(0.34,1.4,0.64,1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.toast-out {
  animation: toastOut 0.25s ease forwards;
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.95); }
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 580px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-field-full, .score-field { grid-column: 1; }

  .entry-card { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .entry-side { grid-column: 1; grid-row: 3; flex-direction: row; justify-content: space-between; padding-top: .5rem; border-top: 1px solid var(--surface0); margin-top: .4rem; }

  .header-inner { gap: .4rem; }
}
