/* ═══════════════════════════════════════════════════════════════════
   index.css — Premium dark-themed design system for Nav-Home.
   
   Design pillars:
     1. Glassmorphism (backdrop-filter blur + translucent fills)
     2. Smooth transitions (cubic-bezier easing on everything)
     3. Staggered entrance animations
     4. Rich depth via layered shadows
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --bg-primary:    rgba(15, 15, 25, 0.85);
  --bg-card:       rgba(255, 255, 255, 0.08);
  --bg-card-hover: rgba(255, 255, 255, 0.14);
  --bg-glass:      rgba(255, 255, 255, 0.05);

  --text-primary:   #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.6);

  --accent:       #6c5ce7;
  --accent-hover:  #7c6cf7;
  --accent-glow:   rgba(108, 92, 231, 0.3);

  --danger: #ff6b6b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm:  0 2px  8px rgba(0, 0, 0, 0.25);
  --shadow-md:  0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg:  0 16px 48px rgba(0, 0, 0, 0.45);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0a0a14;
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Custom Scrollbar (thin, glassy) ───────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* ══════════════════════════════════════════════════════════════════
   BACKGROUND LAYERS
   ══════════════════════════════════════════════════════════════════ */

#wallpaper-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: #000;
  opacity: 0.3;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════
   APP CONTAINER
   ══════════════════════════════════════════════════════════════════ */

#app-container {
  position: relative;
  z-index: 2;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px 60px;
}

/* ══════════════════════════════════════════════════════════════════
   CLOCK SECTION
   ══════════════════════════════════════════════════════════════════ */

#clock-section {
  text-align: center;
  user-select: none;
}

#clock-time {
  font-size: 5rem;
  font-weight: 200;
  letter-spacing: -2px;
  line-height: 1.1;
  text-shadow: 0 2px 20px rgba(108, 92, 231, 0.15);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

#clock-date {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
}

#clock-greeting {
  font-size: 1.2rem;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════
   SEARCH SECTION
   ══════════════════════════════════════════════════════════════════ */

#search-section {
  max-width: 680px;
  width: 90%;
  margin: 30px auto 0;
  position: relative;
  z-index: 10;
}

#search-wrapper {
  display: flex;
  align-items: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  height: 52px;
  overflow: hidden;
  transition: var(--transition);
}

#search-wrapper.search-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 8px 32px rgba(108, 92, 231, 0.12);
}

/* Engine button (left side of search bar) */
#search-engine-btn {
  width: 52px;
  min-width: 52px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.25rem;
  transition: var(--transition);
}
#search-engine-btn:hover { background: rgba(255, 255, 255, 0.06); }

#search-engine-icon { display: flex; align-items: center; justify-content: center; }

/* Search input */
#search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 0 20px;
  outline: none;
  font-family: inherit;
}
#search-input::placeholder { color: var(--text-secondary); }

/* ── Dropdown (shared for engine list & suggestions) ───────────── */
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  background: rgba(20, 20, 35, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  list-style: none;
  padding: 6px 0;
  z-index: 50;
  animation: scaleIn 0.15s ease-out;
}

.dropdown.hidden { display: none; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.dropdown-item:hover { background: rgba(255, 255, 255, 0.08); }
.dropdown-item.active { color: var(--accent); }

.dropdown-icon {
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.dropdown-label { flex: 1; }

/* ══════════════════════════════════════════════════════════════════
   GROUPS SECTION
   ══════════════════════════════════════════════════════════════════ */

#groups-section {
  width: 100%;
  max-width: 800px;
  margin: 24px auto 0;
}

#groups-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.group-tab {
  padding: 8px 20px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  user-select: none;
}

.group-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.group-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* Add-group button (dashed border) */
.group-tab--add {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
}
.group-tab--add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}

.plus-icon {
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1;
}

/* Inline rename input inside a tab */
.group-rename-input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 2px 8px;
  width: 80px;
  outline: none;
}

/* ══════════════════════════════════════════════════════════════════
   BOOKMARKS SECTION
   ══════════════════════════════════════════════════════════════════ */

#bookmarks-section {
  width: 100%;
  max-width: 900px;
  margin: 20px auto 0;
  padding: 0 20px;
}

#bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 18px;
}

/* ── Bookmark Card ─────────────────────────────────────────────── */
.bookmark-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 10px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;

  /* Staggered entrance — delay set via inline style */
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.bookmark-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-md);
}

.bookmark-card:active { transform: translateY(-2px) scale(0.98); }

/* Icon */
.bm-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bm-icon-wrap img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}

.bm-icon-fallback {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
}

/* Title */
.bm-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Add-bookmark card */
.bookmark-card--add {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.15);
  justify-content: center;
  min-height: 100px;
}
.bookmark-card--add .plus-icon {
  font-size: 1.8rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.bookmark-card--add:hover {
  border-color: var(--accent);
}
.bookmark-card--add:hover .plus-icon { color: var(--accent); }

/* Drag states */
.bookmark-card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.bookmark-card.drop-target {
  border-color: var(--accent) !important;
  background: var(--accent-glow);
}

/* ══════════════════════════════════════════════════════════════════
   SETTINGS PANEL (slide-in from right)
   ══════════════════════════════════════════════════════════════════ */

#settings-panel {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 380px;
  background: var(--bg-primary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  overflow-y: auto;
  padding: 30px;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#settings-panel.open {
  transform: translateX(0);
}

/* Toggle button (gear icon, top-right) */
#settings-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
#settings-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: rotate(45deg);
}

/* Panel header */
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.settings-title {
  font-size: 1.3rem;
  font-weight: 600;
}

#settings-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
#settings-close-btn:hover { color: var(--text-primary); }

/* Section titles */
.settings-section-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 24px 0 12px;
  font-weight: 600;
}

/* Glass cards for setting groups */
.settings-card {
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.settings-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.settings-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

/* Text / URL inputs in settings */
.settings-card input[type="url"],
.settings-card input[type="text"] {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.settings-card input[type="url"]:focus,
.settings-card input[type="text"]:focus {
  border-color: var(--accent);
}

/* Hint / result text */
.settings-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-height: 1.2em;
  margin-bottom: 6px;
}
.hint-success { color: #51cf66; }
.hint-error   { color: var(--danger); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}
.btn-accent:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}

/* Small inline button (e.g. "Test") */
#searxng-test-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
#searxng-test-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

/* Data management row */
.data-mgmt-card {
  display: flex;
  gap: 10px;
}
.data-mgmt-card > * { flex: 1; }

/* ── Wallpaper Grid ────────────────────────────────────────────── */
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.wp-thumb {
  height: 68px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}
.wp-thumb:hover { border-color: rgba(255, 255, 255, 0.3); transform: scale(1.04); }
.wp-thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

/* ── Range Slider ──────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ══════════════════════════════════════════════════════════════════
   MODAL (Add / Edit Bookmark)
   ══════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  max-width: 440px;
  width: 92%;
  background: var(--bg-primary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

.modal-box.anim-scale-in {
  animation: scaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

#modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
#modal-close-btn:hover { color: var(--text-primary); }

/* Form elements */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-group select {
  cursor: pointer;
}

.form-group select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

.btn-full {
  width: 100%;
  margin-top: 16px;
}

/* ══════════════════════════════════════════════════════════════════
   CONTEXT MENU
   ══════════════════════════════════════════════════════════════════ */

#context-menu {
  position: fixed;
  background: rgba(20, 20, 35, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  min-width: 160px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  padding: 6px 0;
  animation: scaleIn 0.12s ease-out;
}
#context-menu.hidden { display: none; }

.ctx-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctx-item:hover { background: rgba(255, 255, 255, 0.08); }
.ctx-danger:hover { color: var(--danger); }

/* ══════════════════════════════════════════════════════════════════
   PASSWORD MODAL
   ══════════════════════════════════════════════════════════════════ */

.password-box {
  max-width: 360px;
  text-align: center;
}

.password-box input[type="password"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  text-align: center;
  letter-spacing: 2px;
}
.password-box input[type="password"]:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════
   NAV MANAGEMENT (inside settings panel)
   ══════════════════════════════════════════════════════════════════ */

.nav-mgmt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.nav-mgmt-select {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  margin-right: 8px;
}
.nav-mgmt-select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

.nav-mgmt-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.nav-mgmt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.nav-mgmt-item:hover { background: rgba(255, 255, 255, 0.08); }

.nav-mgmt-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.nav-mgmt-item-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.nav-mgmt-item-name {
  font-size: 0.82rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-mgmt-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.nav-mgmt-empty {
  text-align: center;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* Small button (for headers) */
.btn-sm {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-sm:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Icon button (emoji action) */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
  line-height: 1;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.1); }
.btn-icon-danger:hover { background: rgba(255, 107, 107, 0.15); }

/* Import bookmarks button */
.btn-import-bm {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
  padding: 9px 16px;
  font-size: 0.82rem;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════
   TOAST (tiny notification)
   ══════════════════════════════════════════════════════════════════ */

.search-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.search-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════════════════════════════
   KEYFRAME ANIMATIONS
   ══════════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* Utility animation classes applied by JS */
.anim-fade-in  { animation: fadeIn  0.6s ease-out both; }
.anim-slide-up { animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; }

/* ══════════════════════════════════════════════════════════════════
   NOTEPAD PANEL (slide-in from left)
   ══════════════════════════════════════════════════════════════════ */

#notepad-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
#notepad-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
}

#notepad-panel {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 380px;
  background: var(--bg-primary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 30px;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#notepad-panel.open {
  transform: translateX(0);
}

.notepad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.notepad-title {
  font-size: 1.3rem;
  font-weight: 600;
}

#notepad-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
#notepad-close-btn:hover { color: var(--text-primary); }

.notepad-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#notepad-textarea {
  flex: 1;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: var(--transition);
}

#notepad-textarea:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.notepad-status {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: right;
  min-height: 1.5em;
  transition: color 0.2s;
}

.notepad-status.saving {
  color: var(--accent);
}
.notepad-status.saved {
  color: #51cf66;
}
.notepad-status.error {
  color: var(--danger);
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet
   ══════════════════════════════════════════════════════════════════ */


@media (max-width: 768px) {
  #app-container { padding-top: 50px; }

  #clock-time { font-size: 3.4rem; }
  #clock-date { font-size: 0.95rem; }
  #clock-greeting { font-size: 1rem; }

  #bookmarks-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
  }

  .bookmark-card { padding: 14px 8px; }
  .bm-icon-wrap  { width: 38px; height: 38px; }
  .bm-icon-wrap img { width: 26px; height: 26px; }

  #settings-panel { width: 100%; }
  #notepad-panel { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════════
   VISITOR LOCK SCREEN STYLE
   ══════════════════════════════════════════════════════════════════ */
body.locked #app-container,
body.locked #notepad-toggle,
body.locked #settings-toggle {
  display: none !important;
}

#visitor-lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  opacity: 1;
  transition: opacity 0.4s ease-out;
}

#visitor-lock-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.lock-box {
  max-width: 400px;
  width: 90%;
  text-align: center;
  padding: 40px 30px;
  background: var(--bg-primary);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lock-icon-wrap {
  width: 64px;
  height: 64px;
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
  color: var(--accent);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.lock-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.lock-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.lock-input-group {
  margin-bottom: 16px;
  position: relative;
}

.lock-input-group input[type="password"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
  text-align: center;
  letter-spacing: 4px;
}

.lock-input-group input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.lock-error {
  font-size: 0.8rem;
  color: var(--danger);
  min-height: 1.4em;
  margin-top: 8px;
  transition: color 0.2s;
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Phone
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  #app-container { padding-top: 36px; }

  #clock-time { font-size: 2.6rem; letter-spacing: -1px; }
  #clock-date { font-size: 0.85rem; }
  #clock-greeting { font-size: 0.9rem; }

  #search-section { width: 95%; margin-top: 20px; }
  #search-wrapper { height: 46px; }

  #bookmarks-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
  }

  .bookmark-card { padding: 12px 6px; border-radius: var(--radius-sm); }
  .bm-icon-wrap  { width: 34px; height: 34px; margin-bottom: 6px; }
  .bm-title      { font-size: 0.72rem; }

  .group-tab { padding: 6px 14px; font-size: 0.78rem; }
}
