/* ==========================================================================
   ToolVexa - Interactive Tool-Specific Styles
   ========================================================================== */

/* Upload Dropzone */
.dropzone {
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background-color: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.dropzone-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.dropzone-icon svg {
  width: 2rem;
  height: 2rem;
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.dropzone-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Tool Page Wrapper & Sidebar Layout */
.tool-container {
  padding: 2.5rem 0 4rem;
}

.tool-header-banner {
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
  color: #FFFFFF;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.tool-header-banner h1 {
  color: #FFFFFF;
  margin-bottom: 0.5rem;
  font-size: 2.2rem;
}

.tool-header-banner p {
  color: var(--slate-300);
  max-width: 650px;
}

.tool-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
}

@media (max-width: 992px) {
  .tool-workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Label Cropper Section */
.cropper-stage-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cropper-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.cropper-canvas-wrapper {
  position: relative;
  margin: 0 auto;
  max-width: 100%;
  overflow: auto;
  background-color: #E2E8F0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  user-select: none;
}

/* Crop Box & Handles */
.crop-box {
  position: absolute;
  border: 2px dashed #4F46E5;
  background: rgba(79, 70, 229, 0.12);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
  cursor: move;
  z-index: 10;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: #FFFFFF;
  border: 2px solid #4F46E5;
  border-radius: 2px;
}

.crop-handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-handle-n { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.crop-handle-s { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.crop-handle-w { left: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.crop-handle-e { right: -6px; top: calc(50% - 6px); cursor: ew-resize; }

/* Cropped Labels Gallery */
.labels-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.label-thumb-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.label-thumb-img {
  max-height: 140px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--slate-200);
}

.label-thumb-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8rem;
}

/* A4 Sheet Interactive Canvas Preview */
.a4-preview-card {
  background-color: var(--slate-800);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.a4-sheet-container {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 210 / 297;
  background-color: #FFFFFF;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
  border-radius: 4px;
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 10mm; /* A4 Margin representation */
  box-sizing: border-box;
}

.a4-grid-cell {
  border: 1px dashed rgba(79, 70, 229, 0.3);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
}

.a4-grid-cell img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Image Maker Variant Cards */
.variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.variant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
  transition: var(--transition);
}

.variant-card:hover {
  box-shadow: var(--shadow-lg);
}

.variant-preview-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--slate-100);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.variant-preview-box canvas, .variant-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.variant-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Stats Comparison Bar */
.stats-badge-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--slate-100);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  flex-wrap: wrap;
}

.stat-pill {
  font-weight: 700;
  font-size: 0.85rem;
}

.stat-pill.success { color: var(--accent); }
.stat-pill.primary { color: var(--primary); }

/* Calculator Specific Styling */
.calc-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.result-hero-box {
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
  color: #FFFFFF;
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 1.5rem;
}

.result-hero-value {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  margin: 0.5rem 0;
}

.result-hero-value.negative {
  color: #F87171;
}

.result-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.result-breakdown-table td {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.result-breakdown-table tr:last-child td {
  border-bottom: none;
}

.result-breakdown-table td.val {
  text-align: right;
  font-weight: 700;
}

.progress-bar-container {
  height: 12px;
  width: 100%;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  margin: 1.25rem 0;
}

.progress-segment {
  height: 100%;
  transition: width 0.4s ease;
}

.segment-cost { background-color: #64748B; }
.segment-shipping { background-color: #3B82F6; }
.segment-fee { background-color: #F59E0B; }
.segment-profit { background-color: #10B981; }
