/* Custom styles to complement Tailwind CSS */

/* Auth loading and transition styles */
.auth-content {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.auth-content.loaded {
  opacity: 1;
}

/* Initially hide auth-dependent elements */
#authButtons,
#userInfo,
#nicheSection,
#navigationLinks {
  visibility: hidden;
  transition: visibility 0s 0.3s, opacity 0.3s ease-in-out;
  opacity: 0;
}

/* Show elements when auth is loaded */
.auth-loaded #authButtons,
.auth-loaded #userInfo,
.auth-loaded #nicheSection,
.auth-loaded #navigationLinks {
  visibility: visible;
  transition: opacity 0.3s ease-in-out;
  opacity: 1;
}

/* Ensure proper scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Custom drop zone active state */
.drop-zone.active {
  border-color: #3b82f6 !important;
  background-color: #eff6ff !important;
}

/* Enhanced content formatting for results */
.results-content {
  line-height: 1.8;
}

.content-section {
  margin-bottom: 2rem;
}

.content-header {
  color: #1e40af;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e7ff;
}

.content-header:first-child {
  margin-top: 0;
  color: #1f2937;
  font-size: 1.75rem;
}

.section-content {
  margin-bottom: 1.5rem;
}

.numbered-item {
  margin: 1rem 0;
  padding-left: 2rem;
  position: relative;
  line-height: 1.6;
  color: #374151;
}

.numbered-item .number {
  position: absolute;
  left: 0;
  font-weight: 600;
  color: #1e40af;
}

.bullet-item {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
  color: #4b5563;
  line-height: 1.6;
}

.blog-idea-item {
  position: relative;
  padding-right: 140px;
  min-height: 45px;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 1rem 0;
  transition: all 0.3s ease;
}

.blog-idea-item:hover {
  background: #f1f5f9;
  border-color: #3b82f6;
}

.select-blog-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.select-blog-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.15);
}

.select-blog-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.sub-bullet {
  margin: 0.5rem 0 0.5rem 2.5rem;
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Enhanced formatting styles for robust AI output handling */
.numbered-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
}

.section-number {
  font-weight: 700;
  color: #1e40af;
  font-size: 1.1rem;
  margin-right: 0.5rem;
}

.section-title {
  font-weight: 600;
  color: #1f2937;
  font-size: 1.1rem;
}

.sub-item {
  margin: 0.75rem 0 0.75rem 1.5rem;
  padding: 0.5rem 0.75rem;
  color: #4b5563;
  font-size: 0.95rem;
  background: #ffffff;
  border-radius: 6px;
  border-left: 3px solid #e5e7eb;
}

.quoted-content {
  margin: 1rem 0;
  padding: 1rem 1.5rem;
  background: #f1f5f9;
  border-radius: 8px;
  border-left: 4px solid #64748b;
  font-style: italic;
  color: #475569;
}

.content-paragraph {
  margin: 0.75rem 0;
  color: #374151;
  line-height: 1.6;
}

.hashtag {
  color: #3b82f6;
  font-weight: 500;
}

.emoji {
  font-size: 1.1em;
}

.error-message {
  color: #ef4444;
  background: #fee2e2;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #fecaca;
  margin: 1rem 0;
}

/* Status message styling */
.status-message {
  border-radius: 0.75rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.status-message.show {
  transform: translateY(0) !important;
}

.status-message.success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.status-message.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.status-message.info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.status-message.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* History item styling */
.history-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  transition: all 0.3s ease;
}

.history-item:hover {
  background: #f1f5f9;
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.history-item-date {
  font-size: 0.875rem;
  color: #6b7280;
}

.history-item-preview {
  color: #374151;
  cursor: pointer;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-preview:hover {
  color: #1e40af;
}

.delete-item-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-item-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Ensure proper styling for results content */
.results-content strong {
  color: #1f2937;
  font-weight: 600;
}

.results-content h3 {
  color: #1e40af;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .blog-idea-item {
    padding-right: 1rem;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 3rem;
  }
  
  .select-blog-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    top: auto;
    transform: none;
  }
}

/* Add smooth animations */
.transition-all {
  transition: all 0.3s ease;
}

/* Custom spinner for generate button */
.spinner.hidden {
  display: none !important;
}

.spinner:not(.hidden) {
  display: inline-flex !important;
  align-items: center;
}

/* Ensure proper prose styling for results */
.prose {
  max-width: none;
}

.prose h3 {
  color: #1e40af;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.prose strong {
  color: #1f2937;
  font-weight: 600;
}

.prose p {
  color: #374151;
  line-height: 1.6;
}

/* Empty state styling */
.empty-state {
  text-align: center;
  color: #9ca3af;
  padding: 2rem;
  font-style: italic;
}

/* Niche Management Page Styles */
.niche-card {
  transition: all 0.3s ease;
}

.niche-card:hover {
  transform: translateY(-2px);
}

.niche-card.selected {
  border-color: #3b82f6 !important;
  background-color: #eff6ff !important;
}

.niche-list-item {
  transition: all 0.3s ease;
}

.niche-list-item:hover {
  transform: translateX(4px);
}

.niche-list-item.selected {
  border-color: #3b82f6 !important;
  background-color: #eff6ff !important;
}

.template-card {
  transition: all 0.3s ease;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.template-card.selected {
  border-color: #3b82f6 !important;
  background-color: #eff6ff !important;
}

/* Bulk actions bar styling */
#bulkActionsBar {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Checkbox styling */
.niche-checkbox {
  cursor: pointer;
}

.niche-checkbox:checked {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

/* Modal improvements */
#nicheModal {
  backdrop-filter: blur(4px);
}

#confirmModal {
  backdrop-filter: blur(4px);
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
  .niche-card {
    margin-bottom: 1rem;
  }
  
  .niche-list-item {
    padding: 1rem;
  }
  
  .template-card {
    margin-bottom: 0.5rem;
  }
}

/* Line clamp for descriptions */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Stats cards hover effect */
.stats-card {
  transition: all 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Navigation active state */
.nav-active {
  background-color: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

/* Search input styling */
#searchInput:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Sort select styling */
#sortSelect:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* View toggle buttons */
.view-toggle-btn {
  transition: all 0.2s ease;
}

.view-toggle-btn.active {
  background-color: #3b82f6;
  color: white;
}

.view-toggle-btn:not(.active) {
  background-color: white;
  color: #6b7280;
}

.view-toggle-btn:not(.active):hover {
  background-color: #f9fafb;
}

/* Enhanced button styling */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  transform: translateY(-1px);
}

/* Loading state for buttons */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}