/* ── Component: ReportsPage full-page overlay ──
 * Class prefix: rpt-
 */

/* ── ReportsPage — full-page overlay ── */
.rpt-page {
  position: fixed;
  top: var(--topbar-h, 0);
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--bg-primary, #080B14);
  display: flex;
  flex-direction: column;
  animation: rptFadeIn 0.25s ease-out;
}
@keyframes rptFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.rpt-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.rpt-back-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.rpt-back-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.rpt-header-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}
.rpt-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rpt-upload-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  background: var(--accent-primary, #7C6FF7);
  color: #fff;
}
.rpt-upload-btn:hover {
  background: var(--accent-hover, #6B5CE7);
  transform: translateY(-1px);
}

/* ── Toolbar (filters + view toggle) ── */
.rpt-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.rpt-search-input {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.rpt-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.rpt-search-input:focus {
  border-color: var(--accent-primary, #7C6FF7);
}
.rpt-filter-select {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  min-width: 100px;
}
.rpt-filter-select:focus {
  border-color: var(--accent-primary, #7C6FF7);
}
.rpt-view-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 2px;
}
.rpt-view-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rpt-view-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ── Body ── */
.rpt-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 20px 24px;
}

/* ── Grid view ── */
.rpt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

/* ── List view ── */
.rpt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ── Report Card (grid mode) ── */
.rpt-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  cursor: pointer;
  position: relative;
}
.rpt-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* ── Report Card (list mode) ── */
.rpt-list .rpt-card {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
}
.rpt-list .rpt-card-body { flex: 1; min-width: 0; }
.rpt-list .rpt-card-meta { flex-direction: row; gap: 12px; margin-top: 0; }
.rpt-list .rpt-card-actions { opacity: 0; }
.rpt-list .rpt-card:hover .rpt-card-actions { opacity: 1; }

.rpt-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.rpt-card-title {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.rpt-card-body {
  min-width: 0;
}
.rpt-card-snippet {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.rpt-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.rpt-card-mini {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}
.rpt-card-mini-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}
.rpt-card-date {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
}
.rpt-card-size {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
}

/* ── Type badge ── */
.rpt-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.rpt-type-badge--document { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.rpt-type-badge--report { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.rpt-type-badge--analysis { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.rpt-type-badge--email_draft { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.rpt-type-badge--social_post { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.rpt-type-badge--other { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }

/* ── Card actions ── */
.rpt-card-actions {
  display: flex;
  gap: 2px;
  transition: opacity 0.15s;
}
.rpt-card:hover .rpt-card-actions {
  opacity: 1;
}
.rpt-action-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.rpt-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.rpt-action-btn--delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ── Empty state ── */
.rpt-empty {
  text-align: center;
  padding: 80px 20px;
  color: rgba(255, 255, 255, 0.4);
}
.rpt-empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
}
.rpt-empty h3 {
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  margin: 0 0 8px;
}
.rpt-empty p {
  font-size: 13px;
  margin: 0;
}

/* ── Preview modal (slide-in from right) ── */
.rpt-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  justify-content: flex-end;
}
.rpt-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: rptBackdropIn 0.2s ease-out;
}
@keyframes rptBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.rpt-preview-panel {
  position: relative;
  width: 600px;
  max-width: 90vw;
  background: var(--bg-primary, #080B14);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  animation: rptSlideIn 0.25s ease-out;
  z-index: 1;
}
@keyframes rptSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.rpt-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.rpt-preview-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.rpt-preview-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.rpt-preview-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rpt-preview-actions {
  display: flex;
  gap: 6px;
}
.rpt-preview-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rpt-preview-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.rpt-preview-action-btn--delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.rpt-preview-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.rpt-preview-meta-item {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}
.rpt-preview-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.rpt-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  background: rgba(124, 111, 247, 0.12);
  color: #a78bfa;
}
.rpt-preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.8);
}
.rpt-preview-content h1,
.rpt-preview-content h2,
.rpt-preview-content h3 {
  color: #fff;
  margin: 1em 0 0.5em;
}
.rpt-preview-content h1 { font-size: 22px; }
.rpt-preview-content h2 { font-size: 18px; }
.rpt-preview-content h3 { font-size: 15px; }
.rpt-preview-content p { margin: 0.5em 0; }
.rpt-preview-content ul, .rpt-preview-content ol { padding-left: 20px; }
.rpt-preview-content code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.rpt-preview-content pre {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}
.rpt-preview-content blockquote {
  border-left: 3px solid rgba(124, 111, 247, 0.4);
  padding-left: 12px;
  margin: 0.5em 0;
  color: rgba(255, 255, 255, 0.5);
}
.rpt-preview-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5em 0;
}
.rpt-preview-content th,
.rpt-preview-content td {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  font-size: 13px;
}
.rpt-preview-content th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
}

/* ── Edit form (inline in preview) ── */
.rpt-edit-form {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}
.rpt-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rpt-edit-field--grow {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.rpt-edit-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rpt-edit-input,
.rpt-edit-select {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.rpt-edit-input:focus,
.rpt-edit-select:focus {
  border-color: var(--accent-primary, #7C6FF7);
}
.rpt-edit-textarea {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  resize: none;
  flex: 1;
  min-height: 200px;
  transition: border-color 0.15s;
}
.rpt-edit-textarea:focus {
  border-color: var(--accent-primary, #7C6FF7);
}
.rpt-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.rpt-edit-cancel {
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.rpt-edit-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
}
.rpt-edit-save {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent-primary, #7C6FF7);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.rpt-edit-save:hover {
  background: var(--accent-hover, #6B5CE7);
}

/* ── Toast ── */
.rpt-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 40, 0.95);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 500;
  animation: rptToastIn 0.2s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
@keyframes rptToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Loading ── */
.rpt-loading {
  text-align: center;
  padding: 40px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}

/* ── Share email modal ── */
.rpt-share-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rpt-share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.rpt-share-modal {
  position: relative;
  width: 480px;
  max-width: 92vw;
  background: var(--bg-primary, #0c0f1a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  animation: rptFadeIn 0.2s ease-out;
  z-index: 1;
}
.rpt-share-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
.rpt-share-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.rpt-share-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rpt-share-input {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.rpt-share-input:focus {
  border-color: var(--accent-primary, #7C6FF7);
}
.rpt-share-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── Email chips ── */
.rpt-chip-area {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  min-height: 36px;
  align-items: center;
  cursor: text;
}
.rpt-chip-area:focus-within {
  border-color: var(--accent-primary, #7C6FF7);
}
.rpt-chip-input {
  border: none !important;
  background: none !important;
  padding: 2px 4px !important;
  flex: 1;
  min-width: 120px;
  outline: none;
  color: #fff;
  font-size: 13px;
}
.rpt-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(124, 111, 247, 0.15);
  color: #a78bfa;
  font-size: 12px;
  white-space: nowrap;
}
.rpt-chip-remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
  margin-left: 2px;
}
.rpt-chip-remove:hover {
  opacity: 1;
}

/* ── Contact autocomplete dropdown ── */
.rpt-contact-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary, #0c0f1a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.rpt-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.rpt-contact-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.rpt-contact-name {
  font-size: 13px;
  color: #fff;
  font-weight: 500;
}
.rpt-contact-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .rpt-header { padding: 12px 16px; }
  .rpt-toolbar { padding: 10px 16px; }
  .rpt-body { padding: 16px; }
  .rpt-grid { grid-template-columns: 1fr; }
  .rpt-preview-panel { width: 100%; max-width: 100vw; }
  .rpt-card-actions { opacity: 1; }
}
