/* -----------------------------------------------
   Reports Page — CyboWatch
   All scoped under #page-reports to avoid conflicts
   Block colour removed from interactive elements, 
   structural white backgrounds restored to prevent black voids.
   ----------------------------------------------- */

#page-reports {
  --rpt-bg:        #ffffff;
  --rpt-surface:   #ffffff;
  --rpt-surface2:  #f5f5f5;
  --rpt-border:    #dcdcdc;
  --rpt-accent:    #0a84ff;
  --rpt-accent2:   #0a84ff;
  --rpt-danger:    #ff453a;
  --rpt-warn:      #ff9f0a;
  --rpt-ok:        #30d158;

  --rpt-text:      #222222;
  --rpt-muted:     #666666;
  --rpt-white:     #ffffff;
  --rpt-radius:    10px;
}

/* -- Layout -- */
.rpt-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 140px);
  gap: 0;
  border: 1px solid var(--rpt-border);
  border-radius: var(--rpt-radius);
  overflow: hidden;
  background: var(--rpt-surface); /* Restored white to prevent black background */
}

/* -- Left Panel -- */
.rpt-panel {
  background: var(--rpt-surface); /* Restored white */
  border-right: 1px solid var(--rpt-border);
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rpt-panel-heading {
  font-size: 11px;
  font-weight: 600;
  color: var(--rpt-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rpt-border);
}

/* -- Form -- */
.rpt-form-section { display: flex; flex-direction: column; gap: 12px; }

.rpt-field { display: flex; flex-direction: column; gap: 6px; }
.rpt-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--rpt-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.rpt-field input[type="text"],
.rpt-field select {
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-border);
  border-radius: 8px;
  color: var(--rpt-text);
  font-size: 13px;
  font-family: 'Inter', system-ui, sans-serif;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
.rpt-field input[type="text"]:focus,
.rpt-field select:focus {
  border-color: var(--rpt-accent);
}
.rpt-field input::placeholder { color: var(--rpt-muted); }

/* -- Period Pills -- */
.rpt-period-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.rpt-period-pill {
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-border);
  border-radius: 8px;
  padding: 12px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  user-select: none;
}
.rpt-period-pill:hover { border-color: var(--rpt-accent); }
.rpt-period-pill.active {
  background: transparent; /* Block color removed */
  border-color: var(--rpt-accent);
}
.rpt-pill-icon { font-size: 18px; margin-bottom: 4px; color: var(--rpt-muted); }
.rpt-period-pill.active .rpt-pill-icon { color: var(--rpt-accent); }
.rpt-pill-label { font-size: 12px; font-weight: 600; color: var(--rpt-text); }
.rpt-pill-sub { font-size: 10px; color: var(--rpt-muted); margin-top: 2px; }
.rpt-period-pill.active .rpt-pill-label { color: var(--rpt-accent); }

/* -- Customer Cards -- */
.rpt-customer-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.rpt-customer-loading { color: var(--rpt-muted); font-size: 12px; padding: 12px; text-align: center; }

.rpt-customer-card {
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s;
}
.rpt-customer-card:hover { border-color: var(--rpt-accent); }
.rpt-customer-card.active {
  background: transparent; /* Block color removed */
  border-color: var(--rpt-accent);
}
.rpt-customer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--rpt-accent);
  flex-shrink: 0;
}
.rpt-customer-card.active .rpt-customer-avatar {
  background: transparent;
  border-color: var(--rpt-accent);
  color: var(--rpt-accent);
}
.rpt-customer-info { flex: 1; min-width: 0; }
.rpt-customer-name { font-size: 13px; font-weight: 600; color: var(--rpt-text); }
.rpt-customer-tenant { font-size: 11px; color: var(--rpt-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-customer-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--rpt-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  background: transparent;
}
.rpt-customer-card.active .rpt-customer-check {
  background: transparent;
  border-color: var(--rpt-accent);
}
.rpt-customer-check i { display: none; font-size: 9px; color: var(--rpt-accent); }
.rpt-customer-card.active .rpt-customer-check i { display: block; }

/* -- Generate Button -- */
.rpt-btn-generate {
  background: transparent; /* Block color removed */
  color: var(--rpt-accent);
  border: 1px solid var(--rpt-accent);
  border-radius: 8px;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
  font-family: 'Inter', system-ui, sans-serif;
}
.rpt-btn-generate:hover {
  color: var(--rpt-accent2);
  border-color: var(--rpt-accent2);
}
.rpt-btn-generate:disabled {
  border-color: var(--rpt-border);
  color: var(--rpt-muted);
  cursor: not-allowed;
}
.rpt-btn-generate svg { width: 16px; height: 16px; }

/* -- Spinner -- */
.rpt-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(10, 132, 255, 0.2);
  border-top-color: var(--rpt-accent);
  border-radius: 50%;
  animation: rptSpin 0.7s linear infinite;
  display: none;
}
@keyframes rptSpin { to { transform: rotate(360deg); } }

/* -- Right Preview Panel -- */
.rpt-preview {
  background: #ffffff; /* Restored white to remove the black void */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* -- Preview Toolbar -- */
.rpt-preview-bar {
  height: 52px;
  background: #ffffff; /* Restored white */
  border-bottom: 1px solid var(--rpt-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}
.rpt-preview-bar-title { font-size: 13px; font-weight: 600; color: var(--rpt-text); }
.rpt-preview-bar-sub { font-size: 11px; color: var(--rpt-muted); margin-top: 1px; }
.rpt-preview-bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.rpt-btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--rpt-border);
  background: transparent; /* Block color removed */
  font-family: 'Inter', system-ui, sans-serif;
  transition: all 0.15s;
}
.rpt-btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

.rpt-btn-download {
  color: var(--rpt-text);
}
.rpt-btn-download:not(:disabled):hover { border-color: var(--rpt-accent); color: var(--rpt-accent); }

.rpt-btn-discard {
  color: var(--rpt-danger);
  border-color: var(--rpt-danger);
}
.rpt-btn-discard:not(:disabled):hover { border-color: var(--rpt-danger); opacity: 0.8; }

.rpt-btn-send {
  color: var(--rpt-ok);
  border-color: var(--rpt-ok);
}
.rpt-btn-send:not(:disabled):hover { opacity: 0.8; }

/* -- PDF Viewer -- */
.rpt-pdf-viewer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: #f5f5f5; /* Light grey specifically for the PDF viewer area so the white PDF pages pop, removing the black */
}

.rpt-pdf-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--rpt-muted);
  text-align: center;
  padding: 40px;
}
.rpt-pdf-placeholder h3 { font-size: 16px; color: var(--rpt-text); opacity: 0.5; }
.rpt-pdf-placeholder p { font-size: 12px; max-width: 280px; line-height: 1.6; }

.rpt-pdf-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--rpt-muted);
}
.rpt-big-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--rpt-border);
  border-top-color: var(--rpt-accent);
  border-radius: 50%;
  animation: rptSpin 0.8s linear infinite;
}
.rpt-pdf-loading p { font-size: 13px; color: var(--rpt-muted); }
.rpt-step-text { font-size: 11px; color: var(--rpt-muted); opacity: 0.7; }

iframe#rptPdfFrame {
  display: none;
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff; /* Ensures the iframe itself isn't black */
}

/* -- Send Modal -- */
.rpt-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.rpt-modal-overlay.open { display: flex; }
.rpt-modal {
  background: #ffffff; /* Restored white so the modal is visible */
  border: 1px solid var(--rpt-border);
  border-radius: 14px;
  padding: 28px;
  width: 440px;
  max-width: 90vw;
}
.rpt-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.rpt-modal-icon {
  width: 40px; height: 40px;
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-ok);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rpt-ok);
  font-size: 16px;
}
.rpt-modal-title { font-size: 16px; font-weight: 700; color: var(--rpt-text); }
.rpt-modal-sub { font-size: 12px; color: var(--rpt-muted); margin-top: 2px; }
.rpt-modal-body { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.rpt-modal-info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-border);
  border-radius: 7px;
  font-size: 12px;
}
.rpt-modal-info-row span:first-child { color: var(--rpt-muted); }
.rpt-modal-info-row span:last-child { color: var(--rpt-text); font-weight: 500; }
.rpt-modal-footer { display: flex; gap: 10px; }

.rpt-btn-modal-cancel {
  flex: 1;
  padding: 11px;
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-border);
  border-radius: 8px;
  color: var(--rpt-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
}
.rpt-btn-modal-cancel:hover { border-color: var(--rpt-text); }

.rpt-btn-modal-confirm {
  flex: 2;
  padding: 11px;
  background: transparent; /* Block color removed */
  border: 1px solid var(--rpt-ok);
  border-radius: 8px;
  color: var(--rpt-ok);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.rpt-btn-modal-confirm:hover { opacity: 0.8; }

/* -- Toast -- */
.rpt-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s;
  pointer-events: none;
  background: transparent;
}
.rpt-toast.show { opacity: 1; transform: translateY(0); }
.rpt-toast.success { border: 1px solid var(--rpt-ok); color: var(--rpt-ok); }
.rpt-toast.error   { border: 1px solid var(--rpt-danger); color: var(--rpt-danger); }
.rpt-toast.info    { border: 1px solid var(--rpt-accent); color: var(--rpt-accent); }

/* -- Responsive -- */
@media (max-width: 1100px) {
  .rpt-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .rpt-panel {
    border-right: none;
    border-bottom: 1px solid var(--rpt-border);
    max-height: none;
  }
  .rpt-pdf-viewer {
    min-height: 500px;
  }
}