/**
 * Reports & Briefs screen styles (v5-mini-app-5-1)
 *
 * All colors use CSS custom properties set from Telegram themeParams
 * by app.js (v5-mini-app-2-1):
 *   --cl-bg, --cl-text, --cl-hint, --cl-link, --cl-btn, --cl-btn-text,
 *   --cl-secondary-bg
 */

/* ── Report list ─────────────────────────────────────────────────────────── */

.reports-list {
  padding: 0 0 72px; /* bottom padding clears tab bar */
}

.report-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--cl-bg);
  border-bottom: 1px solid rgba(128, 128, 128, 0.12);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s ease;
}

.report-card:active {
  background: var(--cl-secondary-bg);
}

.report-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-card__date {
  font-size: 12px;
  color: var(--cl-hint);
}

.report-card__preview {
  font-size: 14px;
  color: var(--cl-text);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Type badges ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: capitalize;
}

.badge-daily {
  background: var(--cl-link);
  color: #fff;
}

.badge-weekly {
  background: #10b981;
  color: #fff;
}

.badge-monthly {
  background: #a855f7;
  color: #fff;
}

/* ── Skeleton loading ────────────────────────────────────────────────────── */

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line {
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--cl-secondary-bg) 25%,
    rgba(128, 128, 128, 0.08) 50%,
    var(--cl-secondary-bg) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-card {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line--sm  { height: 12px; width: 60%;  }
.skeleton-line--md  { height: 14px; width: 80%;  }
.skeleton-line--lg  { height: 14px; width: 100%; }

/* ── Generate Report button ──────────────────────────────────────────────── */

.reports-actions {
  padding: 12px 16px 0;
}

.btn-generate {
  width: 100%;
  padding: 12px;
  background: var(--cl-btn);
  color: var(--cl-btn-text);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.btn-generate:active {
  opacity: 0.85;
}

/* ── Generate modal ──────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.modal-sheet {
  width: 100%;
  background: var(--cl-bg);
  border-radius: 16px 16px 0 0;
  padding: 24px 16px 32px;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--cl-text);
  margin-bottom: 16px;
}

.type-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.type-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--cl-secondary-bg);
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s;
}

.type-option.selected {
  border-color: var(--cl-link);
}

.type-option__label {
  font-size: 15px;
  color: var(--cl-text);
  font-weight: 500;
  text-transform: capitalize;
}

.modal-cancel {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--cl-hint);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  min-height: 44px;
}

/* ── Report detail ───────────────────────────────────────────────────────── */

.report-detail {
  padding: 16px 16px 80px;
}

.report-detail__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.report-detail__date {
  font-size: 13px;
  color: var(--cl-hint);
}

/* Rich text rendering */
.report-content {
  font-size: 15px;
  color: var(--cl-text);
  line-height: 1.65;
}

.report-content h1,
.report-content h2,
.report-content h3 {
  color: var(--cl-text);
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.report-content h1 { font-size: 20px; }
.report-content h2 { font-size: 17px; }
.report-content h3 { font-size: 15px; }

.report-content p {
  margin: 0 0 12px;
}

.report-content ul,
.report-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.report-content li {
  margin-bottom: 4px;
}

.report-content strong {
  font-weight: 700;
  color: var(--cl-text);
}

/* Highlighted numbers */
.report-number {
  color: var(--cl-link);
  font-weight: 600;
}

/* ── Share button ────────────────────────────────────────────────────────── */

.share-btn {
  position: fixed;
  bottom: 72px; /* above tab bar */
  right: 16px;
  width: 44px;
  height: 44px;
  background: var(--cl-btn);
  color: var(--cl-btn-text);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* ── Error state ─────────────────────────────────────────────────────────── */

.reports-error {
  padding: 24px 16px;
  text-align: center;
  color: var(--cl-hint);
  font-size: 14px;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.reports-empty {
  padding: 40px 16px;
  text-align: center;
}

.reports-empty__icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.reports-empty__text {
  font-size: 14px;
  color: var(--cl-hint);
}

/* ── Detail loading indicator ────────────────────────────────────────────── */

.report-detail__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

/* ── Reports section in Insights tab (v6-mini-app-s3) ───────────────────── */

.reports-section {
  padding: 0 16px 24px;
}

.reports-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 10px;
}

.reports-section__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--cl-text);
}

.reports-section__error {
  font-size: 13px;
  color: var(--cl-destructive, #e53e3e);
  padding: 4px 0 8px;
}

.reports-section__view-all {
  display: block;
  width: 100%;
  padding: 10px 0;
  text-align: center;
  font-size: 14px;
  color: var(--cl-link);
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Small generate button for section header */
.btn-generate--sm {
  width: auto;
  padding: 6px 14px;
  font-size: 13px;
  min-height: 32px;
  border-radius: 8px;
}

/* ── Load more indicator ─────────────────────────────────────────────────── */

.load-more-sentinel {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--cl-secondary-bg);
  border-top-color: var(--cl-link);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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