/* Worksheets page styles */
.worksheets-wrapper {
  position: relative;
  min-height: auto; /* Changed from 100vh since page-wrapper handles this */
  padding: 0 20px 40px 20px;
}

.worksheets-container {
  max-width: 1000px; /* Limit width to center content and allow space for flowers */
  margin: 0 auto; /* Center the container */
  padding: 40px 20px; /* Add horizontal padding */
  min-height: calc(100vh - 40px);
}

.worksheets-header {
  text-align: center;
  margin-bottom: 40px;
}

.worksheets-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 30px auto;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.filter-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.child-filter-select {
  padding: 8px 12px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: white;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 150px;
}

.child-filter-select:hover {
  border-color: var(--primary-color);
}

.child-filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.1);
}

/* Responsive filter styling */
@media (max-width: 768px) {
  .worksheets-filters {
    margin: 20px 10px;
    padding: 15px;
    max-width: none;
  }
  
  .filter-group {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .filter-label {
    font-size: 0.9rem;
  }
  
  .child-filter-select {
    min-width: 120px;
    font-size: 0.9rem;
  }
}

.worksheets-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.worksheets-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.worksheets-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--overlay-subtle);
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--secondary-color);
  display: block;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 5px;
}

/* Table styles */
.worksheets-table-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--shadow-md);
  overflow: hidden;
  margin: 20px auto;
  max-width: 900px; /* Narrowed from none to allow space for moving flowers */
  width: 90%; /* Reduced from 100% to allow space for moving flowers */
}

.worksheets-table {
  width: 100%;
  border-collapse: collapse;
}

.table-header {
  background: var(--bg-cool);
  border-bottom: 2px solid var(--border-medium);
}

.table-header th {
  padding: 16px 20px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-row {
  border-bottom: 1px solid var(--border-medium);
  transition: background-color 0.2s;
}

.table-row:hover {
  background: var(--bg-cool);
}

.table-row:last-child {
  border-bottom: none;
}

.table-cell {
  padding: 16px 20px;
  vertical-align: middle;
}

.keyword-cell {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 1rem;
}

.keyword-bilingual {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.keyword-english {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
}

.keyword-chinese {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
}

.age-badge {
  background: #e0f2fe;
  color: #0277bd;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.child-name {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.no-child-name {
  color: var(--gray-400);
  font-style: italic;
  font-size: 0.875rem;
}

.preview-button {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.preview-button:hover {
  background: var(--gray-200);
  border-color: var(--gray-400);
}

.download-button {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.download-button:hover {
  background: var(--secondary-light);
  transform: translateY(-1px);
}

.delete-button {
  background: var(--error-hover);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-button:hover {
  background: var(--error-dark);
  transform: translateY(-1px);
}

/* Preview tooltip */
.preview-tooltip {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  box-shadow: 0 10px 25px var(--shadow-md);
  padding: 16px;
  z-index: 9999;
  pointer-events: all;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  width: auto;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.preview-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

/* Backdrop overlay */
.preview-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay-dark);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  cursor: pointer;
}

.preview-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

/* Close button */
.preview-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--overlay-subtle);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: all 0.2s;
  z-index: 10000;
}

.preview-close-btn:hover {
  background: var(--overlay-medium);
  color: #000;
}

.preview-image-worksheets {
  width: 300px !important;
  max-width: none !important;
  max-height: none !important;
  height: auto !important;
  border-radius: 4px;
  display: block !important;
}

.preview-loading {
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 0.875rem;
  background: var(--gray-50);
  border-radius: 4px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
}

.pagination-button {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  background: white;
  color: var(--gray-600);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.pagination-button:hover {
  background: var(--gray-100);
}

.pagination-button.active {
  background: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--gray-500);
  font-size: 0.875rem;
  margin: 0 16px;
}

/* Loading state */
.loading-spinner {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.loading-dots {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--gray-100);
  border-radius: 50%;
  border-top-color: var(--secondary-color);
  animation: spin 1s ease-in-out infinite;
  margin-right: 10px;
}

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
  background: white;
  border-radius: 12px;
  margin: 20px 0;
  box-shadow: 0 4px 20px var(--overlay-subtle);
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 20px;
  color: var(--gray-500);
}

.create-first-button {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.create-first-button:hover {
  background: var(--secondary-light);
  transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 768px) {
  .worksheets-wrapper {
    padding: 15px 15px 20px 15px;
  }
  
  .worksheets-container {
    padding: 80px 0 20px;
  }

  .worksheets-stats {
    flex-direction: column;
    gap: 15px;
  }

  .stat-card {
    padding: 15px 20px;
  }

  /* Stack table on mobile */
  .worksheets-table-container {
    overflow-x: auto;
    width: 95%; /* Use more width on mobile since flowers are less prominent */
    max-width: none; /* Remove max-width constraint on mobile */
  }

  .table-header {
    display: none;
  }

  .table-row {
    display: block;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 16px;
    background: white;
  }

  .table-cell {
    display: block;
    padding: 8px 0;
    border: none;
  }

  .table-cell::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--gray-600);
    display: inline-block;
    width: 100px;
  }

  .keyword-cell::before {
    content: "Keyword: ";
  }

  .age-cell::before {
    content: "Age: ";
  }

  .child-cell::before {
    content: "Child: ";
  }

  .preview-cell::before {
    content: "Preview: ";
  }

  .download-cell::before {
    content: "Download: ";
  }

  .actions-cell::before {
    content: "Actions: ";
  }
}

/* Notification styles */
.notification {
  position: fixed;
  top: 100px;
  right: 20px;
  background: white;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px var(--shadow-md);
  z-index: 1000;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  border-left: 4px solid var(--info-color);
  max-width: 400px;
  font-weight: 500;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification-success {
  border-left-color: var(--success-color);
  color: var(--success-dark);
}

.notification-error {
  border-left-color: var(--error-color);
  color: var(--error-text);
}

.notification-info {
  border-left-color: var(--info-color);
  color: var(--info-dark);
}
