.odw-topic,
.odw-offer {
  border: 1px solid #ddd;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 4px;
  background-color: #fafafa;
}

/* Topic cards with optional image (API returns image_url) */
.on-demand-topic-card {
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 6px;
  width: 260px;
}

.on-demand-topic-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 10px;
}

/* Topics grid: columns controlled by admin setting (higher specificity so theme cannot override) */
.odw-topics .on-demand-topics-grid {
  display: grid;
  gap: 20px;
}

.odw-topics .on-demand-topics-grid.columns-1 {
  grid-template-columns: 1fr !important;
}

.odw-topics .on-demand-topics-grid.columns-2 {
  grid-template-columns: repeat(2, 1fr) !important;
}

.odw-topics .on-demand-topics-grid.columns-3 {
  grid-template-columns: repeat(3, 1fr) !important;
}

.odw-topics .on-demand-topics-grid.columns-4 {
  grid-template-columns: repeat(4, 1fr) !important;
}

.odw-topics .on-demand-topics-grid .on-demand-topic-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Single column on small screens only */
@media (max-width: 768px) {
  .odw-topics .on-demand-topics-grid.columns-1,
  .odw-topics .on-demand-topics-grid.columns-2,
  .odw-topics .on-demand-topics-grid.columns-3,
  .odw-topics .on-demand-topics-grid.columns-4 {
    grid-template-columns: 1fr !important;
  }
}

.odw-button {
  display: inline-block;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 3px;
  border: 1px solid #0073aa;
  background-color: #0085ba;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.odw-button:hover {
  background-color: #0073aa;
}

.odw-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Topic detail modal */
.odw-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.odw-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.odw-modal-content {
  position: relative;
  background: #fff;
  border-radius: 8px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.odw-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #555;
  padding: 0;
  width: 32px;
  height: 32px;
}

.odw-modal-close:hover {
  color: #000;
}

.odw-modal-body .odw-modal-topic-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.odw-modal-loading,
.odw-modal-error {
  margin: 0;
  padding: 1em 0;
}

.odw-back-link {
  display: inline-block;
  margin-bottom: 1em;
  color: #0073aa;
  text-decoration: none;
}

.odw-back-link:hover {
  text-decoration: underline;
}

/* Topic detail page: full width of theme content area (no grid, no fixed card width) */
.odw-topic-detail-page .on-demand-topic-card,
.odw-topic-detail-page .odw-topic {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.odw-topic-detail-page .on-demand-topic-image {
  max-width: 100%;
  height: auto;
}

