/**
 * ONE RESIZER — Tool 12: Image to PDF Stylesheet
 * Interactive Multi-Image to PDF Studio
 * Page Size Presets, Custom Dimensions, Orientation, Margin Controls,
 * Drag & Drop Reordering, Live PDF-Style Sheet Preview, and Responsive Layout.
 */

/* ========================================================
   CONTAINER & WORKSPACE VIEWS
   ======================================================== */
.itp-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

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

/* ========================================================
   UPLOAD HERO SCREEN
   ======================================================== */
.upload-hero-card {
  background: var(--bg-card);
  border: 2px dashed var(--primary-cyan);
  border-radius: var(--radius-xl);
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.upload-hero-card:hover, .upload-hero-card.dragover {
  background: rgba(22, 135, 245, 0.08);
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.upload-icon-wrapper {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: rgba(22, 135, 245, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-cyan);
}
.upload-icon-wrapper svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  fill: none;
}

.upload-heading {
  font-size: 20px;
  font-weight: 850;
  color: var(--text-heading);
  margin-bottom: 6px;
}
.upload-subheading {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.upload-btn-fake {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-cyan);
  color: #fff;
  font-weight: 800;
  font-size: 13.5px;
  padding: 9px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px var(--primary-glow);
  margin-bottom: 14px;
  transition: var(--transition);
}
.upload-btn-fake:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}
.upload-formats-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

/* ========================================================
   WORKSPACE 2-COLUMN STUDIO LAYOUT
   ======================================================== */
.itp-studio-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 950px) {
  .itp-studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Studio Left: Config & Images List */
.itp-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* Top Summary Bar */
.itp-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.itp-summary-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-heading);
}
.itp-summary-actions {
  display: flex;
  gap: 8px;
}
.itp-btn-add {
  background: rgba(22, 135, 245, 0.1);
  border: 1px solid var(--primary-cyan);
  color: var(--primary-cyan);
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.itp-btn-add:hover {
  background: var(--primary-cyan);
  color: #fff;
}
.itp-btn-clear {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 750;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.itp-btn-clear:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* Collapsible / Scrollable Images Strip */
.itp-images-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 4px;
}
.itp-img-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  gap: 10px;
  user-select: none;
  transition: var(--transition);
}
.itp-img-item:hover {
  border-color: rgba(22, 135, 245, 0.4);
}
.itp-img-item.dragging {
  opacity: 0.4;
  border-color: var(--primary-cyan);
}
.itp-img-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.itp-img-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
}
.itp-img-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.itp-img-info {
  min-width: 0;
}
.itp-img-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.itp-img-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.itp-img-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.itp-img-btn-order {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  transition: var(--transition);
}
.itp-img-btn-order:hover:not(:disabled) {
  background: var(--primary-cyan);
  color: #fff;
}
.itp-img-btn-order:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.itp-img-btn-del {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}
.itp-img-btn-del:hover {
  background: #ef4444;
  color: #fff;
}

/* ========================================================
   PDF SETTINGS FORM
   ======================================================== */
.itp-settings-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.itp-form-group {
  margin-bottom: 14px;
}
.itp-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Options Button Group */
.itp-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.itp-opt-btn {
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.itp-opt-btn:hover {
  border-color: rgba(22, 135, 245, 0.4);
  color: var(--text-heading);
}
.itp-opt-btn.active {
  background: var(--bg-card);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
  box-shadow: var(--shadow-sm);
}

/* Custom Page Size Inputs */
.itp-custom-dim-row {
  display: grid;
  grid-template-columns: 1fr 1fr 90px;
  gap: 8px;
  margin-top: 8px;
}
.itp-input-num {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  color: var(--text-heading);
  outline: none;
  box-sizing: border-box;
}
.itp-input-num:focus {
  border-color: var(--primary-cyan);
}
.itp-select-unit {
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 800;
  color: var(--text-heading);
  outline: none;
  cursor: pointer;
}

/* Custom Margin Input */
.itp-custom-margin-wrap {
  margin-top: 8px;
  max-width: 180px;
}

/* Main Action Button */
.itp-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #fff;
  font-size: 16px;
  font-weight: 850;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: var(--transition);
  margin-top: 18px;
}
.itp-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px var(--primary-glow);
}
.itp-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ========================================================
   RIGHT COLUMN: LIVE PDF SHEET PREVIEW
   ======================================================== */
.itp-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;
  align-items: center;
}

.itp-preview-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.itp-preview-title {
  font-size: 14px;
  font-weight: 850;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 6px;
}
.itp-preview-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.itp-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--text-heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition);
}
.itp-nav-btn:hover:not(:disabled) {
  background: var(--primary-cyan);
  color: #fff;
  border-color: var(--primary-cyan);
}
.itp-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.itp-nav-counter {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}

.itp-canvas-stage {
  width: 100%;
  max-width: 440px;
  min-height: 440px;
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.08);
}
.itp-preview-canvas {
  max-width: 100%;
  max-height: 480px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  border-radius: 2px;
  background: #fff;
}

/* ========================================================
   PROGRESS BAR
   ======================================================== */
.itp-progress-card {
  margin-top: 18px;
  padding: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: none;
  width: 100%;
  box-sizing: border-box;
}
.itp-progress-card.active {
  display: block;
}
.itp-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 8px;
}
.itp-progress-track {
  width: 100%;
  height: 10px;
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.itp-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-cyan), #10b981);
  border-radius: 6px;
  transition: width 0.2s ease;
}

/* ========================================================
   RESULTS CARD
   ======================================================== */
.itp-results-card {
  margin-top: 22px;
  padding: 24px;
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.06);
  border-radius: var(--radius-xl);
  display: none;
  width: 100%;
  box-sizing: border-box;
}
.itp-results-card.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.itp-results-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 900;
  color: #10b981;
  margin-bottom: 16px;
}

.itp-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.itp-metric-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
}
.itp-metric-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.itp-metric-value {
  font-size: 17px;
  font-weight: 900;
  color: var(--text-heading);
}

.itp-download-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: #10b981;
  color: #fff;
  font-size: 15.5px;
  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: 12px;
}
.itp-download-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.itp-secondary-actions {
  display: flex;
  gap: 10px;
}
.itp-btn-secondary {
  flex: 1;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-heading);
  font-size: 12.5px;
  font-weight: 750;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.itp-btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}
