/* Tool Section */
.tool-section {
  padding: 3rem 0;
  min-height: calc(100vh - 4rem - 300px);
}

.tool-header {
  text-align: center;
  margin-bottom: 2rem;
}

.tool-header h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.tool-workspace {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

/* Sidebar */
.tool-sidebar {
  width: 300px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  position: sticky;
  top: 6rem;
}

.control-group {
  margin-bottom: 1.5rem;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
}

/* Layout Options */
.layout-options {
  display: flex;
  gap: 0.5rem;
}

.layout-btn {
  flex: 1;
  padding: 0.75rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.layout-btn:hover {
  background-color: var(--border-color);
}

.layout-btn.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Inputs */
input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.input-select {
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  outline: none;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.url-input-group {
  display: flex;
  gap: 0.5rem;
}

.input-url {
  flex: 1;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  width: 100%;
  min-width: 0; /* Prevent overflow */
}

/* Image List (Reordering) */
.image-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.image-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.image-list-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 2px);
  background-color: #ddd;
}

.image-list-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: auto;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 2px;
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 0.8rem;
  line-height: 1;
}

.btn-icon:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

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

.color-picker-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.hex-input-container {
  display: flex;
  background-color: #000;
  padding: 2px;
  align-items: center;
  border-radius: var(--radius-sm);
}

.hex-label {
  color: #fff;
  font-weight: 600;
  padding: 0 10px;
  font-family: var(--font-family);
  font-size: 0.9rem;
}

.hex-input {
  flex: 1;
  border: none;
  padding: 8px;
  font-family: monospace;
  font-size: 1rem;
  color: #555;
  text-transform: uppercase;
  outline: none;
  margin-right: 2px;
}

.quick-colors {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 0.25rem 0;
}

.quick-color {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.quick-color:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-sm);
}

input[type="color"] {
  -webkit-appearance: none;
  border: 1px solid var(--border-color);
  width: 100%;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: calc(var(--radius-sm) - 1px);
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.5rem 0;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Canvas Area */
.tool-canvas-area {
  flex: 1;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  min-height: 500px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.dropzone {
  flex: 1;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  background-color: var(--bg-color);
  overflow: auto; /* For large canvas */
}

.dropzone.dragover {
  border-color: var(--primary);
  background-color: rgba(59, 130, 246, 0.05);
}

.dropzone-content {
  text-align: center;
  pointer-events: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: inline-block;
}

.dropzone-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

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

#mainCanvas {
  max-width: 100%;
  display: none; /* Hidden until image added */
  box-shadow: var(--shadow-sm);
  cursor: grab;
  z-index: 5;
  transition: transform 0.1s;
}

#mainCanvas:active {
  cursor: grabbing;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
  .tool-workspace {
    flex-direction: column;
  }
  
  .tool-sidebar {
    width: 100%;
    position: static;
  }

  .tool-canvas-area {
    width: 100%;
    min-height: 350px;
  }

  .image-editor-sidebar {
    width: 100%;
  }
}
