/* Bible App Search Styles */

/* Search Toggle Button */
.search-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1976d2;
  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: #1976D2;
}

.search-toggle svg {
  fill: currentColor;
}

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

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

/* Search Tab */
.search-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: var(--link-color, #1976d2);
  color: white;
  padding: 12px 8px;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  box-shadow: -2px 0 5px rgba(0,0,0,0.1);
  z-index: 999;
  transition: padding 0.3s ease, background 0.3s ease;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.search-tab:hover {
  padding-left: 16px;
  background: var(--link-hover, #1565c0);
}

.search-tab svg {
  fill: currentColor;
  transform: rotate(90deg);
}

/* Search Header */
.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #f5f5f5;
}

.search-header h2 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

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

.search-close:hover {
  background: rgba(0,0,0,0.05);
}

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

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

.search-input:focus {
  outline: none;
  border-color: #1976d2;
}

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

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

.search-scope-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: white;
  font-size: 14px;
  cursor: pointer;
}

.search-scope-select:focus {
  outline: none;
  border-color: #1976d2;
}

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

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

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

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

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

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

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

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

.search-highlight {
  background: #fdd835;
  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 #e0e0e0;
  background: white;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 36px;
}

.page-btn:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #1976d2;
}

.page-btn.active {
  background: #1976d2;
  color: white;
  border-color: #1976d2;
}

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

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

/* 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 #f3f3f3;
  border-top: 3px solid #2196F3;
  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 (Future) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles here when implemented */
}

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

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

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

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

.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;
}