/* Recommendations & "What should I read next?" styling */
.rec-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.rec-account-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.rec-toolbar select {
  max-width: 260px;
}
.rec-status-line {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 16px;
}
.rec-admin-note {
  font-size: 12px;
  color: var(--warning);
  margin: 6px 0 16px;
}
.rec-generating-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--raised);
  border: 1px solid var(--accent);
  color: var(--text);
  margin-bottom: 20px;
  font-size: 14px;
}
.rec-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rec-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes rec-spin {
  to { transform: rotate(360deg); }
}

.rec-group {
  margin-bottom: 32px;
}
.rec-group-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.rec-group-head h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.rec-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.15s, transform 0.15s;
  min-width: 0;
}
.rec-card:hover {
  border-color: #506a81;
  transform: translateY(-2px);
}
.rec-card-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.rec-cover-wrap {
  width: 72px;
  height: 108px;
  flex: 0 0 72px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--raised);
  display: grid;
  place-items: center;
}
.rec-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rec-cover-placeholder {
  font-size: 32px;
  font-weight: 700;
  color: var(--muted);
}
.rec-meta {
  flex: 1;
  min-width: 0;
}
.rec-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.rec-author {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-narrator {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
  line-height: 1.4;
}
.rec-reason {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.rec-reason-icon {
  flex-shrink: 0;
}
.rec-reason p {
  margin: 0;
  overflow-wrap: anywhere;
}

.rec-card-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.rec-format-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.rec-format-label {
  font-size: 12px;
  color: var(--muted);
}
.rec-format-select {
  flex: 1;
  max-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
}
.rec-action-wrap {
  display: flex;
}
.rec-action-btn {
  width: 100%;
  text-align: center;
  justify-content: center;
  padding: 9px 12px;
  font-size: 13px;
}
.rec-listen-btn {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.rec-listen-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.light .rec-card {
  background: #fff;
  border-color: var(--line);
}
.light .rec-cover-wrap {
  background: #e6edf5;
}
.light .rec-reason {
  background: #f0f7f6;
}
.light .rec-format-select {
  background: #fff;
}

/* Mobile responsive down to 320px/390px */
@media (max-width: 600px) {
  .rec-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .rec-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .rec-toolbar select {
    max-width: 100%;
    width: 100%;
  }
  .rec-card {
    padding: 14px;
  }
  .rec-cover-wrap {
    width: 64px;
    height: 96px;
    flex: 0 0 64px;
  }
  .rec-title {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .rec-card-top {
    gap: 10px;
  }
  .rec-cover-wrap {
    width: 54px;
    height: 81px;
    flex: 0 0 54px;
  }
}

/* Top Books / Movies / Shows toggle */
.rec-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.rec-media-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.rec-media-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.rec-media-tab:hover {
  color: var(--text);
}
.rec-media-tab.active {
  background: var(--accent);
  color: var(--bg);
}

.rec-overview {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rec-media-actions {
  gap: 8px;
}
.rec-media-actions .rec-action-btn {
  flex: 1;
}
.rec-seasons-btn {
  flex: 0 0 auto;
  padding: 9px 12px;
  font-size: 13px;
  white-space: nowrap;
}

/* Standalone For You view (e.g. foryou.ockeymedia.duckdns.org) */
body.standalone-foryou {
  grid-template-columns: 1fr;
}
body.standalone-foryou aside {
  display: none;
}
body.standalone-foryou main {
  margin-left: 0;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}
body.standalone-foryou #updated,
body.standalone-foryou #rescan-all,
body.standalone-foryou #refresh,
body.standalone-foryou .toolbar {
  display: none !important;
}
.standalone-foryou-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.light .rec-media-toggle {
  background: #edf2f7;
}
.light .rec-media-tab.active {
  color: #fff;
}

@media (max-width: 600px) {
  .rec-media-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .rec-media-tab {
    padding: 8px 8px;
    text-align: center;
  }
}
