/* ============================================
   Output Hub — Premium tab navigation
   Resume | Cover Letter | Interview
   One panel visible at a time
   ============================================ */

.output-hub {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

#results,
.output {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.output-hub-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  padding: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  max-width: 100%;
}

.output-hub-tabs::-webkit-scrollbar {
  display: none;
}

.output-hub-tab {
  flex: 1 0 auto;
  min-width: 148px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

.output-hub-tab-icon {
  font-size: 16px;
  line-height: 1;
  opacity: 0.85;
}

.output-hub-tab:hover:not(.active) {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.output-hub-tab.active {
  color: #ffffff;
  background: linear-gradient(
    135deg,
    rgba(180, 140, 222, 0.28) 0%,
    rgba(180, 140, 222, 0.12) 100%
  );
  border-color: rgba(180, 140, 222, 0.55);
  box-shadow:
    0 0 28px rgba(180, 140, 222, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.output-hub-tab.active .output-hub-tab-icon {
  opacity: 1;
}

.output-hub-stage {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  contain: layout style;
}

.output-hub-panel {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  animation: hubPanelIn 0.28s ease both;
}

#output-panel-resume,
#output-panel-cover,
#output-panel-interview {
  width: 100%;
  max-width: 100%;
}

#cover-letter-render {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.output-hub-panel[hidden] {
  display: none !important;
}

@keyframes hubPanelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hubPanelFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.output-hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  padding-top: 4px;
}

.output-hub-actions .btn {
  min-height: 44px;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.output-hub-actions .btn-primary {
  background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
  color: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.12);
}

.output-hub-actions .btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
}

.output-hub-actions .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

@media (max-width: 768px) {
  .output-hub-tabs {
    flex-wrap: nowrap;
    overflow-x: hidden;
    margin-bottom: 16px;
    padding: 5px;
    gap: 6px;
  }

  .output-hub-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 6px;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
    transform: none !important;
  }

  .output-hub-tab-icon {
    font-size: 14px;
    flex-shrink: 0;
  }

  .output-hub-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .output-hub-panel {
    animation: hubPanelFade 0.18s ease both;
  }

  .output-hub-actions {
    flex-direction: column;
  }

  .output-hub-actions .btn {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .output-hub-tab-label {
    display: none;
  }

  .output-hub-tab {
    padding: 12px 6px;
    gap: 0;
  }
}

/* ============================================
   Cover Letter — locked state (Free users)
   ============================================ */

.output-hub-panel .interview-card,
.output-hub-panel .locked-content {
  margin-top: 0;
}

.cl-locked {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cl-locked-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.cl-locked h3 {
  margin: 0 0 8px;
  font-size: 22px;
  color: #fff;
}

.cl-locked-lead {
  margin: 0 0 20px;
  max-width: 360px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 15px;
  line-height: 1.6;
}

.cl-locked-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: start;
  max-width: 320px;
}

.cl-locked-benefits li {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
}

/* ============================================
   Cover Letter — A4 document preview
   ============================================ */

.cl-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.cl-preview-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  padding: 4px 16px 8px;
  box-sizing: border-box;
}

/* Frame holds scaled A4 doc — doc is absolute so it never widens the page */
.cl-doc-frame {
  --cl-scale: 1;
  position: relative;
  width: calc(794px * var(--cl-scale));
  height: calc(1123px * var(--cl-scale));
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  flex-shrink: 0;
}

.cl-doc {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -397px;
  width: 794px;
  min-width: 794px;
  max-width: 794px;
  min-height: 1123px;
  height: 1123px;
  box-sizing: border-box;
  background: #ffffff;
  color: #1a1a1a;
  font-family: var(--cl-font, "Tajawal", "Inter", sans-serif);
  font-size: 11.5pt;
  line-height: 1.5;
  padding: 94px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  transform: scale(var(--cl-scale));
  transform-origin: top center;
  -webkit-transform: scale(var(--cl-scale));
  -webkit-transform-origin: top center;
}

.cl-doc * {
  text-shadow: none !important;
  box-shadow: none !important;
}

.cl-header {
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--cl-accent, #4A6356);
}

.cl-name {
  margin: 0 0 8px;
  font-family: var(--cl-name-font, var(--cl-font));
  font-size: 21pt;
  font-weight: 700;
  color: var(--cl-ink, #111111);
  line-height: 1.2;
}

.cl-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 10pt;
  color: #374151;
  line-height: 1.45;
}

.cl-contact-sep {
  margin: 0 8px;
  color: #9ca3af;
}

.cl-date {
  margin-bottom: 18px;
  font-size: 10.5pt;
  color: #374151;
}

.cl-salutation {
  margin: 0 0 16px;
  font-size: 11pt;
  font-weight: 600;
  color: var(--cl-ink, #111111);
}

.cl-paragraph {
  margin: 0 0 13px;
  font-size: 11pt;
  line-height: 1.55;
  color: #1a1a1a;
}

[dir="rtl"] .cl-paragraph { text-align: right; }
[dir="ltr"] .cl-paragraph { text-align: left; }

.cl-signoff {
  margin-top: 22px;
}

.cl-signoff-line {
  margin: 0 0 22px;
  font-size: 11pt;
}

.cl-signature {
  margin: 0;
  font-size: 12pt;
  font-weight: 700;
  color: var(--cl-ink, #111111);
  font-family: var(--cl-name-font, var(--cl-font));
}

.cl-doc--ats .cl-header { border-bottom-color: #000000; }
.cl-doc--default_ats .cl-header { border-bottom-color: #000000; }
.cl-doc--vivid .cl-header { border-bottom-color: #E5662C; }
.cl-doc--sleek .cl-header { border-bottom-color: #B85C50; }
.cl-doc--corporate .cl-header { border-bottom-color: #243140; }
.cl-doc--editorial .cl-name { font-size: 25pt; }

.cl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
}

.cl-actions .btn {
  min-height: 44px;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.cl-word-meta {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
}

/* Mobile: tighten cover letter preview padding */
@media (max-width: 860px) {
  .cl-locked {
    padding: 32px 20px;
    min-height: 360px;
  }

  .cl-actions {
    flex-direction: column;
  }

  .cl-actions .btn {
    width: 100%;
  }
}

/* Full-size off-screen clone for PDF capture */
.cl-doc-frame.is-exporting {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 794px !important;
  height: 1123px !important;
  overflow: visible;
  z-index: -1;
  pointer-events: none;
}

.cl-doc-frame.is-exporting .cl-doc {
  position: static;
  margin-left: 0;
  transform: none !important;
  -webkit-transform: none !important;
}

/* Print */
@media print {
  body.cl-print-mode .page-bg,
  body.cl-print-mode .topbar,
  body.cl-print-mode .hero,
  body.cl-print-mode .how,
  body.cl-print-mode .pricing,
  body.cl-print-mode .form-card,
  body.cl-print-mode .footer,
  body.cl-print-mode .template-bar,
  body.cl-print-mode .actions-bar,
  body.cl-print-mode .output-hub-tabs,
  body.cl-print-mode .output-hub-actions,
  body.cl-print-mode .cl-actions,
  body.cl-print-mode .cl-word-meta,
  body.cl-print-mode #output-panel-resume,
  body.cl-print-mode #output-panel-interview,
  body.cl-print-mode .cv-save-actions {
    display: none !important;
  }

  body.cl-print-mode #output-panel-cover {
    display: block !important;
  }

  body.cl-print-mode #output-panel-cover[hidden] {
    display: block !important;
  }

  body.cl-print-mode * {
    visibility: hidden !important;
  }

  body.cl-print-mode .cl-doc,
  body.cl-print-mode .cl-doc * {
    visibility: visible !important;
  }

  body.cl-print-mode .cl-doc {
    position: fixed;
    left: 0;
    top: 0;
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    padding: 25mm;
    margin: 0;
    box-shadow: none;
    transform: none !important;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}

/* Resume print */
@media print {
  body.resume-print-mode .page-bg,
  body.resume-print-mode .topbar,
  body.resume-print-mode .hero,
  body.resume-print-mode .how,
  body.resume-print-mode .pricing,
  body.resume-print-mode .form-card,
  body.resume-print-mode .footer,
  body.resume-print-mode .template-bar,
  body.resume-print-mode .actions-bar,
  body.resume-print-mode .output-hub-tabs,
  body.resume-print-mode .output-hub-actions,
  body.resume-print-mode #output-panel-cover,
  body.resume-print-mode #output-panel-interview {
    display: none !important;
  }

  body.resume-print-mode #output-panel-resume {
    display: block !important;
  }

  body.resume-print-mode #output-panel-resume[hidden] {
    display: block !important;
  }

  body.resume-print-mode * {
    visibility: hidden !important;
  }

  body.resume-print-mode .cv-final-image,
  body.resume-print-mode .cv-image-display {
    visibility: visible !important;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
  }
}
