﻿/* ==========================================================================
   Web Tools - Modern UI Stylesheet (v2.3.0)
   Designed for PWA / Mobile-first & Desktop Native Feel
   ========================================================================== */

:root {
  /* Color Palette - Dark (Default) */
  --bg0: #0a0e1a;
  --bg1: #111827;
  --bg2: #1e293b;
  --card: rgba(17, 24, 39, 0.72);
  --card-hover: rgba(30, 41, 59, 0.85);
  --card-solid: #111827;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(124, 92, 255, 0.4);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #7c5cff;
  --accent-glow: rgba(124, 92, 255, 0.35);
  --accent2: #2ee9a6;
  --accent2-glow: rgba(46, 233, 166, 0.3);
  --shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --bottom-nav-bg: rgba(10, 14, 26, 0.88);

  /* Category Gradients */
  --cat-daily: linear-gradient(135deg, #0284c7, #38bdf8);
  --cat-productivity: linear-gradient(135deg, #4f46e5, #818cf8);
  --cat-home: linear-gradient(135deg, #059669, #34d399);
  --cat-learning: linear-gradient(135deg, #65a30d, #a3e635);
  --cat-finance: linear-gradient(135deg, #d97706, #fbbf24);
  --cat-text: linear-gradient(135deg, #0284c7, #60a5fa);
  --cat-media: linear-gradient(135deg, #db2777, #f472b6);
  --cat-security: linear-gradient(135deg, #dc2626, #f87171);
  --cat-project: linear-gradient(135deg, #7c3aed, #c084fc);
  --cat-dev: linear-gradient(135deg, #6366f1, #a78bfa);
  --cat-emergency: linear-gradient(135deg, #ea580c, #fb923c);
  --cat-tools: linear-gradient(135deg, #6366f1, #a78bfa);
  --cat-time: linear-gradient(135deg, #4f46e5, #818cf8);
  --cat-health: linear-gradient(135deg, #059669, #34d399);
  --cat-travel: linear-gradient(135deg, #0284c7, #38bdf8);
  --cat-motorsport: linear-gradient(135deg, #ea580c, #fb923c);
  --cat-culture: linear-gradient(135deg, #db2777, #f472b6);
  --cat-business: linear-gradient(135deg, #7c3aed, #c084fc);
  --cat-games: linear-gradient(135deg, #65a30d, #a3e635);
  --cat-info: linear-gradient(135deg, #0284c7, #60a5fa);
  --cat-lifestyle: linear-gradient(135deg, #ec4899, #f472b6);
  --cat-tech: linear-gradient(135deg, #6366f1, #818cf8);
  --cat-knowledge: linear-gradient(135deg, #0284c7, #38bdf8);
}

/* Light Theme Variables */
body[data-theme="light"] {
  --bg0: #f8fafc;
  --bg1: #f1f5f9;
  --bg2: #e2e8f0;
  --card: rgba(255, 255, 255, 0.86);
  --card-hover: #ffffff;
  --card-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(99, 102, 241, 0.45);
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent2: #059669;
  --shadow: 0 16px 40px -10px rgba(15, 23, 42, 0.1);
  --bottom-nav-bg: rgba(255, 255, 255, 0.92);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Smooth Cross-Document Page Transitions */
@view-transition {
  navigation: auto;
}

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

@keyframes vtPageIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

::view-transition-old(root) {
  animation: vtPageOut 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

::view-transition-new(root) {
  animation: vtPageIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Fallback transition when cross-document View Transitions are unavailable */
@keyframes pageEnterSoft {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.994);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

html.no-vt .wrap {
  animation: pageEnterSoft 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

html.no-vt.page-leaving .wrap {
  opacity: 0;
  transform: translateY(-6px) scale(0.99);
}

html.no-vt.page-leaving .mobile-bottom-nav {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }

  html.no-vt .wrap {
    animation: none !important;
    transition: none !important;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background-color: var(--bg0);
  background-image: 
    radial-gradient(at 0% 0%, rgba(124, 92, 255, 0.18) 0px, transparent 50%),
    radial-gradient(at 100% 10%, rgba(46, 233, 166, 0.12) 0px, transparent 45%),
    linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 100%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  width: min(1200px, 100%);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Header & Brand Section
   ========================================================================== */

.app-header {
  margin-bottom: 8px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo-link:hover {
  transform: scale(1.08) rotate(-3deg);
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  box-shadow: 0 8px 24px -4px var(--accent-glow);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  margin: 0;
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 800;
  letter-spacing: -0.2px;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 255, 0.25);
  cursor: pointer;
  transition: all 0.15s ease;
}

.version-tag:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.brand-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Header Actions Toolbar */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  max-width: 580px;
  justify-content: flex-end;
}

/* Search Box */
.search-box {
  position: relative;
  flex: 1 1 240px;
  min-width: 180px;
}

.search-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.search-input {
  width: 100%;
  height: 44px;
  padding-block: 0;
  padding-inline: 42px 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input:focus ~ .search-icon {
  color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-size: 13.5px;
}

.search-clear-btn {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.search-clear-btn svg {
  width: 14px;
  height: 14px;
}

/* Action Icon Buttons */
.header-action-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.header-action-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.header-action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  background-color: var(--card-hover);
  box-shadow: 0 6px 18px -4px var(--accent-glow);
}

.header-action-btn:active {
  transform: scale(0.94);
}

/* ==========================================================================
   Main Card & Workspace
   ========================================================================== */

.main-card {
  background: var(--card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.25s ease;
}

/* Stats Bar */
.stats-bar {
  padding: 12px 20px;
  background: rgba(124, 92, 255, 0.05);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
}

.stats-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.count {
  color: var(--accent2);
  font-weight: 700;
  font-size: 15px;
}

.filtered-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 255, 0.2);
}

.filtered-pill:empty {
  display: none !important;
}

.list-area {
  padding: 16px 20px 24px;
}

/* Navigation Tabs */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.tab .tab-svg {
  width: 16px;
  height: 16px;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.tab:hover {
  background: rgba(124, 92, 255, 0.08);
  border-color: rgba(124, 92, 255, 0.25);
  color: var(--text);
}

.tab.active {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(46, 233, 166, 0.15));
  border-color: var(--accent);
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.tab.active .tab-svg {
  opacity: 1;
  color: var(--accent);
  transform: scale(1.1);
}

.tab-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0.9;
}

.tab.active .tab-count {
  background: var(--accent);
  color: #fff;
}

/* Category Group Title */
.category-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.category-title:first-child {
  margin-top: 0;
}

.category-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
}

.category-icon-wrap svg {
  width: 16px;
  height: 16px;
}

.category-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.category-count {
  margin-inline-start: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

/* ==========================================================================
   Tools & Items List (Grid Mode & List Mode)
   ========================================================================== */

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

#toolsList {
  list-style: none;
  margin: 0;
  padding: 0;
}

#toolsList.tab-transition {
  animation: contentFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mode 1: Grid View (3 columns per row, compact & clean) */
#toolsList.view-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 12px;
}

@media (max-width: 900px) {
  #toolsList.view-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
}

@media (max-width: 580px) {
  #toolsList.view-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
}

#toolsList.view-grid li:not(.category-title) {
  display: flex;
}

#toolsList.view-grid a.link {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.2s ease, 
              background-color 0.2s ease, 
              box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

#toolsList.view-grid a.link:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  background: var(--card-hover);
  box-shadow: 0 8px 24px -6px var(--shadow), 0 0 0 1px rgba(124, 92, 255, 0.2);
}

#toolsList.view-grid a.link:active {
  transform: scale(0.98);
}

/* Card Header (Icon & Tag) */
.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tool-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.tool-icon-box.is-app-img {
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
}

.tool-icon-box.is-app-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 7px;
}

.tool-icon-svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
}

a.link:hover .tool-icon-box {
  transform: scale(1.08) rotate(-2deg);
}

.badge-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

/* Card Text Content */
.card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.tool-name-wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.tool-fa-name {
  text-align: right;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.tool-en-name {
  text-align: right;
  min-width: 0;
  max-width: 100%;
  font-size: 11px;
  color: var(--text-muted);
  direction: ltr;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-desc {
  text-align: right;
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Footer Arrow */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  gap: 4px;
}

.card-footer svg {
  width: 13px;
  height: 13px;
  transition: transform 0.2s ease;
}

a.link:hover .card-footer svg {
  transform: translateX(-3px);
}

#toolsList.view-grid .list-row-tail {
  display: none !important;
}

/* ==========================================================================
   Mode 2: Compact List View
   ========================================================================== */

#toolsList.view-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#toolsList.view-list a.link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.15s ease;
}

#toolsList.view-list a.link:hover {
  background: var(--card-hover);
  border-color: var(--border-hover);
  transform: translateX(-3px);
}

#toolsList.view-list .card-top-row {
  display: flex !important;
  align-items: center;
  margin-bottom: 0;
  flex-shrink: 0;
}

#toolsList.view-list .card-top-row .badge-tag {
  display: none !important;
}

#toolsList.view-list .tool-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#toolsList.view-list .tool-icon-box.is-app-img {
  padding: 3px;
}

#toolsList.view-list .tool-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
}

#toolsList.view-list .card-footer {
  display: none !important;
}

#toolsList.view-list .card-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

#toolsList.view-list .tool-name-wrap {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#toolsList.view-list .tool-fa-name {
  font-size: 14px;
  font-weight: 700;
}

#toolsList.view-list .tool-en-name {
  font-size: 10.5px;
  color: var(--text-muted);
  direction: ltr;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#toolsList.view-list .tool-desc {
  flex: 1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

#toolsList.view-list .list-row-tail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#toolsList.view-list .list-row-tail .badge-tag {
  font-size: 10.5px;
  padding: 2px 6px;
}

#toolsList.view-list .list-row-tail svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

/* Category Gradient Classes */
.cat-daily { background: var(--cat-daily); }
.cat-productivity { background: var(--cat-productivity); }
.cat-home { background: var(--cat-home); }
.cat-learning { background: var(--cat-learning); }
.cat-finance { background: var(--cat-finance); }
.cat-text { background: var(--cat-text); }
.cat-media { background: var(--cat-media); }
.cat-security { background: var(--cat-security); }
.cat-project { background: var(--cat-project); }
.cat-dev { background: var(--cat-dev); }
.cat-emergency { background: var(--cat-emergency); }
.cat-tools { background: var(--cat-tools); }
.cat-time { background: var(--cat-time); }
.cat-health { background: var(--cat-health); }
.cat-travel { background: var(--cat-travel); }
.cat-motorsport { background: var(--cat-motorsport); }
.cat-culture { background: var(--cat-culture); }
.cat-business { background: var(--cat-business); }
.cat-games { background: var(--cat-games); }
.cat-info { background: var(--cat-info); }
.cat-lifestyle { background: var(--cat-lifestyle); }
.cat-tech { background: var(--cat-tech); }
.cat-knowledge { background: var(--cat-knowledge); }

/* Empty Search State */
.no-results {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.no-results-icon svg {
  width: 56px;
  height: 56px;
  color: var(--accent);
  opacity: 0.6;
  margin-bottom: 12px;
}

.no-results h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--text);
  font-weight: 700;
}

.no-results p {
  margin: 0 0 18px;
  font-size: 13.5px;
}

.btn-reset-search {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent);
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-search:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  margin-top: 14px;
  padding: 18px 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.footer-simple {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: -0.2px;
  opacity: 0.85;
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (Modern Floating Island / Glassmorphism)
   ========================================================================== */

.mobile-bottom-nav {
  position: fixed;
  bottom: max(14px, calc(env(safe-area-inset-bottom, 0px) + 10px));
  left: 14px;
  right: 14px;
  max-width: 440px;
  margin: 0 auto;
  height: 64px;
  border-radius: 28px;
  background: var(--bottom-nav-bg);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px -4px rgba(0, 0, 0, 0.45), 
              0 6px 16px rgba(0, 0, 0, 0.2), 
              inset 0 1px 0 rgba(255, 255, 255, 0.15);
  display: none;
  align-items: center;
  justify-content: space-around;
  padding: 5px 8px;
  z-index: 1000;
  animation: navSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

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

body[data-theme="light"] .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 23, 42, 0.09);
  box-shadow: 0 18px 40px -4px rgba(15, 23, 42, 0.14), 
              0 6px 16px rgba(15, 23, 42, 0.06), 
              inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.bottom-nav-item {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 20px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.bottom-nav-icon svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.bottom-nav-label {
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: -0.2px;
  transition: all 0.2s ease;
}

/* Active State with Capsule Gradient & Glow */
.bottom-nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(46, 233, 166, 0.12));
  border-color: rgba(124, 92, 255, 0.38);
  box-shadow: 0 4px 14px -2px rgba(124, 92, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.bottom-nav-item.active .bottom-nav-icon {
  transform: translateY(-1px) scale(1.1);
  color: #fff;
  filter: drop-shadow(0 2px 8px var(--accent-glow));
}

.bottom-nav-item.active .bottom-nav-label {
  font-weight: 700;
  color: #ffffff;
}

/* Bottom Glow Dot Indicator */
.bottom-nav-item::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent2);
  opacity: 0;
  transform: scaleX(0);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px var(--accent2-glow);
}

.bottom-nav-item.active::after {
  opacity: 1;
  transform: scaleX(1);
}

/* Light Theme Active State */
body[data-theme="light"] .bottom-nav-item.active {
  color: var(--accent);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(5, 150, 105, 0.08));
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: 0 4px 14px -2px rgba(99, 102, 241, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

body[data-theme="light"] .bottom-nav-item.active .bottom-nav-icon,
body[data-theme="light"] .bottom-nav-item.active .bottom-nav-label {
  color: var(--accent);
}

/* ==========================================================================
   Settings & About Modal
   ========================================================================== */

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.settings-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.settings-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(88vh, 750px);
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-modal.active .settings-panel {
  transform: scale(1) translateY(0);
}

.settings-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
}

.settings-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-header-icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.settings-header-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.settings-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

.settings-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.settings-close-btn svg {
  width: 18px;
  height: 18px;
}

/* Settings Nav Tabs */
.settings-nav-tabs {
  display: flex;
  gap: 6px;
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.settings-tab-btn.active {
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
  border-color: rgba(124, 92, 255, 0.35);
}

.settings-tab-btn svg {
  width: 16px;
  height: 16px;
}

.settings-tab-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--accent2);
  color: #0a0e1a;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.3;
}

.settings-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: contentFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.settings-tab-pane.hidden {
  display: none !important;
}

.changelog-header-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.changelog-header-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.changelog-header-icon-wrap svg {
  width: 20px;
  height: 20px;
}

.settings-card-title-plain {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}

.changelog-intro-desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.settings-content {
  padding: 18px 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-card-title svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-row:first-of-type {
  border-top: none;
  padding-top: 0;
}

.setting-label-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-label-col strong {
  font-size: 13.5px;
  color: var(--text);
}

.setting-label-col span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Segmented Buttons */
.segmented-control {
  display: flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  gap: 2px;
}

.seg-btn {
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Action Outline Buttons */
.btn-action-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-action-outline:hover {
  background: rgba(124, 92, 255, 0.15);
  border-color: var(--accent);
}

.btn-action-outline.text-danger:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.btn-action-outline svg {
  width: 14px;
  height: 14px;
}

.btn-action-outline.loading .btn-spin-icon {
  animation: update-spin-slow 1s linear infinite;
}

/* Changelog Inside Settings */
.changelog-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.changelog-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.changelog-item.is-current {
  border-color: rgba(46, 233, 166, 0.4);
  background: rgba(46, 233, 166, 0.05);
}

.changelog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.changelog-ver {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

.current-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent2);
  color: #0f172a;
  font-weight: 800;
}

.changelog-date {
  font-size: 12px;
  color: var(--text-muted);
}

.changelog-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.changelog-bullets {
  margin: 0;
  padding-inline-start: 18px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* About Developer Section */
.dev-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.dev-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #2ee9a6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 14px var(--accent-glow);
  flex-shrink: 0;
}

.dev-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dev-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.dev-bio {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.dev-links-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 4px;
}

.dev-link-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.dev-link-pill:hover {
  background: rgba(124, 92, 255, 0.12);
  border-color: var(--accent);
  transform: translateX(-4px);
}

.dev-link-pill svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .header-actions {
    max-width: none;
    width: 100%;
  }

  .brand-row {
    gap: 12px;
  }

  .list-area {
    padding: 12px 14px 18px;
  }

  #toolsList.view-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #toolsList.view-list .card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  #toolsList.view-list .tool-name-wrap {
    flex: none;
  }

  .settings-modal {
    padding: 0;
    align-items: flex-end;
  }

  .settings-panel {
    border-radius: 24px 24px 0 0;
    max-height: 88dvh;
  }
}

/* ==========================================================================
   Mobile "More" Sheet
   ========================================================================== */

.more-sheet {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

.more-sheet[hidden] {
  display: none;
}

.more-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.more-sheet-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(max(14px, env(safe-area-inset-bottom, 0px) + 10px) + 74px);
  max-width: 440px;
  margin: 0 auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 22px;
  background: var(--card-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: navSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.more-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.more-sheet-item:hover,
.more-sheet-item.active {
  background: rgba(124, 92, 255, 0.14);
  border-color: rgba(124, 92, 255, 0.35);
}

.more-sheet-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
  flex-shrink: 0;
}

.more-sheet-icon svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 769px) {
  .more-sheet {
    display: none !important;
  }
}

/* ==========================================================================
   Mobile Refinements
   ========================================================================== */

@media (max-width: 768px) {
  .header-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .search-box {
    flex: 1 1 0;
    min-width: 0;
  }

  .search-input {
    height: 40px;
    font-size: 13px;
    text-overflow: ellipsis;
  }

  .search-input::placeholder {
    font-size: 12.5px;
    text-overflow: ellipsis;
  }

  .header-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .header-action-btn svg {
    width: 18px;
    height: 18px;
  }

  .brand-name {
    white-space: nowrap;
  }

  #toolsList .tool-name-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  #toolsList .tool-en-name {
    align-self: flex-start;
  }

  .setting-row {
    flex-wrap: wrap;
  }

  .settings-nav-tabs {
    padding: 0 12px 12px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .settings-tab-btn {
    flex: 1 1 0;
    min-width: 0;
    gap: 5px;
    padding: 8px 4px;
    font-size: clamp(11px, 3.3vw, 13px);
  }

  .settings-tab-btn span:not(.settings-tab-badge) {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 480px) {
  .settings-tab-btn svg,
  .settings-tab-badge {
    display: none;
  }

  .settings-content {
    padding: 14px 14px 20px;
  }
}

@media (max-width: 380px) {
  .header-actions {
    gap: 4px;
  }

  .header-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .search-input {
    height: 36px;
    padding-inline: 34px 30px;
  }

  .search-icon {
    inset-inline-start: 10px;
    width: 16px;
    height: 16px;
  }

  .search-clear-btn {
    inset-inline-end: 6px;
  }
}

/* ==========================================================================
   PWA Update Notification
   ========================================================================== */

@keyframes update-spin-slow {
  to { transform: rotate(360deg); }
}

@keyframes update-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent2-glow); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.update-notification {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: 12px;
  right: 12px;
  z-index: 10002;
  max-width: 560px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: var(--card-solid);
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-glow);
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.update-notification.show {
  opacity: 1;
  transform: translateY(0);
}

.update-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.update-icon-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.update-icon-svg {
  width: 20px;
  height: 20px;
}

.update-pulse-dot {
  position: absolute;
  top: -3px;
  inset-inline-end: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent2);
  border: 2px solid var(--card-solid);
  animation: update-pulse 1.8s ease-out infinite;
}

.update-text {
  flex: 1 1 auto;
  min-width: 0;
}

.update-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.update-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.update-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 255, 0.25);
}

.update-desc {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.update-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.update-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: transform 0.15s ease, filter 0.2s ease;
}

.update-button:hover { filter: brightness(1.1); }
.update-button:active { transform: scale(0.96); }

.update-button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.update-button .btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.update-button.loading .btn-icon {
  animation: update-spin-slow 1s linear infinite;
}

.dismiss-button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dismiss-button:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.dismiss-button svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 520px) {
  .update-content {
    flex-wrap: wrap;
  }

  .update-text {
    flex-basis: calc(100% - 56px);
  }

  .update-actions {
    flex: 1 1 100%;
  }

  .update-button {
    flex: 1;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .update-notification,
  .update-pulse-dot,
  .update-button.loading .btn-icon {
    animation: none;
    transition: none;
  }
}
