/* Annotation Tool - App Canvas Styles */
.app-layout {
  display: flex;
  height: calc(100vh - 73px);
  overflow: hidden;
  background: #f3f4f6;
}

.toolbar {
  width: 280px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.toolbar-section {
  margin-bottom: 2rem;
  animation: fadeIn 0.5s ease;
}

.toolbar-section h3 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1rem;
  letter-spacing: 0.5px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
}

.tool-btn {
  width: 100%;
  height: 56px;
  border: 2px solid var(--border);
  border-radius: 0.625rem;
  background: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: var(--text);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.tool-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tool-btn > * {
  position: relative;
  z-index: 1;
}

.tool-btn i {
  font-size: 1.25rem;
}

.tool-btn span {
  font-size: 0.6875rem;
  font-weight: 600;
}

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

.tool-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tool-btn.active::before {
  opacity: 1;
}

.tool-btn.active,
.tool-btn.active i,
.tool-btn.active span {
  color: white;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
}

.color-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.5rem;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.color-btn::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 0.375rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

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

.color-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text);
}

.custom-color-wrapper {
  grid-column: span 4;
  margin-top: 0.5rem;
}

.custom-color-wrapper input[type="color"] {
  width: 100%;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-color-wrapper input[type="color"]:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.stroke-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
}

.stroke-btn {
  width: 100%;
  height: 48px;
  border-radius: 0.5rem;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.stroke-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stroke-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.toolbar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toolbar-actions .btn {
  width: 100%;
  justify-content: center;
  font-size: 0.9375rem;
  padding: 0.875rem;
}

.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: auto;
  position: relative;
}

.canvas-wrapper {
  position: relative;
  background: white;
  box-shadow: var(--shadow-xl);
  border-radius: 0.75rem;
  overflow: hidden;
  min-width: 400px;
  min-height: 300px;
  max-width: 90vw;
  border: 1px solid var(--border);
}

#mainCanvas {
  display: block;
  cursor: crosshair;
}

.upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border: 3px dashed var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
}

.upload-overlay:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.upload-overlay.hidden {
  display: none;
}

.upload-content {
  text-align: center;
  padding: 2rem;
}

.upload-content i {
  font-size: 4rem;
  color: var(--primary);
  margin-bottom: 1rem;
  opacity: 0.7;
  animation: float 3s ease-in-out infinite;
}

.upload-content p {
  color: var(--text-muted);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.export-btn {
  margin-top: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.user-info i {
  font-size: 1rem;
}

@media (max-width: 1024px) {
  .toolbar {
    width: 240px;
    padding: 1rem;
  }
  
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  
  .toolbar {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .canvas-area {
    padding: 1rem;
  }
}
