/* Bible App Search Styles */

/* Search Toggle Button */
.search-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #8b1a2e;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  z-index: 100;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-toggle:hover {
  transform: scale(1.1);
  background: #6b1222;
}

.search-toggle svg {
  fill: currentColor;
}

/* Search Panel */
.search-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: #fdf6ed;
  box-shadow: -2px 0 5px rgba(0,0,0,0.1);
  z-index: 1000;
  border-right: 6px solid transparent;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-panel.open {
  right: 40px;
  border-right-color: #8b1a2e;
}

/* Search Tab styles moved to tabs.css */

/* Search Header */
.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #8b1a2e;
  color: white;
  flex-shrink: 0;
}

.search-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
}

.search-close {
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.search-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Search Mode Toggle - Tab Navigation */
.search-mode-toggle {
  display: flex;
  border-bottom: 2px solid #e4d0b8;
  background: #f5ede0;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

.search-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border: none;
  background: none;
  color: #a08060;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.search-mode-btn:hover {
  color: #8b1a2e;
}

.search-mode-btn.active {
  background: #fdf6ed;
  color: #8b1a2e;
  font-weight: 600;
  margin-bottom: -2px;
  border-bottom: 2px solid #fdf6ed;
}

.search-mode-btn:focus {
  outline: none;
}

.search-mode-btn svg {
  flex-shrink: 0;
}

/* Search Form */
.search-form {
  padding: 20px;
  border-bottom: 1px solid #e4d0b8;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #e4d0b8;
  border-radius: 4px;
  margin-bottom: 15px;
  transition: border-color 0.2s;
  background: #fdf6ed;
  color: #2d1b0e;
}

.search-input:focus {
  outline: none;
  border-color: #8b1a2e;
}

.search-scope {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-scope label {
  font-weight: 500;
  color: #8a6a4a;
  white-space: nowrap;
}

.search-scope-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e4d0b8;
  border-radius: 4px;
  background: #fdf6ed;
  color: #2d1b0e;
  font-size: 14px;
  cursor: pointer;
}

.search-scope-select:focus {
  outline: none;
  border-color: #8b1a2e;
}

/* Search Results */
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f5ede0;
}

.search-status {
  text-align: center;
  color: #8a6a4a;
  margin-bottom: 20px;
  font-size: 14px;
}

.search-results-list {
  margin-bottom: 20px;
}

.search-result-item {
  margin-bottom: 16px;
  padding: 16px;
  background: #fdf6ed;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #e4d0b8;
}

.search-result-item:hover {
  background: #f5ede0;
  box-shadow: 0 2px 4px rgba(45,27,14,0.1);
  transform: translateY(-1px);
}

.search-result-ref {
  font-weight: bold;
  color: #8b1a2e;
  margin-bottom: 8px;
  font-size: 16px;
}

.search-result-text {
  color: #2d1b0e;
  line-height: 1.5;
  font-size: 14px;
}

.search-match-info {
  margin-top: 8px;
  font-size: 12px;
  color: #8a6a4a;
}

.search-highlight {
  background: #f5c842;
  padding: 2px 4px;
  border-radius: 2px;
  font-weight: 500;
}

/* Pagination */
.search-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding: 20px 0;
}

.page-btn {
  padding: 8px 12px;
  border: 1px solid #e4d0b8;
  background: #fdf6ed;
  color: #2d1b0e;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 36px;
}

.page-btn:hover:not(:disabled) {
  background: #f5ede0;
  border-color: #8b1a2e;
}

.page-btn.active {
  background: #8b1a2e;
  color: white;
  border-color: #8b1a2e;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search-pagination span {
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: #8a6a4a;
}

/* Loading State */
.search-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px;
}

.search-loading::after {
  content: '';
  width: 30px;
  height: 30px;
  border: 3px solid #e4d0b8;
  border-top: 3px solid #8b1a2e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .search-panel {
    width: 100%;
    right: -100%;
  }

  .search-panel.open {
    right: 0;
  }

  .search-toggle {
    width: 40px;
    height: 40px;
    top: 10px;
    right: 10px;
  }

  .search-header {
    padding: 16px;
  }

  .search-form {
    padding: 16px;
  }

  .search-results {
    padding: 16px;
  }

  .search-result-item {
    padding: 12px;
    margin-bottom: 12px;
  }

  .search-tab {
    padding: 10px 6px;
    font-size: 14px;
  }
}

/* Dark Mode Support */
[data-theme="dark"] .search-panel {
  background: var(--bg-primary, #1c0f07);
  box-shadow: -2px 0 5px rgba(0,0,0,0.4);
}

[data-theme="dark"] .search-header {
  background: #6b1222;
}

[data-theme="dark"] .search-header h2 {
  color: white;
}

[data-theme="dark"] .search-close {
  color: white;
}

[data-theme="dark"] .search-form {
  border-color: var(--border-color, #3d2010);
}

[data-theme="dark"] .search-mode-toggle {
  background: #200d05;
  border-bottom-color: #3d2010;
}

[data-theme="dark"] .search-mode-btn {
  background: none;
  color: #d4b896;
}

[data-theme="dark"] .search-mode-btn:hover {
  color: #d4915a;
}

[data-theme="dark"] .search-mode-btn.active {
  background: var(--bg-primary, #1c0f07);
  color: #d4915a;
  font-weight: 600;
  margin-bottom: -2px;
  border-bottom: 2px solid var(--bg-primary, #1c0f07);
}

[data-theme="dark"] .search-input {
  background: var(--bg-secondary, #2a1508);
  border-color: var(--border-color, #3d2010);
  color: var(--text-primary, #f5e6d0);
}

[data-theme="dark"] .search-input:focus {
  border-color: var(--link-color, #d4915a);
}

[data-theme="dark"] .search-scope label {
  color: var(--text-secondary, #d4b896);
}

[data-theme="dark"] .search-scope-select {
  background: var(--bg-secondary, #2a1508);
  border-color: var(--border-color, #3d2010);
  color: var(--text-primary, #f5e6d0);
}

[data-theme="dark"] .search-results {
  background: var(--bg-secondary, #2a1508);
}

[data-theme="dark"] .search-status {
  color: var(--text-secondary, #d4b896);
}

[data-theme="dark"] .search-result-item {
  background: var(--bg-primary, #1c0f07);
  border-color: var(--border-color, #3d2010);
}

[data-theme="dark"] .search-result-item:hover {
  background: var(--bg-secondary, #2a1508);
}

[data-theme="dark"] .search-result-ref {
  color: var(--link-color, #d4915a);
}

[data-theme="dark"] .search-result-text {
  color: var(--text-primary, #f5e6d0);
}

[data-theme="dark"] .search-match-info {
  color: var(--text-muted, #a08060);
}

[data-theme="dark"] .search-highlight {
  background: var(--highlight-bg, #c87520);
  color: var(--highlight-text, #000);
}

[data-theme="dark"] .page-btn {
  background: var(--bg-secondary, #2a1508);
  border-color: var(--border-color, #3d2010);
  color: var(--text-primary, #f5e6d0);
}

[data-theme="dark"] .page-btn:hover:not(:disabled) {
  background: var(--bg-primary, #1c0f07);
  border-color: var(--link-color, #d4915a);
}

[data-theme="dark"] .page-btn.active {
  background: #7a1628;
  border-color: #7a1628;
  color: #f5e6d0;
}

[data-theme="dark"] .search-error {
  background: rgba(198, 40, 40, 0.2);
  color: #ef5350;
}

[data-theme="dark"] .no-results {
  color: var(--text-secondary, #d4b896);
}

[data-theme="dark"] .relevance-bar {
  background: var(--border-color, #3d2010);
}

/* Accessibility */
.search-panel:focus-within {
  outline: none;
}

.search-input:focus,
.search-scope-select:focus,
.page-btn:focus {
  outline: 2px solid #8b1a2e;
  outline-offset: 2px;
}

/* Smooth Scrolling */
.search-results {
  scroll-behavior: smooth;
}

/* No Results State */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #8a6a4a;
}

.no-results p {
  margin: 10px 0;
}

/* Error State */
.search-error {
  background: #ffebee;
  color: #c62828;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
}

.retry-btn {
  margin-left: 8px;
  padding: 4px 12px;
  background: #c62828;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.retry-btn:hover {
  background: #b71c1c;
}

/* AI Search Result Styles */
.search-result-item.ai-result .search-match-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-result-item.ai-result .search-match-info::before {
  content: '✨';
}

.relevance-bar {
  flex: 1;
  max-width: 100px;
  height: 6px;
  background: #e4d0b8;
  border-radius: 3px;
  overflow: hidden;
}

.relevance-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* AI Badge — intentionally kept purple/indigo as distinct AI indicator */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
