/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg-base:      #0d1117;
  --bg-surface:   #161b22;
  --bg-elevated:  #21262d;
  --bg-hover:     #2d333b;
  --border:       #30363d;
  --border-muted: #21262d;

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;

  --accent:        #58a6ff;
  --accent-hover:  #79c0ff;
  --accent-dim:    rgba(88, 166, 255, 0.12);
  --accent-border: rgba(88, 166, 255, 0.3);

  --success:     #3fb950;
  --success-dim: rgba(63, 185, 80, 0.12);
  --warning:     #d29922;
  --danger:      #f85149;
  --danger-dim:  rgba(248, 81, 73, 0.12);
  --purple:      #a371f7;
  --purple-dim:  rgba(163, 113, 247, 0.12);
  --orange:      #f0883e;
  --orange-dim:  rgba(240, 136, 62, 0.12);

  --radius:    6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 2px 8px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6), 0 0 0 1px var(--border);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;

  --header-h: 58px;
  --max-w: 1280px;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { color-scheme: dark; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.btn-logout:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border);
}

/* ─── Main ───────────────────────────────────────────────────────────────────── */
.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ─── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  padding: 48px 0 36px;
  text-align: center;
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #e6edf3 0%, #8b949e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 28px;
}

.search-wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 48px 12px 44px;
  font-size: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg-elevated);
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-base);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.7;
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
  margin-bottom: 32px;
  position: relative;
}

.filter-scroll {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  white-space: nowrap;
  transition: all var(--transition);
}

.filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.filter-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.filter-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 0 6px;
  min-width: 18px;
  text-align: center;
  color: var(--text-muted);
}

.filter-btn.active .filter-count {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ─── Content ────────────────────────────────────────────────────────────────── */
.content-wrap { display: flex; flex-direction: column; gap: 40px; }

/* ─── Section ────────────────────────────────────────────────────────────────── */
.section {}

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

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon { font-size: 14px; }

.section-action {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  transition: color var(--transition);
}

.section-action:hover { color: var(--text-secondary); }

/* ─── Grid ───────────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition);
  animation: cardIn 200ms ease both;
}

.card:hover {
  border-color: #3d4450;
  background: var(--bg-elevated);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.card.card--featured {
  border-color: var(--purple-dim);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(163,113,247,0.05) 100%);
  position: relative;
  overflow: hidden;
}

.card.card--featured::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--accent));
}

.card.card--featured:hover {
  border-color: rgba(163,113,247,0.4);
}

.card.hidden { display: none; }

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

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.card-cat {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Category badge colors */
.card-cat[data-cat="Browsers"]          { color: var(--accent);   background: var(--accent-dim);   border-color: var(--accent-border); }
.card-cat[data-cat="Drivers & Updates"] { color: var(--orange);   background: var(--orange-dim);   border-color: rgba(240,136,62,0.3); }
.card-cat[data-cat="Microsoft 365"]     { color: var(--purple);   background: var(--purple-dim);   border-color: rgba(163,113,247,0.3); }
.card-cat[data-cat="Productivity"]      { color: var(--success);  background: var(--success-dim);  border-color: rgba(63,185,80,0.3); }
.card-cat[data-cat="Remote Support"]    { color: var(--danger);   background: var(--danger-dim);   border-color: rgba(248,81,73,0.3); }
.card-cat[data-cat="Storage & Files"]   { color: var(--warning);  background: rgba(210,153,34,0.12); border-color: rgba(210,153,34,0.3); }
.card-cat[data-cat="Utilities"]         { color: #39c5cf;         background: rgba(57,197,207,0.1); border-color: rgba(57,197,207,0.3); }

.card-fav {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.card-fav:hover { color: var(--warning); }
.card-fav.is-fav { color: var(--warning); }
.card-fav.is-fav svg { fill: var(--warning); stroke: var(--warning); }

/* Card Body */
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

/* Shortcut */
.card-shortcut {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
}

.shortcut-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.shortcut-path {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  transition: all var(--transition);
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.btn-open:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88,166,255,0.35);
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-copy:hover {
  color: var(--text-primary);
  border-color: #3d4450;
  background: var(--bg-hover);
}

.btn-copy.copied {
  color: var(--success);
  border-color: rgba(63,185,80,0.3);
  background: var(--success-dim);
}

.btn-local {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--purple);
  background: var(--purple-dim);
  border: 1px solid rgba(163,113,247,0.3);
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-local:hover {
  background: rgba(163,113,247,0.2);
  border-color: rgba(163,113,247,0.5);
  transform: translateY(-1px);
}

/* ─── No Results ─────────────────────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.no-results-icon { font-size: 40px; margin-bottom: 12px; }
.no-results h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }
.no-results p  { font-size: 13px; margin-bottom: 20px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-full { width: 100%; justify-content: center; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toastIn 250ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-width: 320px;
}

.toast.toast--success { border-color: rgba(63,185,80,0.3); }
.toast.toast--error   { border-color: rgba(248,81,73,0.3); }

.toast-icon { font-size: 16px; flex-shrink: 0; }

.toast.leaving {
  animation: toastOut 200ms ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(20px) scale(0.95); }
}

/* ─── Login ──────────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(88,166,255,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(163,113,247,0.05) 0%, transparent 50%),
    var(--bg-base);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  animation: cardIn 300ms ease;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--danger-dim);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-input {
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
  width: 100%;
}

.field-input::placeholder { color: var(--text-muted); }

.field-input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main { padding: 0 16px 60px; }
  .hero { padding: 32px 0 24px; }
  .hero-title { font-size: 24px; }

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

  .header-inner { padding: 0 16px; }
  .brand-tag { display: none; }
  .header-count { display: none; }

  #toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .card-actions { flex-direction: column; }
  .btn-open { flex: none; }
  .filter-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .filter-scroll::-webkit-scrollbar { height: 3px; }
  .filter-scroll::-webkit-scrollbar-track { background: transparent; }
  .filter-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ─── Add Tool Button ────────────────────────────────────────────────────────── */
.btn-add-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.btn-add-tool:hover {
  background: rgba(88,166,255,0.2);
  border-color: rgba(88,166,255,0.5);
}

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: backdropIn 150ms ease;
}

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

.modal {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalIn 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.modal-form { display: contents; }

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Modal Form Fields ──────────────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.field-file {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-secondary);
}

.field-file::-webkit-file-upload-button {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  margin-right: 10px;
  transition: all var(--transition);
}

.field-file::-webkit-file-upload-button:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
  line-height: 1.4;
}

.field-hint code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}

.field-hint-inline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.field-required { color: var(--danger); margin-left: 2px; }

.form-checks {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.check-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.check-label:hover { color: var(--text-primary); }

/* ─── Ghost Button ───────────────────────────────────────────────────────────── */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ─── Utility ────────────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }
