/* Catch Up Modal Styles */

/* Modal overlay - ensure proper display */
#catch-up-modal.modal-overlay {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

/* Modal content container */
#catch-up-modal .modal-content {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  width: 100%;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal header */
#catch-up-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 1rem 1rem 0 0;
}

#catch-up-modal .modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

#catch-up-modal .modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#catch-up-modal .mark-all-seen-btn {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

#catch-up-modal .mark-all-seen-btn:hover:not(:disabled) {
  background-color: #2563eb;
}

#catch-up-modal .mark-all-seen-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

#catch-up-modal .close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s, color 0.2s;
  line-height: 1;
}

#catch-up-modal .close-btn:hover {
  background-color: #f3f4f6;
  color: #111827;
}

/* Modal specific styles */
.catch-up-modal {
  max-width: 800px;
}

.catch-up-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0.25rem 0 0 0;
}

.catch-up-total-count {
  font-weight: 600;
  color: #3b82f6;
}

/* Content Area */
.catch-up-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Modules List */
.catch-up-modules {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Module Section */
.module-section {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  background-color: #ffffff;
  transition: box-shadow 0.2s;
}

.module-section:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Module Header */
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.module-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.module-icon {
  font-size: 1.5rem;
}

.module-title h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.module-count {
  color: #3b82f6;
  font-weight: 600;
  font-size: 0.875rem;
}

.view-all-link {
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}

.view-all-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* Last Checked */
.module-last-checked {
  color: #6b7280;
  font-size: 0.8125rem;
  margin: 0 0 1rem 0;
}

/* Module Preview */
.module-preview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Preview Item */
.preview-item {
  display: flex;
  gap: 0.75rem;
  padding-left: 0.5rem;
}

/* Clickable Preview Item (for comments linking to stories) */
a.preview-item-link {
  text-decoration: none;
  color: inherit;
  border-radius: 0.375rem;
  padding: 0.5rem;
  margin: -0.5rem -0.5rem -0.5rem 0;
  transition: background-color 0.15s ease;
}

a.preview-item-link:hover {
  background-color: #f3f4f6;
}

a.preview-item-link:hover .preview-title {
  color: #3b82f6;
}

a.preview-item-link:hover .preview-bullet {
  color: #3b82f6;
}

.preview-bullet {
  color: #9ca3af;
  font-size: 1.25rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.preview-content {
  flex: 1;
  min-width: 0;
}

.preview-title {
  font-size: 0.9375rem;
  color: #111827;
  margin: 0 0 0.25rem 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-subtitle {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-state p {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}

/* Error State */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.error-state p {
  color: #dc2626;
  font-size: 0.875rem;
  margin: 0 0 1rem 0;
}

.error-state button {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.error-state button:hover {
  background-color: #2563eb;
}

/* Empty State - "All caught up" */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0f9ff 100%);
  border-radius: 1rem;
  margin: 1rem;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #059669;
  margin: 0 0 0.75rem 0;
}

.empty-state p {
  color: #374151;
  font-size: 1rem;
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

.empty-subtitle {
  color: #6b7280 !important;
  font-size: 0.875rem !important;
  margin-top: 0.5rem !important;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .catch-up-modal {
    max-width: 100%;
    max-height: 90vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .modal-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .modal-actions {
    width: 100%;
    justify-content: space-between;
  }

  .catch-up-content {
    padding: 1rem;
  }

  .module-section {
    padding: 1rem;
  }

  .module-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .view-all-link {
    align-self: flex-start;
  }

  .preview-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* Scrollbar Styling */
.catch-up-content::-webkit-scrollbar {
  width: 8px;
}

.catch-up-content::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.catch-up-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.catch-up-content::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Animation for module sections */
.module-section {
  animation: fadeInUp 0.3s ease;
}

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