/* Initial Choice Box inside Theme .Landing */
.hsp-choice-landing {
  margin: 30px auto;
  max-width: 900px;
  width: 100%;
}

.hsp-choice-landing .innerContent {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  padding: 32px 24px;
  text-align: center;
}

.hsp-choice-title {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
  white-space: nowrap;
}

.hsp-choice-subtitle {
  color: #64748b;
  font-size: 15px;
  margin: 0 0 24px 0;
}

.hsp-choice-header {
  margin-bottom: 32px;
}

.hsp-choice-icon {
  width: 64px;
  height: 64px;
  background: #e0e7ff;
  color: #3e3ef4;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
}

.hsp-choice-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.hsp-choice-header p {
  color: #64748b;
  font-size: 15px;
  margin: 0;
}

.hsp-choice-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 640px) {
  .hsp-choice-title {
    white-space: normal;
    font-size: 20px;
  }
  .hsp-choice-options-grid {
    grid-template-columns: 1fr;
  }
}

.hsp-choice-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 28px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hsp-choice-card:hover {
  transform: translateY(-4px);
  border-color: #3e3ef4;
  box-shadow: 0 12px 24px rgba(62, 62, 244, 0.12);
  background: #ffffff;
}

.hsp-card-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.hsp-card-icon.upload {
  background: #dcfce7;
  color: #10b981;
}

.hsp-card-icon.write {
  background: #e0e7ff;
  color: #3e3ef4;
}

.hsp-choice-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.hsp-choice-card p {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 0 20px 0;
  line-height: 1.5;
  flex: 1;
}

.hsp-choice-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hsp-choice-btn.primary {
  background: #10b981;
  color: #ffffff;
}

.hsp-choice-btn.primary:hover {
  background: #059669;
}

.hsp-choice-btn.secondary {
  background: #3e3ef4;
  color: #ffffff;
}

.hsp-choice-btn.secondary:hover {
  background: #2b2bd9;
}

/* Primary & Secondary Buttons */
.pdf-btn-primary {
  background-color: #3e3ef4;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s;
}

.pdf-btn-primary:hover {
  background-color: #2b2bd9;
}

.pdf-btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.pdf-btn-secondary:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.pdf-btn-success {
  background-color: #10b981;
  color: #ffffff;
}

.pdf-btn-success:hover {
  background-color: #059669;
}

/* Header Upload Trigger Button */
.hsp-upload-trigger-btn {
  background-color: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  font-weight: 700;
}

.hsp-upload-trigger-btn:hover {
  background-color: #c7d2fe;
  color: #1e1b4b;
}

/* Full-Page Workspace Overlay Layout */
#hsp-workspace-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99900;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.hsp-full-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
  gap: 12px;
  z-index: 10;
}

.hsp-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hsp-brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.hsp-brand-title svg {
  color: #3e3ef4;
}

.hsp-doc-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.hsp-doc-name {
  font-size: 14px;
  color: #334155;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
}

.hsp-badge {
  background: #e0e7ff;
  color: #3730a3;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.hsp-badge.secondary {
  background: #dcfce7;
  color: #166534;
}

/* Header Controls & Options */
.hsp-header-options {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hsp-option-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.hsp-select {
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  background-color: #ffffff;
  outline: none;
  cursor: pointer;
}

.hsp-select:focus {
  border-color: #3e3ef4;
}

.hsp-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Main Split Workspace */
.hsp-workspace {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  box-sizing: border-box;
}

/* Left Pane: Editor */
.hsp-editor-pane {
  flex: 1;
  min-width: 320px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.hsp-pane-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.hsp-pane-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.hsp-toolbar-quick-inserts {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.hsp-toolbar-quick-inserts button {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hsp-toolbar-quick-inserts button:hover {
  background: #3e3ef4;
  color: #ffffff;
  border-color: #3e3ef4;
}

.hsp-editor-area {
  flex: 1;
  position: relative;
  display: flex;
}

.hsp-textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 16px;
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: #0f172a;
  resize: none;
  box-sizing: border-box;
  background: #fafafa;
}

.hsp-editor-footer-status {
  padding: 8px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.hsp-text-btn {
  background: none;
  border: none;
  color: #3e3ef4;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
}

.hsp-text-btn:hover {
  text-decoration: underline;
}

.hsp-text-btn.danger {
  color: #ef4444;
}

/* Right Pane: Live Rendered PDF Page Preview */
.hsp-viewer-pane {
  flex: 1.1;
  min-width: 340px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.hsp-viewer-controls {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.hsp-viewer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.hsp-viewer-title svg {
  color: #10b981;
}

.hsp-viewport-container {
  flex: 1;
  overflow: auto;
  background: #334155;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Paper Page Simulation */
.hsp-paper-page {
  background: #ffffff;
  width: 100%;
  max-width: 794px;
  /* A4 width at 96 DPI */
  min-height: 1000px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  overflow-wrap: break-word;
}

.hsp-paper-page.orientation-landscape {
  max-width: 1100px;
  min-height: 750px;
}

/* Margins */
.hsp-paper-page.margin-compact {
  padding: 24px;
}

.hsp-paper-page.margin-normal {
  padding: 40px;
}

.hsp-paper-page.margin-wide {
  padding: 60px;
}

/* Rendered HTML Container inside Preview */
.hsp-rendered-content {
  width: 100%;
  box-sizing: border-box;
}

/* Loading Overlay */
.hsp-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #ffffff;
}

.hsp-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: hsp-spin 0.8s ease-in-out infinite;
  margin-bottom: 16px;
}

@keyframes hsp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Non-Overlapping Left & Right Sidebar Ads Layout */
.appscms-sidebar-left,
.appscms-sidebar-right,
.appscms-left-sidebar,
.appscms-right-sidebar {
  z-index: 100000 !important;
}

@media (min-width: 1400px) {
  #hsp-workspace-section {
    padding-left: 230px;
    padding-right: 230px;
    transition: padding 0.2s ease;
  }
}

@media (max-width: 1399px) {
  #hsp-workspace-section {
    padding-left: 0;
    padding-right: 0;
  }

  .appscms-sidebar-left,
  .appscms-sidebar-right,
  .appscms-left-sidebar,
  .appscms-right-sidebar {
    display: none !important;
  }
}