/* Dedicated Workspace Styles for All Image Tools */

.tool-workspace {
  padding: 2.5rem 0 4rem;
  min-height: calc(100vh - 72px - 250px);
}

.tool-header-hero {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 2.5rem;
}

.tool-header-hero h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.tool-header-hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Upload Dropzone */
.dropzone-container {
  max-width: 820px;
  margin: 0 auto 3rem;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.dropzone-icon-box {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  transition: var(--transition);
}

.dropzone:hover .dropzone-icon-box {
  transform: scale(1.1) rotate(-5deg);
}

.dropzone-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.dropzone-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.dropzone-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.badge-privacy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-light);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.badge-formats {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Tool Main Workspace Layout */
.workspace-wrapper {
  display: none; /* Shown once image is loaded */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-bottom: 3.5rem;
}

.workspace-active {
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 600px;
}

/* Canvas / Preview Stage */
.preview-stage {
  background: var(--bg-main);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.canvas-container {
  max-width: 100%;
  max-height: 520px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-container canvas,
.canvas-container img {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  background: repeating-conic-gradient(#80808020 0% 25%, transparent 0% 50%) 50% / 20px 20px;
}

/* Interactive Before / After Split Slider */
.comparison-slider-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 400px;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  user-select: none;
}

.comparison-image-before,
.comparison-image-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comparison-image-before {
  z-index: 1;
}

.comparison-image-after {
  z-index: 2;
  width: 50%;
  overflow: hidden;
}

.comparison-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #ffffff;
  z-index: 3;
  cursor: ew-resize;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.comparison-handle-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: #ffffff;
  color: var(--primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Sidebar / Controls Panel */
.controls-panel {
  padding: 1.75rem;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  max-height: 650px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-reset {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-reset:hover {
  color: var(--danger);
}

/* Form Controls & Groups */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-value-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Range Slider */
.custom-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 2px 6px var(--primary-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Radio / Pill Grid Selector */
.pill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  gap: 0.5rem;
}

.pill-option {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.5rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-main);
  color: var(--text-muted);
  transition: var(--transition);
}

.pill-option:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.pill-option.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

/* Inputs & Selects */
.custom-input, .custom-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.custom-input:focus, .custom-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Dimension Inputs Row */
.dimensions-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.aspect-lock-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.aspect-lock-btn.locked {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Metrics & Stats Box */
.metrics-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.metric-label {
  color: var(--text-muted);
}

.metric-value {
  font-weight: 700;
  color: var(--text-main);
}

.metric-savings {
  color: var(--success);
  font-weight: 800;
  background: var(--success-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
}

/* Batch Processing Item Gallery */
.batch-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.batch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.batch-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
}

.batch-name {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.batch-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.batch-remove:hover {
  background: var(--danger);
}

/* Step-By-Step SEO Guide Section */
.guide-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
}

.step-number {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--border);
  line-height: 1;
}

.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Color Palette Display */
.palette-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.palette-swatch-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.palette-swatch-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.swatch-color-box {
  height: 90px;
  width: 100%;
}

.swatch-details {
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.swatch-copied {
  font-size: 0.75rem;
  color: var(--success);
}

/* Meme Canvas Special Controls & Templates Modal */
.meme-text-inputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.meme-text-row {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meme-text-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.meme-del-btn {
  color: var(--danger);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
}

.meme-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.meme-modal-overlay.active {
  display: flex;
}

.meme-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 960px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.meme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.meme-modal-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
}

.meme-modal-search {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-main);
  display: flex;
  gap: 0.75rem;
}

.meme-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 60vh;
}

.meme-template-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.meme-template-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.meme-template-thumb {
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
}

.meme-template-title {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.btn-use-template {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-use-template:hover {
  background: var(--primary-hover);
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .workspace-active {
    grid-template-columns: 1fr;
  }
  
  .preview-stage {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 380px;
  }
  
  .controls-panel {
    max-height: none;
  }
}
