/* ===================================
   Tool: id-photo-maker
   =================================== */

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-color, #ccc);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-secondary);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(76, 175, 145, 0.05);
}
.upload-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}
.upload-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}
.upload-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Edit Card */
.edit-card {
  overflow: visible;
}
.edit-section {
  margin-bottom: var(--space-lg);
}
.edit-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

/* Size Presets */
.size-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.size-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border-color, #ddd);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 90px;
}
.size-btn:hover {
  border-color: var(--accent);
}
.size-btn.active {
  border-color: var(--accent);
  background: rgba(76, 175, 145, 0.1);
}
.size-btn-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.size-btn-size {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Editor Area */
.editor-area {
  margin-bottom: var(--space-lg);
  text-align: center;
}
.canvas-wrapper {
  position: relative;
  display: inline-block;
  cursor: grab;
  border: 2px solid var(--border-color, #ddd);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f0f0f0;
  touch-action: none;
}
.canvas-wrapper:active {
  cursor: grabbing;
}
#editorCanvas {
  display: block;
}
.editor-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

/* Guide Overlay */
.guide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.guide-head {
  position: absolute;
  left: 15%;
  right: 15%;
  border: 1px dashed rgba(255, 100, 100, 0.6);
  border-radius: 50%;
  background: rgba(255, 100, 100, 0.05);
}
.guide-chin {
  position: absolute;
  left: 20%;
  right: 20%;
  border-top: 1px dashed rgba(100, 100, 255, 0.5);
}

/* Slider Row */
.slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.slider-row input[type="range"] {
  flex: 1;
}
.slider-icon {
  font-size: 0.85rem;
  white-space: nowrap;
}
.slider-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 50px;
  text-align: right;
}

/* Background Color Options */
.bg-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.bg-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border: 2px solid var(--border-color, #ddd);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}
.bg-btn:hover {
  border-color: var(--accent);
}
.bg-btn.active {
  border-color: var(--accent);
  background: rgba(76, 175, 145, 0.1);
}
.bg-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #ccc;
}
.bg-color-input {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

/* Background Removal */
.bg-remove-area {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.bg-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
}
.bg-remove-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.bg-remove-status {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}
.bg-remove-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  line-height: 1.5;
}

/* Touch-up Toolbar */
.touchup-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.touchup-modes {
  display: flex;
  gap: var(--space-sm);
}
.touchup-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border: 2px solid var(--border-color, #ddd);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
.touchup-mode-btn:hover {
  border-color: var(--accent);
}
.touchup-mode-btn.active[data-mode="erase"] {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}
.touchup-mode-btn.active[data-mode="restore"] {
  border-color: #27ae60;
  background: rgba(39, 174, 96, 0.1);
  color: #27ae60;
}
.touchup-brush-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.touchup-brush-row input[type="range"] {
  flex: 1;
}

/* Brush Cursor */
.brush-cursor {
  position: absolute;
  border: 2px solid rgba(255, 80, 80, 0.8);
  border-radius: 50%;
  pointer-events: none;
  display: none;
  z-index: 10;
  box-sizing: border-box;
}

/* Adjustments */
.adjust-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.adjust-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.adjust-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 80px;
}
.adjust-row input[type="range"] {
  flex: 1;
}
.adjust-val {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 30px;
  text-align: right;
}
.adjust-reset {
  background: none;
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}
.adjust-reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}
.toggle-switch input {
  display: none;
}
.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 12px;
  transition: background 0.3s ease;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(20px);
}
.toggle-label {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Edit Actions */
.edit-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Export Section */
.export-options {
  margin-bottom: var(--space-lg);
}
.export-row {
  margin-bottom: var(--space-md);
}
.format-btns {
  display: flex;
  gap: var(--space-sm);
}
.format-btn {
  padding: var(--space-xs) var(--space-lg);
  border: 2px solid var(--border-color, #ddd);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
.format-btn:hover {
  border-color: var(--accent);
}
.format-btn.active {
  border-color: var(--accent);
  background: rgba(76, 175, 145, 0.1);
  color: var(--accent);
}
.export-row select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--bg-card);
}
.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Print Preview */
.print-preview {
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  text-align: center;
}
.print-preview h4 {
  margin-bottom: var(--space-md);
  font-size: 1rem;
  color: var(--text-primary);
}
.print-preview canvas {
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

/* Size Table in Sidebar */
.size-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.size-table th,
.size-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-color, #eee);
}
.size-table th {
  font-weight: 600;
  color: var(--text-primary);
}
.size-table td {
  color: var(--text-secondary);
}

/* Tips Section */
.tips-section {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.tips-header { margin-bottom: var(--space-lg); }
.tips-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}
.tip-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  gap: var(--space-md);
}
.tip-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.tip-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}
.tip-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .size-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .size-btn {
    min-width: auto;
  }
  .bg-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .adjust-name {
    min-width: 60px;
    font-size: 0.8rem;
  }
  .export-buttons {
    flex-direction: column;
  }
  .export-buttons .btn {
    width: 100%;
  }
  .tips-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .size-presets {
    grid-template-columns: repeat(2, 1fr);
  }
  .bg-options {
    grid-template-columns: repeat(2, 1fr);
  }
  .edit-actions {
    flex-direction: column;
  }
  .format-btns {
    flex-direction: column;
  }
}
