/* Snippet — clipboard manager
 * Palette: ice-blue + cream + emerald accents
 * © אופיר ברנס (Ofir Baranes) 2026
 */

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg-1: #070a14;
  --bg-2: #0d1422;
  --bg-3: #131c2e;
  --ice-200: #e0f2fe;
  --ice-300: #bae6fd;
  --ice-400: #7dd3fc;
  --ice-500: #38bdf8;
  --ice-600: #0284c7;
  --ice-700: #0369a1;
  --emerald: #86efac;
  --emerald-deep: #16a34a;
  --lavender: #a5b4fc;
  --cream: #fef9c3;
  --cream-light: #fffbeb;
  --gold: #fcd34d;
  --text-primary: #e0f2fe;
  --text-secondary: rgba(224,242,254,0.72);
  --text-muted: rgba(224,242,254,0.42);
  --surface: rgba(186,230,253,0.04);
  --surface-strong: rgba(186,230,253,0.09);
  --border: rgba(125,211,252,0.14);
  --border-strong: rgba(125,211,252,0.26);
  --shadow-glass: 0 30px 60px -25px rgba(7,10,20,0.7);
  --bezier: cubic-bezier(.34,1.56,.64,1);
  --bezier-soft: cubic-bezier(.4,0,.2,1);
}

html, body {
  background: var(--bg-1);
  color: var(--text-primary);
  font-family: 'Heebo', system-ui, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 700px 800px at 80% -10%, rgba(56,189,248,0.16), transparent 60%),
    radial-gradient(ellipse 500px 600px at -10% 60%, rgba(134,239,172,0.10), transparent 65%),
    radial-gradient(ellipse 800px 1000px at 50% 110%, rgba(3,105,161,0.30), transparent 70%),
    linear-gradient(180deg, #070a14 0%, #0d1422 60%, #131c2e 110%);
  background-attachment: fixed;
  position: relative;
  padding-bottom: 90px;
}

.ambient-bg {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb-blur {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.45;
}
.orb-blur.o1 { width: 420px; height: 420px; top: -120px; right: -120px; background: radial-gradient(circle, #38bdf8 0%, transparent 70%); animation: drift1 26s ease-in-out infinite; }
.orb-blur.o2 { width: 340px; height: 340px; bottom: 5%; left: -100px; background: radial-gradient(circle, #86efac 0%, transparent 70%); opacity: 0.18; animation: drift2 32s ease-in-out infinite; }
.orb-blur.o3 { width: 260px; height: 260px; top: 40%; right: 30%; background: radial-gradient(circle, #a5b4fc 0%, transparent 70%); opacity: 0.28; animation: drift3 38s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-30px,40px) scale(1.1); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,-30px) scale(1.08); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-25px,-35px) scale(1.12); } }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(7,10,20,0.85) 0%, rgba(7,10,20,0.55) 100%);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--cream-light);
  letter-spacing: -0.01em;
}
.mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ice-300), var(--ice-700));
  color: var(--bg-1);
  box-shadow: 0 0 18px rgba(56,189,248,0.45);
}
.mark svg { width: 18px; height: 18px; }

.header-actions { display: flex; gap: 8px; }
.icon-btn, .install-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  border-radius: 12px;
  padding: 7px 12px;
  cursor: pointer;
  transition: all 0.2s var(--bezier-soft);
  backdrop-filter: blur(10px);
}
.icon-btn { padding: 7px 9px; font-size: 16px; }
.icon-btn:hover, .install-btn:hover {
  background: var(--surface-strong);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.install-btn {
  background: linear-gradient(135deg, var(--ice-300), var(--ice-700));
  border: none;
  color: var(--bg-1);
  font-weight: 700;
}

main {
  position: relative;
  z-index: 1;
  padding: 18px 18px;
  max-width: 720px;
  margin: 0 auto;
}
.hidden { display: none !important; }

/* ===== Search ===== */
.search-section {
  margin-bottom: 14px;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: linear-gradient(140deg, var(--surface-strong) 0%, var(--surface) 100%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  transition: all 0.2s var(--bezier-soft);
}
.search-bar:focus-within {
  border-color: var(--ice-400);
  background: rgba(186,230,253,0.10);
  box-shadow: 0 0 0 4px rgba(56,189,248,0.10);
}
.s-icon { width: 18px; height: 18px; color: var(--ice-400); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--cream-light);
  font-family: inherit;
  font-size: 15px;
  text-align: right;
  direction: rtl;
  min-width: 0;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ===== Filter rows ===== */
.filter-row, .cat-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar, .cat-row::-webkit-scrollbar { display: none; }
.filter-chip, .cat-chip {
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--bezier-soft);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.filter-chip:hover, .cat-chip:hover { background: var(--surface-strong); color: var(--cream-light); }
.filter-chip.active {
  background: linear-gradient(135deg, var(--ice-400), var(--ice-700));
  border-color: transparent;
  color: var(--cream-light);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(56,189,248,0.35);
}
.cat-chip.active {
  background: color-mix(in srgb, var(--cc-color, var(--ice-400)) 25%, transparent);
  border-color: var(--cc-color, var(--ice-400));
  color: var(--cream-light);
  font-weight: 600;
}
.cat-chip-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  opacity: 0.7;
}

/* ===== Snippets list ===== */
.snippets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.snip-card {
  position: relative;
  padding: 14px 16px;
  background: linear-gradient(140deg, var(--surface-strong) 0%, var(--surface) 100%);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s var(--bezier);
  overflow: hidden;
}
.snip-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  padding: 1px;
  background: linear-gradient(135deg, var(--snip-color, var(--ice-400)) 0%, transparent 60%);
  -webkit-mask: linear-gradient(#000,#000) content-box, linear-gradient(#000,#000);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.snip-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glass);
}
.snip-card:hover::before { opacity: 1; }
.snip-card.copied {
  border-color: var(--emerald);
  background: linear-gradient(140deg, rgba(134,239,172,0.10), var(--surface));
}

.sc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sc-pin {
  font-size: 12px;
  color: var(--gold);
  flex-shrink: 0;
}
.sc-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: color-mix(in srgb, var(--snip-color, var(--ice-400)) 18%, transparent);
  color: var(--snip-color, var(--ice-300));
  border: 1px solid color-mix(in srgb, var(--snip-color, var(--ice-400)) 30%, transparent);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.sc-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--cream-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sc-body {
  padding: 8px 10px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(186,230,253,0.06);
  border-radius: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-height: 80px;
  overflow: hidden;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
  direction: ltr;
  text-align: left;
}
.sc-body.rtl { direction: rtl; text-align: right; }
.sc-body::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 24px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.5));
  pointer-events: none;
}

.sc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.sc-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.sc-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: rgba(186,230,253,0.05);
  border-radius: 100px;
}
.sc-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.sc-copy-btn {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-deep));
  border: none;
  color: var(--bg-1);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s var(--bezier);
  box-shadow: 0 4px 12px rgba(134,239,172,0.30);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sc-copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(134,239,172,0.45);
}
.sc-copy-btn:active { transform: scale(0.95); }
.sc-copy-btn svg { width: 12px; height: 12px; }
.sc-copy-btn.done { background: linear-gradient(135deg, var(--cream), var(--gold)); }

/* Empty */
.empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 24px;
}
.empty-illust {
  width: 120px;
  height: 120px;
  margin: 0 auto 14px;
  filter: drop-shadow(0 14px 24px rgba(56,189,248,0.30));
}
.empty-illust svg { width: 100%; height: 100%; }
.empty h3 {
  font-family: 'Frank Ruhl Libre', 'Heebo', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--cream-light);
  margin-bottom: 8px;
}
.empty p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 380px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 60px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ice-400), var(--ice-700));
  color: var(--cream-light);
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 14px 30px rgba(56,189,248,0.50), 0 0 24px rgba(125,211,252,0.30);
  display: grid;
  place-items: center;
  transition: all 0.3s var(--bezier);
}
.fab:hover {
  transform: translateX(-50%) translateY(-3px) scale(1.05);
  box-shadow: 0 18px 40px rgba(56,189,248,0.65);
}
.fab:active { transform: translateX(-50%) scale(0.95); }
.fab svg { width: 26px; height: 26px; }

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(5,8,15,0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: modal-fade 0.25s var(--bezier-soft);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%;
  max-width: 540px;
  background: linear-gradient(180deg, #131c2e 0%, #070a14 100%);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 20px 22px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  animation: modal-slide 0.4s var(--bezier);
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes modal-slide { from { transform: translateY(100%); } to { transform: translateY(0); } }
.handle {
  width: 38px; height: 4px;
  background: var(--border-strong);
  border-radius: 4px;
  margin: 0 auto 16px;
}
.modal-card h3 {
  font-family: 'Frank Ruhl Libre', 'Heebo', serif;
  color: var(--cream-light);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}
.modal-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 14px;
}
.mark-big {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--ice-300), var(--ice-700));
  border-radius: 18px;
  color: var(--bg-1);
  margin: 4px auto 14px;
  box-shadow: 0 0 30px rgba(56,189,248,0.45);
}
.mark-big svg { width: 32px; height: 32px; }

.modal-input {
  width: 100%;
  padding: 13px 14px;
  background: rgba(186,230,253,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--cream-light);
  font-family: 'Heebo', sans-serif;
  font-size: 15px;
  margin-bottom: 12px;
  transition: all 0.2s;
  text-align: right;
  direction: rtl;
  resize: vertical;
  line-height: 1.5;
}
.modal-input.mono {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  direction: ltr;
  text-align: left;
  background: rgba(0,0,0,0.25);
  line-height: 1.6;
}
.modal-input:focus {
  outline: none;
  border-color: var(--ice-400);
  background: rgba(186,230,253,0.10);
}
.modal-input::placeholder { color: var(--text-muted); }

.form-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ice-300);
  margin-bottom: 8px;
}

.cat-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.cat-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--bezier-soft);
}
.cat-pick:hover { background: var(--surface-strong); }
.cat-pick.active {
  background: color-mix(in srgb, var(--cp-color) 22%, transparent);
  border-color: var(--cp-color);
  color: var(--cream-light);
  font-weight: 600;
}
.cat-pick-icon { font-size: 18px; line-height: 1; }

.option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(186,230,253,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 14px;
}
.option-row:hover { background: rgba(186,230,253,0.08); }
.option-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}
.opt-text { flex: 1; min-width: 0; }
.opt-title { font-size: 14px; font-weight: 500; color: var(--cream-light); margin-bottom: 2px; }
.opt-sub { font-size: 11px; color: var(--text-muted); font-family: 'IBM Plex Mono', monospace; }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.btn-primary, .btn-secondary, .btn-mini {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 18px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--bezier);
  border: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--ice-400), var(--ice-700));
  color: var(--cream-light);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(56,189,248,0.40);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(56,189,248,0.55); }
.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--cream-light);
}
.btn-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  flex: 0 1 auto;
  padding: 13px 18px;
}
.btn-mini.danger { color: #fda4af; border-color: rgba(253,164,175,0.3); }
.btn-mini.danger:hover { background: rgba(253,164,175,0.1); }

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  bottom: max(100px, calc(env(safe-area-inset-bottom) + 80px));
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--emerald), var(--emerald-deep));
  color: var(--bg-1);
  padding: 12px 22px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(0,0,0,0.4);
  z-index: 200;
  animation: toast-in 0.3s var(--bezier);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast.fade { animation: toast-out 0.3s var(--bezier-soft) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(20px); } }

/* Search highlight */
.snip-hl {
  background: rgba(252,211,77,0.30);
  color: var(--cream-light);
  border-radius: 2px;
  padding: 0 2px;
}
