/**
 * ONE RESIZER — Tool 28: HTML to PDF Stylesheet
 * 2-Column Studio Workspace, Real-time Live HTML Rendered Preview,
 * Settings Controls (Size, Orientation, Margins, Quality, Page Numbers),
 * Progress Bar, Metrics Grid & High-Fidelity Multi-Page PDF Generation.
 */

.htmlpdf-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.htmlpdf-view {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.htmlpdf-view.hidden {
  display: none !important;
}

/* 2-Column Studio Grid */
.htmlpdf-studio-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .htmlpdf-studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Panel Card */
.htmlpdf-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* Mode Switch Nav */
.htmlpdf-mode-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.htmlpdf-mode-btn {
  padding: 9px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.htmlpdf-mode-btn:hover {
  color: var(--text-heading);
}
.htmlpdf-mode-btn.active {
  background: var(--bg-card);
  color: #ea580c;
  box-shadow: var(--shadow-sm);
}

/* Upload Dropzone */
.htmlpdf-dropzone {
  border: 2px dashed #ea580c;
  background: rgba(234, 88, 12, 0.04);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 16px;
  transition: var(--transition);
}
.htmlpdf-dropzone:hover, .htmlpdf-dropzone.dragover {
  background: rgba(234, 88, 12, 0.09);
  border-color: #c2410c;
}
.htmlpdf-dropzone-icon {
  font-size: 28px;
  margin-bottom: 6px;
}
.htmlpdf-dropzone-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 4px;
}
.htmlpdf-dropzone-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Textarea for code */
.htmlpdf-textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-heading);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  box-sizing: border-box;
  resize: vertical;
  margin-bottom: 16px;
  transition: var(--transition);
}
.htmlpdf-textarea:focus {
  outline: none;
  border-color: #ea580c;
  background: var(--bg-card);
}

/* Option Groups & Labels */
.htmlpdf-form-group {
  margin-bottom: 14px;
}
.htmlpdf-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 6px;
}
.htmlpdf-btn-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.htmlpdf-btn-group.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.htmlpdf-btn-group.cols-2 {
  grid-template-columns: 1fr 1fr;
}
.htmlpdf-opt-btn {
  padding: 7px 4px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.htmlpdf-opt-btn:hover {
  color: var(--text-heading);
}
.htmlpdf-opt-btn.active {
  background: var(--bg-card);
  border-color: #ea580c;
  color: #ea580c;
  box-shadow: var(--shadow-sm);
}

/* Checkbox toggle */
.htmlpdf-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 750;
  color: var(--text-heading);
  cursor: pointer;
  margin-top: 8px;
}

/* Action Button */
.htmlpdf-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #fff;
  font-size: 16px;
  font-weight: 850;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.35);
  transition: var(--transition);
  margin-top: 14px;
}
.htmlpdf-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(234, 88, 12, 0.45);
}
.htmlpdf-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Progress Card */
.htmlpdf-progress-card {
  margin-top: 18px;
  padding: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: none;
}
.htmlpdf-progress-card.active {
  display: block;
}
.htmlpdf-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 6px;
}
.htmlpdf-progress-track {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.htmlpdf-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ea580c, #10b981);
  transition: width 0.2s ease;
}

/* Results Card */
.htmlpdf-results-card {
  margin-top: 20px;
  padding: 22px;
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.06);
  border-radius: var(--radius-xl);
  display: none;
}
.htmlpdf-results-card.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
.htmlpdf-results-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16.5px;
  font-weight: 900;
  color: #10b981;
  margin-bottom: 14px;
}
.htmlpdf-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 600px) {
  .htmlpdf-metrics-grid {
    grid-template-columns: 1fr;
  }
}
.htmlpdf-metric-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
}
.htmlpdf-metric-label {
  font-size: 10.5px;
  font-weight: 750;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}
.htmlpdf-metric-value {
  font-size: 14px;
  font-weight: 900;
  color: var(--text-heading);
}

.htmlpdf-download-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: #10b981;
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
  margin-bottom: 10px;
}
.htmlpdf-download-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}
.htmlpdf-btn-secondary {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 750;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.htmlpdf-btn-secondary:hover {
  border-color: #ea580c;
  color: #ea580c;
}

/* Right Column: Preview Stage */
.htmlpdf-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.htmlpdf-preview-header {
  font-size: 14px;
  font-weight: 850;
  color: var(--text-heading);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.htmlpdf-preview-stage {
  width: 100%;
  min-height: 440px;
  max-height: 560px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: auto;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.htmlpdf-preview-frame {
  width: 100%;
  min-height: 480px;
  border: none;
  background: #ffffff;
  display: block;
}
