/* ============================================================
   LPK BEAUTY — REPORTS LIST
   Version: 7.1
   ============================================================ */

/* ============================================================
   RANGE TABS
   ============================================================ */
#rangeTabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#rangeTabs::-webkit-scrollbar { display: none; }

#rangeTabs .tab {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all var(--transition-fast);
}
#rangeTabs .tab:hover { color: var(--text-primary); }
#rangeTabs .tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   PROGRAM BADGE (khusus trainer)
   ============================================================ */
.program-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
}
.program-badge.hidden { display: none; }
.program-badge svg { opacity: 0.85; flex-shrink: 0; }

/* ============================================================
   CUSTOM RANGE BAR
   ============================================================ */
.custom-range-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.custom-range-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  flex: 1;
}
.custom-range-field .form-label { font-size: 11px; margin-bottom: 0; }

/* ============================================================
   SUMMARY BAR
   ============================================================ */
.report-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.report-summary-item {
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  min-width: 0;
}
.report-summary-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-summary-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   REPORT LIST
   ============================================================ */
.report-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ============================================================
   REPORT ITEM ROW
   ============================================================ */
.report-item-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.report-item-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.report-item-row:active {
  background: var(--bg-subtle);
  transform: scale(0.998);
}

/* ============================================================
   AVATAR
   ============================================================ */
.report-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

/* ============================================================
   BODY
   ============================================================ */
.report-item-body {
  flex: 1;
  min-width: 0;
}

/* --- LAYER 1: NAMA + TANGGAL --- */
.report-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  min-width: 0;
}
.report-item-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.report-item-date {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

/* --- LAYER 2: KODE + BATCH --- */
.report-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  flex-wrap: wrap;
  row-gap: 2px;
}
.report-item-meta .meta-code {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 1px 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}
.report-item-meta .meta-sep {
  color: var(--border-strong);
  font-size: 10px;
}
.report-item-meta .meta-batch {
  color: var(--text-secondary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* --- LAYER 3: BADGES --- */
.report-item-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  align-items: center;
}
.report-item-badges .badge-sm {
  font-size: 10.5px;
  padding: 2px 7px;
  font-weight: 600;
  line-height: 1.4;
}
.report-item-badges .badge-icon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.report-item-badges .badge-icon svg {
  opacity: 0.8;
}

/* Fase badge variant */
.badge-fase-1 { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.badge-fase-2 { background: #FED7AA; color: #9A3412; border: 1px solid #FDBA74; }
.badge-fase-3 { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* --- LAYER 4: NOTES --- */
.report-item-notes {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--bg-subtle);
  border-left: 2px solid var(--border-strong);
  border-radius: var(--radius-xs);
  word-break: break-word;
}

/* --- LAYER 5: PIC --- */
.report-item-pic {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.report-item-pic svg {
  color: var(--text-muted);
  opacity: 0.7;
  flex-shrink: 0;
}
.report-item-pic .pic-label {
  font-weight: 600;
  color: var(--text-secondary);
}
.report-item-pic .pic-names {
  color: var(--text-secondary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.crud-toolbar-right .crud-refresh {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crud-filter optgroup {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 0;
}

.crud-filter optgroup option {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
  padding: 6px 8px;
}

/* ============================================================
   WA PREVIEW
   ============================================================ */
.wa-preview {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: 55vh;
  overflow-y: auto;
  color: var(--text-primary);
  margin: 0;
  tab-size: 2;
  -moz-tab-size: 2;
}

.wa-preview:empty::before {
  content: 'Pilih program dulu untuk melihat preview...';
  color: var(--text-muted);
  font-style: italic;
}

#waProgramSelect {
  font-weight: 500;
}

/* ============================================================
   LOAD MORE
   ============================================================ */
.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */
@media (max-width: 1024px) {
  .report-summary { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .report-summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .report-summary-item { padding: 8px 6px; }
  .report-summary-value { font-size: 16px; }
  .report-summary-label { font-size: 9px; }

  .report-item-row { padding: 12px; gap: 10px; }
  .report-item-avatar { width: 36px; height: 36px; font-size: 12px; }

  .report-item-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 5px;
  }
  .report-item-name { font-size: 13.5px; width: 100%; white-space: normal; }
  .report-item-date { font-size: 10.5px; }

  .report-item-meta { font-size: 11.5px; margin-bottom: 7px; }
  .report-item-meta .meta-code { font-size: 10px; padding: 1px 5px; }
  .report-item-meta .meta-batch { max-width: 100%; }

  .report-item-badges { gap: 4px; margin-bottom: 7px; }
  .report-item-badges .badge-sm { font-size: 10px; padding: 2px 6px; }

  .report-item-notes {
    font-size: 11.5px;
    padding: 5px 8px;
    margin-bottom: 7px;
    -webkit-line-clamp: 2;
  }

  .report-item-pic { font-size: 10.5px; padding-top: 7px; gap: 4px; }
  .report-item-pic .pic-names { max-width: 100%; }

  .crud-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .crud-toolbar .search-input {
    max-width: none;
    width: 100%;
  }
  .crud-toolbar-right {
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 40px;
    gap: 6px;
  }
  .crud-toolbar-right .crud-filter {
    min-width: 0;
    width: 100%;
    font-size: 12.5px;
    padding: 8px 24px 8px 10px;
  }
  .crud-toolbar-right .crud-refresh {
    width: 40px;
    height: 40px;
  }

  .custom-range-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }
  .custom-range-field { min-width: 0; width: 100%; }

  .page-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .page-header-actions .btn {
    width: 100%;
    padding: 9px 12px;
  }
  .page-header-actions .btn-primary { grid-column: 1 / -1; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE
   ============================================================ */
@media (max-width: 480px) {
  .report-summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .report-summary-value { font-size: 15px; }
  .report-summary-label { font-size: 8.5px; }

  .report-item-row { padding: 10px; gap: 8px; }
  .report-item-avatar { width: 32px; height: 32px; font-size: 11px; }

  .page-header-actions { grid-template-columns: 1fr; }
  .crud-toolbar-right { grid-template-columns: 1fr 1fr 40px; }

  .report-item-notes { -webkit-line-clamp: 2; font-size: 11px; }
}

/* ============================================================
   PUBLIC MODE OVERRIDE
   ============================================================ */
.app-main.app-main-public {
  margin-left: 0;
}

.app-main.app-main-public .app-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.public-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
}

.public-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.public-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.public-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.public-brand-text { min-width: 0; }

.public-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.public-brand-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 1px;
}

.public-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .public-header-inner { padding: 10px 16px; }
  .public-brand-sub { display: none; }
  .public-btn-text { display: none; }
  .public-header-actions .btn { padding: 8px 10px; }
  .app-main.app-main-public .app-content { padding: 16px; }
}