/* ===== Navigation Page Styles ===== */

/* Top Navigation */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-600);
  font-weight: 700;
  font-size: 20px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 24px;
  height: 24px;
}

.nav-brand:hover {
  color: var(--primary-700);
}

.nav-search {
  flex: 1;
  max-width: 560px;
}

/* ===== Search Section (centered, below announcement) ===== */
.search-section {
  display: flex;
  justify-content: center;
  padding-top: 32px;
  padding-bottom: 24px;
}

.search-box {
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
}

.search-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.10), var(--shadow-lg);
}

/* Engine Tabs Bar */
.search-engine-bar {
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
}

.search-engine-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}

.search-engine-tab i {
  width: 14px;
  height: 14px;
}

.engine-favicon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.search-engine-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.search-engine-tab.active {
  color: var(--primary-600);
  background: var(--bg-input);
}

.search-engine-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--primary-500);
  border-radius: 2px 2px 0 0;
}

/* Search Input Area */
.search-input-area {
  display: flex;
  align-items: center;
  padding: 4px 6px 6px 6px;
  gap: 4px;
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  margin-left: 8px;
  flex-shrink: 0;
  pointer-events: none;
}

.search-input {
  flex: 1;
  padding: 10px 4px;
  border: none;
  font-size: 15px;
  color: var(--text-primary);
  background: transparent;
  outline: none;
  min-width: 0;
}

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

.search-clear {
  padding: 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.search-clear i {
  width: 16px;
  height: 16px;
}

/* Search Submit Button */
.search-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  background: var(--primary-500);
  color: var(--text-inverse);
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.search-submit-btn:hover {
  background: var(--primary-600);
  box-shadow: var(--shadow-md);
}

.search-submit-btn i {
  width: 16px;
  height: 16px;
}

.search-submit-text {
  line-height: 1;
}

/* ===== Search Results Modal ===== */
.search-results-modal {
  max-width: 720px;
  width: 92%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

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

.search-results-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-results-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.search-results-body .card-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.search-results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted);
  text-align: center;
}

.search-results-empty i {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.search-results-empty p {
  font-size: 14px;
}

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

.nav-user {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
}

.user-info {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.user-menu-item i {
  width: 16px;
  height: 16px;
}

.user-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Announcement */
.announcement-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-top: 12px;
  background: var(--primary-100);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--primary-700);
}

.announcement-bar i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  padding-top: 16px;
  padding-bottom: 40px;
  min-height: calc(100vh - 64px - 60px);
}

/* Section */
.section {
  margin-bottom: 32px;
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-title i {
  width: 20px;
  height: 20px;
  color: var(--primary-500);
}

.section-toggle {
  cursor: pointer;
  user-select: none;
}

.section-toggle i {
  width: 18px;
  height: 18px;
  transition: transform var(--transition);
}

.section-toggle.collapsed i {
  transform: rotate(-90deg);
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.category-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.category-tab i {
  width: 14px;
  height: 14px;
}

.category-tab:hover {
  border-color: var(--primary-300);
  color: var(--primary-600);
}

.category-tab.active {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: var(--text-inverse);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* Site Card */
.site-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.site-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.site-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-50);
  color: var(--primary-500);
}

.site-card-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.site-card-icon i {
  width: 20px;
  height: 20px;
}

.site-card-body {
  flex: 1;
  min-width: 0;
}

.site-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.site-card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  transition: all var(--transition);
  opacity: 0;
}

.site-card:hover .site-card-fav {
  opacity: 1;
}

.site-card-fav:hover {
  color: var(--primary-500);
  background: var(--primary-50);
}

.site-card-fav i {
  width: 16px;
  height: 16px;
}

.site-card-fav.active {
  opacity: 1;
  color: var(--primary-500);
}

.site-card-fav.active i {
  fill: var(--primary-500);
}

/* Search highlight */
.highlight {
  background: var(--primary-200);
  color: var(--primary-800);
  border-radius: 2px;
  padding: 0 2px;
}

/* Empty & Loading States */
.empty-state,
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.loading-state {
  padding: 40px;
}

.loading-state p {
  margin-top: 12px;
  font-size: 14px;
}

/* Footer */
.footer {
  padding: 16px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

/* Passphrase Modal */
.passphrase-modal {
  text-align: center;
  padding: 40px 32px;
  max-width: 400px;
}

.passphrase-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--primary-600);
}

.passphrase-icon i {
  width: 28px;
  height: 28px;
}

.passphrase-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.passphrase-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.passphrase-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.passphrase-input-wrap i {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.passphrase-input {
  padding-left: 40px;
  text-align: center;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.passphrase-submit {
  width: 100%;
  margin-top: 16px;
  justify-content: center;
}

.passphrase-footer {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.passphrase-footer a {
  color: var(--primary-600);
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-inner {
    height: 56px;
    gap: 8px;
  }

  .nav-brand-text {
    display: none;
  }

  .nav-search {
    max-width: none;
  }

  .search-section {
    padding-top: 20px;
    padding-bottom: 16px;
  }

  .search-engine-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .search-engine-bar::-webkit-scrollbar {
    display: none;
  }

  .search-engine-tab {
    flex-shrink: 0;
  }

  .search-submit-text {
    display: none;
  }

  .search-submit-btn {
    padding: 8px 12px;
  }

  .search-results-modal {
    width: 96%;
    max-height: 85vh;
  }

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

  .site-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 10px;
  }

  .site-card-icon {
    width: 40px;
    height: 40px;
  }

  .site-card-fav {
    opacity: 1;
  }

  .category-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .category-tab {
    flex-shrink: 0;
  }
}
