/* Layout Tool Specific Styles */

/* Master Canvas Styling */
#master-canvas {
  background-color: var(--background);
  border: 2px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Tool Sidebar Styling */
#tool-sidebar {
  background-color: var(--card);
  border: 1px solid var(--border);
  color: var(--card-foreground);
}

#tool-sidebar h3 {
  color: var(--foreground);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

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

#tool-sidebar .control-group:last-child {
  padding: 0.5rem 0.75rem;
  background-color: var(--background);
  color: var(--foreground);
  font-size: var(--text-sm);
}

.layout-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
  border-color: var(--ring);
}

/* Layout Tool Labels */
.layout-label {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--foreground);
  margin-bottom: var(--spacing-2);
}

/* Preset Selection */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.preset-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background-color: var(--background);
  cursor: pointer;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.preset-item:hover {
  background-color: var(--accent);
  border-color: var(--primary);
}

.preset-item.selected {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.preset-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.preset-name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.preset-dimensions {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-left: auto;
}

/* Artboard Grid */
#artboards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr);
  gap: 1.5rem;
}

.artboard-item {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem;
  text-align: center;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
  overflow-x: auto;
}

.artboard-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.artboard-canvas {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 0.75rem;
  background-color: var(--background);
  max-width: 100%;
  height: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.artboard-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.artboard-dimensions {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.artboard-info {
  margin-bottom: 0.75rem;
}

.artboard-info span {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: capitalize;
}

/* File Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 2rem;
  text-align: center;
  background-color: var(--background);
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--primary);
  background-color: var(--accent);
}

.upload-area.dragover {
  border-color: var(--primary);
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.upload-text {
  color: var(--foreground);
  font-size: var(--text-sm);
  margin-bottom: var(--spacing-2);
}

.upload-hint {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

/* Progress Indicators */
.progress-bar {
  width: 100%;
  height: 0.5rem;
  background-color: var(--secondary);
  border-radius: 0.25rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

/* Utility Classes */
.space-y-2>*+* {
  margin-top: 0.5rem;
}

.w-full {
  width: 100%;
}

.w-auto {
  width: auto;
}

.min-w-100 {
  min-width: 100px;
}

.min-w-80 {
  min-width: 80px;
}

.min-w-60 {
  min-width: 60px;
}

.mr-2 {
  margin-right: 0.5rem;
}

.mb-2 {
  margin-bottom: var(--spacing-2);
}

.mb-0 {
  margin-bottom: 0;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: var(--text-sm);
}

.font-semibold {
  font-weight: 600;
}

.first\:mt-0:first-child {
  margin-top: 0;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success States */
.success {
  border-color: hsl(142 76% 36%);
  background-color: rgba(34, 197, 94, 0.1);
}

/* Error States */
.error {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .grid.lg\:grid-cols-4 {
    grid-template-columns: 1fr;
  }

  #tool-sidebar {
    margin-bottom: 1.5rem;
  }

  #master-canvas {
    max-width: 100vw;
    height: auto;
  }
  .artboard-item {
    max-width: 100vw;
    overflow-x: auto;
  }
}

@media (max-width: 768px) {
  #topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  #topbar .flex {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .layout-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }

  #artboards {
    grid-template-columns: 1fr;
  }

  .preset-grid {
    max-height: 200px;
  }

  #master-canvas {
    max-width: 100%;
    height: auto;
  }
}

@media (max-width: 640px) {
  .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #topbar .flex>div {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .layout-label {
    font-size: 0.75rem;
  }

  .layout-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
}
/* Layo
ut Editor Styles */
#layout-editor-overlay {
  font-family: inherit;
}

#layout-editor-overlay .space-y-6 > * + * {
  margin-top: 1.5rem;
}

#layout-editor-overlay .space-y-3 > * + * {
  margin-top: 0.75rem;
}

#layout-editor-overlay .space-y-2 > * + * {
  margin-top: 0.5rem;
}

#layout-editor-overlay .hidden {
  display: none;
}

#layout-editor-overlay .flex {
  display: flex;
}

#layout-editor-overlay .flex-1 {
  flex: 1;
}

#layout-editor-overlay .flex-col {
  flex-direction: column;
}

#layout-editor-overlay .items-center {
  align-items: center;
}

#layout-editor-overlay .justify-between {
  justify-content: space-between;
}

#layout-editor-overlay .justify-center {
  justify-content: center;
}

#layout-editor-overlay .gap-2 {
  gap: 0.5rem;
}

#layout-editor-overlay .gap-4 {
  gap: 1rem;
}

#layout-editor-overlay .w-80 {
  width: 20rem;
}

#layout-editor-overlay .p-4 {
  padding: 1rem;
}

#layout-editor-overlay .p-8 {
  padding: 2rem;
}

#layout-editor-overlay .mb-3 {
  margin-bottom: 0.75rem;
}

#layout-editor-overlay .mt-2 {
  margin-top: 0.5rem;
}

#layout-editor-overlay .mr-1 {
  margin-right: 0.25rem;
}

#layout-editor-overlay .overflow-y-auto {
  overflow-y: auto;
}

#layout-editor-overlay .overflow-auto {
  overflow: auto;
}

#layout-editor-overlay .rounded-lg {
  border-radius: calc(var(--radius) - 2px);
}

#layout-editor-overlay .shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#layout-editor-overlay .border-b {
  border-bottom-width: 1px;
}

#layout-editor-overlay .border-r {
  border-right-width: 1px;
}

#layout-editor-overlay .border-gray-300 {
  border-color: #d1d5db;
}

#layout-editor-overlay .bg-white {
  background-color: #ffffff;
}

#layout-editor-overlay .text-xl {
  font-size: var(--text-xl);
}

#layout-editor-overlay .font-bold {
  font-weight: 700;
}

#layout-editor-overlay .text-red-500 {
  color: #ef4444;
}

#layout-editor-overlay .hover\:text-red-700:hover {
  color: #b91c1c;
}

/* Element list item styles */
#layout-editor-overlay .delete-element {
  opacity: 0;
  transition: opacity 0.2s;
}

#layout-editor-overlay .delete-element:hover,
#layout-editor-overlay div:hover .delete-element {
  opacity: 1;
}

/* Canvas container in editor */
#layout-editor-overlay #editor-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Responsive adjustments for editor */
@media (max-width: 1024px) {
  #layout-editor-overlay .w-80 {
    width: 16rem;
  }
}

@media (max-width: 768px) {
  #layout-editor-overlay .flex {
    flex-direction: column;
  }
  
  #layout-editor-overlay .w-80 {
    width: 100%;
    max-height: 40vh;
  }
  
  #layout-editor-overlay .p-8 {
    padding: 1rem;
  }
  
  #layout-editor-overlay .text-xl {
    font-size: var(--text-lg);
  }
  
  #layout-editor-overlay .gap-4 {
    gap: 0.5rem;
  }
}/* Enhanc
ed Preset List Styles */
.preset-grid .mb-3 {
  margin-bottom: 0.75rem;
}

.preset-grid .flex {
  display: flex;
}

.preset-grid .flex-1 {
  flex: 1;
}

.preset-grid .gap-2 {
  gap: 0.5rem;
}

.preset-grid .text-sm {
  font-size: var(--text-sm);
}

.preset-grid .font-bold {
  font-weight: 700;
}

.preset-grid .border-b {
  border-bottom-width: 1px;
}

.preset-grid .pb-1 {
  padding-bottom: 0.25rem;
}

.preset-grid .mt-3 {
  margin-top: 0.75rem;
}

.preset-grid .ml-2 {
  margin-left: 0.5rem;
}

/* Improved preset item layout */
.preset-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background-color: var(--background);
  cursor: pointer;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: var(--spacing-2);
}

.preset-item .flex-1 {
  flex: 1;
  min-width: 0;
}

.preset-item .preset-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--foreground);
  line-height: 1.2;
}

.preset-item .preset-dimensions {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
  line-height: 1;
}

/* Search input styling */
#preset-list .layout-input {
  font-size: var(--text-sm);
  padding: 0.5rem;
}

/* Select buttons styling */
#select-all-presets,
#select-none-presets {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
}

/* Category headers */
.preset-grid .text-sm.font-bold {
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-bottom: var(--spacing-2);
  margin-top: 1rem;
}

.preset-grid .text-sm.font-bold:first-child {
  margin-top: 0;
}

/* Subcategory headers */
.preset-grid .text-xs.font-semibold {
  color: var(--muted-foreground);
  margin-left: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: var(--spacing-2);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Preset grid container improvements */
.preset-grid {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Custom scrollbar for preset grid */
.preset-grid::-webkit-scrollbar {
  width: 6px;
}

.preset-grid::-webkit-scrollbar-track {
  background: var(--muted);
  border-radius: 3px;
}

.preset-grid::-webkit-scrollbar-thumb {
  background: var(--muted-foreground);
  border-radius: 3px;
}

.preset-grid::-webkit-scrollbar-thumb:hover {
  background: var(--foreground);
}

/* Responsive improvements for preset list */
@media (max-width: 768px) {
  .preset-grid {
    max-height: 300px;
  }
  
  .preset-item {
    padding: 0.5rem;
  }
  
  .preset-item .preset-name {
    font-size: 0.8125rem;
  }
  
  .preset-item .preset-dimensions {
    font-size: 0.6875rem;
  }
}