/* bookmark.css — Styles for bookmark.html */

:root {
  --arabic-size: 2rem;
}

@font-face {
  font-family: 'Arabic';
  src: url('../fonts/OmarNaskh-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ─── Page header ─────────────────────────────────────────────────────────── */

.page-header {
  padding: 3rem 0 2rem;
  text-align: center;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.875rem, 1.65rem + 1.125vw, 2.25rem);
  color: #956D0E;
  margin-bottom: 1rem;
}

[data-theme="dark"] .page-title {
  color: #C5A55A;
}

.page-desc {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  color: #737373;
  max-width: 600px;
  margin: 0 auto;
}

[data-theme="dark"] .page-desc {
  color: #8a8a8a;
}

/* ─── Toolbar ─────────────────────────────────────────────────────────────── */

.toolbar {
  padding-top: 2rem;
}

.toolbar-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.toolbar-left {
  display: flex;
  gap: 1rem;
  align-items: center;
  width: 100%;
}

.toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* ─── Search ──────────────────────────────────────────────────────────────── */

.search-box {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem;
  padding-left: 40px;
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #ffffff;
  color: #111827;
}

[data-theme="dark"] .search-input {
  background: #171717;
  border-color: #262626;
  color: #E0E0E0;
}

.search-input:focus {
  outline: none;
  border-color: #956D0E;
}

[data-theme="dark"] .search-input:focus {
  border-color: #C5A55A;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: #737373;
  pointer-events: none;
}

[data-theme="dark"] .search-icon {
  fill: #8a8a8a;
}

/* ─── Toolbar select & buttons ────────────────────────────────────────────── */

.toolbar-select {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #ffffff;
  color: #111827;
}

[data-theme="dark"] .toolbar-select {
  background: #171717;
  border-color: #262626;
  color: #E0E0E0;
}

.toolbar-select:focus {
  outline: none;
  border-color: #956D0E;
}

[data-theme="dark"] .toolbar-select:focus {
  border-color: #C5A55A;
}

.toolbar-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0, 0, 0.2, 1);
  flex-shrink: 0;
}

[data-theme="dark"] .toolbar-btn {
  border-color: #262626;
  background: #171717;
  color: #d4d4d4;
}

.toolbar-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.toolbar-btn .btn-text {
  display: none;
}

@media (min-width: 640px) {
  .toolbar-btn {
    width: auto;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }
  .toolbar-btn .btn-text {
    display: inline;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    white-space: nowrap;
  }
}

.toolbar-btn:hover {
  border-color: #956D0E;
  color: #956D0E;
}

[data-theme="dark"] .toolbar-btn:hover {
  border-color: #C5A55A;
  color: #C5A55A;
}

.toolbar-btn-primary {
  background: #956D0E;
  color: #ffffff;
  border-color: #956D0E;
  font-weight: 700;
}

[data-theme="dark"] .toolbar-btn-primary {
  background: #C5A55A;
  color: #111827;
  border-color: #C5A55A;
}

.toolbar-btn-primary:hover {
  background: #7a5a0b;
  border-color: #7a5a0b;
  color: #ffffff;
}

[data-theme="dark"] .toolbar-btn-primary:hover {
  background: #c9a732;
  border-color: #c9a732;
  color: #111827;
}

.toolbar-btn-danger {
  color: #ef4444;
  border-color: #ef4444;
}

.toolbar-btn-danger:hover {
  border-color: #dc2626;
  color: #dc2626;
}

[data-theme="dark"] .toolbar-btn-danger {
  color: #f87171;
  border-color: #f87171;
}

[data-theme="dark"] .toolbar-btn-danger:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* ─── Filter tabs ─────────────────────────────────────────────────────────── */

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid #e5e5e5;
}

[data-theme="dark"] .filter-tabs {
  border-bottom-color: #2e2e2e;
}

.filter-tabs-left {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.filter-tabs-right {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.filter-tab {
  padding: 0.5rem 1rem;
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  font-weight: 400;
  background: none;
  border: none;
  color: #737373;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 200ms cubic-bezier(0, 0, 0.2, 1);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.filter-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

[data-theme="dark"] .filter-tab {
  color: #8a8a8a;
}

.filter-tab:hover {
  color: #956D0E;
}

[data-theme="dark"] .filter-tab:hover {
  color: #C5A55A;
}

.filter-tab.active {
  color: #956D0E;
  font-weight: 700;
  border-bottom-color: #956D0E;
}

[data-theme="dark"] .filter-tab.active {
  color: #C5A55A;
  border-bottom-color: #C5A55A;
}

/* ─── Bookmark list & cards ───────────────────────────────────────────────── */

.bookmark-list {
  display: flex;
  flex-direction: column;
  padding: 2rem 0;
}

.bookmark-card {
  padding: 2rem 0;
  border-top: 1px solid #e5e5e5;
  transition: all 200ms cubic-bezier(0, 0, 0.2, 1);
}

[data-theme="dark"] .bookmark-card {
  border-top-color: #2e2e2e;
}

.bookmark-card.pinned {
  border-color: #956D0E;
}

[data-theme="dark"] .bookmark-card.pinned {
  border-color: #C5A55A;
}

.bookmark-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.bookmark-ref {
  font-size: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);
  font-weight: 700;
  color: #956D0E;
}

[data-theme="dark"] .bookmark-ref {
  color: #C5A55A;
}

.bookmark-actions {
  display: flex;
  gap: 0.5rem;
}

.bookmark-action-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 200ms cubic-bezier(0, 0, 0.2, 1);
}

[data-theme="dark"] .bookmark-action-btn {
  border-color: #262626;
  background: #171717;
  color: #d4d4d4;
}

.bookmark-action-btn:hover {
  border-color: #956D0E;
  color: #956D0E;
}

[data-theme="dark"] .bookmark-action-btn:hover {
  border-color: #C5A55A;
  color: #C5A55A;
}

.bookmark-action-btn.pinned {
  border-color: #956D0E;
  color: #956D0E;
}

[data-theme="dark"] .bookmark-action-btn.pinned {
  border-color: #C5A55A;
  color: #C5A55A;
}

.bookmark-action-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ─── Bookmark content ────────────────────────────────────────────────────── */

.bookmark-arabic {
  font-family: 'Arabic', serif;
  font-size: 2rem;
  line-height: 1.75;
  color: #212121;
  margin-bottom: 1rem;
  direction: rtl;
  text-align: right;
}

[data-theme="dark"] .bookmark-arabic {
  color: #ebebeb;
}

.bookmark-trans {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  color: #404040;
  line-height: 1.5;
  margin-bottom: 1rem;
}

[data-theme="dark"] .bookmark-trans {
  color: #a3a3a3;
}

.bookmark-latin {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  color: #956D0E;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .bookmark-latin {
  color: #C5A55A;
}

/* ─── Bookmark meta ───────────────────────────────────────────────────────── */

.bookmark-meta-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.bookmark-collection {
  display: inline-flex;
  align-items: center;
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  color: #737373;
}

[data-theme="dark"] .bookmark-collection {
  color: #8a8a8a;
}

.bookmark-collection svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  padding-right: 6px;
}

.bookmark-note-text {
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  color: #737373;
}

[data-theme="dark"] .bookmark-note-text {
  color: #8a8a8a;
}

.bookmark-note-text strong {
  font-weight: 600;
  color: #212121;
}

[data-theme="dark"] .bookmark-note-text strong {
  color: #ebebeb;
}

.bookmark-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  color: #737373;
}

[data-theme="dark"] .bookmark-meta {
  color: #8a8a8a;
}

.bookmark-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #737373;
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
}

[data-theme="dark"] .bookmark-time {
  color: #8a8a8a;
}

.bookmark-time svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ─── Empty state ─────────────────────────────────────────────────────────── */

.empty-subtitle {
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  font-weight: 600;
  color: #212121;
  margin-bottom: 1rem;
}

[data-theme="dark"] .empty-subtitle {
  color: #ebebeb;
}

.empty-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.empty-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: clamp(0.8125rem, 0.775rem + 0.1875vw, 0.875rem);
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 2rem;
  background: #ffffff;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0, 0, 0.2, 1);
}

[data-theme="dark"] .empty-chip {
  border-color: #262626;
  background: #171717;
  color: #d4d4d4;
}

.empty-chip:hover {
  border-color: #956D0E;
  color: #956D0E;
  background: #fefce8;
}

[data-theme="dark"] .empty-chip:hover {
  border-color: #C5A55A;
  color: #C5A55A;
  background: #1c1a0a;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  width: 64px;
  height: 64px;
  fill: #737373;
  margin: 0 auto 1.5rem;
  opacity: 0.5;
}

[data-theme="dark"] .empty-icon {
  fill: #8a8a8a;
}

.empty-title {
  font-size: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  font-weight: 700;
  color: #212121;
  margin-bottom: 1rem;
}

[data-theme="dark"] .empty-title {
  color: #ebebeb;
}

.empty-desc {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  color: #737373;
  margin-bottom: 2rem;
}

[data-theme="dark"] .empty-desc {
  color: #8a8a8a;
}

.empty-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: clamp(0.8125rem, 0.775rem + 0.1875vw, 0.875rem);
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #ffffff;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0, 0, 0.2, 1);
}

[data-theme="dark"] .empty-action {
  border-color: #262626;
  background: #171717;
  color: #d4d4d4;
}

.empty-action:hover {
  border-color: #956D0E;
  color: #956D0E;
}

[data-theme="dark"] .empty-action:hover {
  border-color: #C5A55A;
  color: #C5A55A;
}

/* ─── Skeleton ────────────────────────────────────────────────────────────── */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.15; }
}

.skeleton-card {
  padding: 2rem 0;
  border-top: 1px solid #e5e5e5;
}

[data-theme="dark"] .skeleton-card {
  border-top-color: #2e2e2e;
}

.skeleton-line {
  background: #d4d4d4;
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

[data-theme="dark"] .skeleton-line {
  background: #333;
}

.skeleton-short  { width: 35%; height: 0.875rem; }
.skeleton-medium { width: 60%; height: 0.875rem; }
.skeleton-long   { width: 85%; height: 0.875rem; }
.skeleton-full   { width: 100%; }

/* ─── Edit modal ──────────────────────────────────────────────────────────── */

.edit-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  padding: 1.5rem;
  align-items: center;
  justify-content: center;
}

.edit-modal.active {
  display: flex;
}

.edit-modal-content {
  background: #ffffff;
  border-radius: 0.5rem;
  max-width: 500px;
  width: 100%;
  padding: 2rem;
}

[data-theme="dark"] .edit-modal-content {
  background: #1A1a1a;
}

.edit-modal-title {
  font-size: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  font-weight: 700;
  color: #212121;
  margin-bottom: 1.5rem;
}

[data-theme="dark"] .edit-modal-title {
  color: #ebebeb;
}

.edit-modal-field {
  margin-bottom: 1rem;
}

.edit-modal-field:last-of-type {
  margin-bottom: 1.5rem;
}

.edit-modal-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #212121;
}

[data-theme="dark"] .edit-modal-label {
  color: #ebebeb;
}

.edit-modal-hint {
  font-size: 0.875rem;
  color: #737373;
  margin-top: 0.5rem;
}

[data-theme="dark"] .edit-modal-hint {
  color: #8a8a8a;
}

.edit-modal-textarea {
  width: 100%;
  min-height: 120px;
  padding: 1rem;
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  font-family: inherit;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #ffffff;
  color: #111827;
  resize: vertical;
}

[data-theme="dark"] .edit-modal-textarea {
  background: #171717;
  border-color: #262626;
  color: #E0E0E0;
}

.edit-modal-textarea:focus {
  outline: none;
  border-color: #956D0E;
}

[data-theme="dark"] .edit-modal-textarea:focus {
  border-color: #C5A55A;
}

.edit-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.edit-modal-actions .toolbar-btn {
  width: auto;
  height: auto;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
}

.edit-modal-actions .toolbar-btn svg {
  display: none;
}

/* ─── Storage notice ──────────────────────────────────────────────────────── */

.storage-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: #92400e;
  line-height: 1.5;
}

[data-theme="dark"] .storage-notice {
  background: #1c1a0a;
  border-color: #3d2e0a;
  color: #C5A55A;
}

.storage-notice svg {
  flex-shrink: 0;
  fill: currentColor;
}

.storage-notice span {
  flex: 1;
}

.storage-notice strong {
  font-weight: 700;
}

.storage-notice-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
}

.storage-notice-close:hover {
  opacity: 1;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .filter-label {
    display: none;
  }
  .filter-icon {
    width: 18px;
    height: 18px;
  }
  .filter-tabs {
    overflow-x: auto;
  }
  .toolbar-row {
    flex-direction: column;
    gap: 1rem;
  }
  .toolbar-left {
    flex-wrap: wrap;
  }
  .toolbar-select {
    flex: 1;
    min-width: calc(50% - 0.5rem);
  }
  .search-box {
    flex: 1 1 100%;
    width: 100%;
  }
  .search-input {
    height: 44px;
  }
  .bookmark-ref {
    flex-direction: column;
    align-items: flex-start;
  }
  .edit-modal-actions {
    width: 100%;
  }
  .edit-modal-actions .toolbar-btn {
    flex: 1;
  }
}
