/* LinkVault — Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.dark {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
  color: #fff;
  padding: 2rem 1rem;
  text-align: center;
}
.app-header h1 { font-size: 2rem; font-weight: 900; }
.app-header p { color: #c7d2fe; font-size: 0.95rem; margin-top: 0.25rem; }

/* Search Bar */
.search-container {
  max-width: 800px;
  margin: -1.5rem auto 0;
  padding: 0 1rem;
  position: relative;
  z-index: 10;
}
.search-box {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  border-radius: 1rem;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
  outline: none;
}
.search-box:focus { border-color: var(--primary); }
.search-icon {
  position: absolute;
  right: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
  pointer-events: none;
}

/* Toolbar */
.toolbar {
  max-width: 800px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}
.toolbar-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }

/* Category Filter Pills */
.category-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pill {
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.pill:hover, .pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Bookmarks Grid */
.bookmarks-grid {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .bookmarks-grid { grid-template-columns: 1fr 1fr; }
}

/* Bookmark Card */
.bookmark-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}
.bookmark-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
}
.bookmark-card .favicon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  background: #f1f5f9;
  padding: 2px;
}
.bookmark-card .title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  display: block;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.bookmark-card .title:hover { color: var(--primary); }
.bookmark-card .url {
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
  direction: ltr;
}
.bookmark-card .desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.5;
}
.bookmark-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.bookmark-card .tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: #eef2ff;
  color: #4338ca;
}
.dark .bookmark-card .tag {
  background: #312e81;
  color: #a5b4fc;
}
.bookmark-card .card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.bookmark-card .star-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.bookmark-card .star-btn:hover,
.bookmark-card .star-btn.active { opacity: 1; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card);
  border-radius: 1.25rem;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h2 { font-size: 1.3rem; font-weight: 900; margin-bottom: 1.25rem; }
.modal label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.modal input, .modal textarea, .modal select {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.modal input:focus, .modal textarea:focus, .modal select:focus {
  border-color: var(--primary);
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* Stats Bar */
.stats-bar {
  max-width: 800px;
  margin: 0 auto 1rem;
  padding: 0 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.stat-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.stat-chip .num {
  font-weight: 900;
  color: var(--primary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.9rem; }

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.4s ease both; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
