/* ========================
   Tool Page Specific Styles
   ======================== */

/* Upload Zone */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 1rem;
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

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

.upload-zone-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.75rem;
  border-radius: 9999px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-zone h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.upload-zone p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Tabs */
.tool-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tool-tabs::-webkit-scrollbar {
  display: none;
}

.tool-tab {
  flex: 1;
  min-width: 100px;
  padding: 1rem 0.75rem;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tool-tab:hover {
  color: var(--primary);
}

.tool-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(124, 58, 237, 0.05);
}

.tool-panels {
  padding: 1.5rem;
}

.tool-panel {
  display: none;
}

.tool-panel.active {
  display: block;
}

/* Tool Layout */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .tool-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tool-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Canvas Containers */
.canvas-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  background: #f1f5f9;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.canvas-wrapper img,
.canvas-wrapper canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  cursor: crosshair;
}

/* Info text */
.tool-info {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.tool-info strong {
  color: var(--text);
}

/* Ratio Buttons */
.ratio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ratio-btn {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: none;
  background: #f1f5f9;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ratio-btn:hover {
  background: #e2e8f0;
}

.ratio-btn.active {
  background: var(--primary);
  color: white;
}

/* Watermark Position Grid */
.wm-position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.wm-position-btn {
  padding: 0.625rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: white;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.wm-position-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.wm-position-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Type Toggle */
.type-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 0.75rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.type-toggle button {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.type-toggle button.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* Compress Stats */
.compress-stats {
  background: #f8fafc;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-top: 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}

.stat-row:last-child {
  margin-bottom: 0;
}

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

.stat-value {
  font-weight: 700;
}

.stat-value.save {
  color: #16a34a;
}

.stat-value.size {
  color: var(--primary);
}

/* Result Box */
.result-box {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--primary-light);
  border-radius: 0.75rem;
  border: 1px solid #ddd6fe;
}

.result-box p {
  margin-bottom: 0.75rem;
}

/* Hint text */
.hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Batch Processing */
.batch-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 1rem;
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

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

.batch-upload-zone .upload-zone-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.75rem;
}

.batch-toolbar {
  background: #f8fafc;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.batch-action-btn {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.batch-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.batch-action-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.batch-options {
  display: grid;
  gap: 0.75rem;
}

.batch-file-list {
  background: #f8fafc;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  min-height: 120px;
}

.batch-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  padding: 2rem 0;
}

.batch-list {
  display: grid;
  gap: 0.5rem;
}

.batch-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
}

.batch-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.batch-list-size {
  color: var(--text-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.batch-list-status {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  white-space: nowrap;
}

/* Responsive tool */
@media (max-width: 768px) {
  .tool-tabs {
    padding: 0 0.5rem;
  }

  .tool-tab {
    min-width: 85px;
    padding: 0.875rem 0.625rem;
    font-size: 0.875rem;
  }

  .tool-panels {
    padding: 1rem;
  }

  .upload-zone {
    padding: 1.75rem 1rem;
  }
}
