/* =============================================================================
   TOOLS.CSS - Comprehensive Tool Navigation and Panel Styles
   
   This file consolidates all tool navigation and panel CSS from styles.css 
   and css/typoji.css for better organization and maintainability.
   ============================================================================= */

/* =============================================================================
   TOOL NAVIGATION
   ============================================================================= */

/* Tool navigation container */
.tool-nav {
  display: flex;
  background-color: #1e293b; /* Dark blue background */
  border-radius: 4px;
  overflow: hidden;
}

/* All tool buttons - start with blue background */
.tool-btn {
  padding: 0.75rem 1.25rem;
  background-color: #1e293b !important; /* Force blue for all buttons initially */
  color: white;
  border: none;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s;
  flex: 1;
}

.tool-btn:hover {
  background-color: #2d3748 !important; /* Slightly lighter blue on hover */
}

/* Only active buttons get green - with higher priority */
.tool-btn.active {
  background-color: #10b981 !important; /* Green for active state */
}

/* Remove any special styling for first button */
.tool-btn:first-child {
  background-color: #1e293b !important; /* Same as other buttons */
}

/* But if first button is active, make it green */
.tool-btn:first-child.active {
  background-color: #10b981 !important;
}

.tool-btn i {
  font-size: 1rem;
}

/* Panel container */
.panel-container {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.panel-container.open {
  max-height: 500px; /* Adjust based on content */
}

/* Tool panels */
.tool-panel {
  display: none;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 4px 4px;
}

.tool-panel.active {
  display: block;
}

/* Toolbar buttons */
.toolbar-btn {
  background: none;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

/* Panel headers */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.close-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.close-btn:hover {
  background-color: #f1f5f9;
  color: #334155;
}

.panel-content {
  padding: 1rem;
}

/* Canvas section - for moving up/down */
.canvas-section {
  transition: transform 0.3s ease, margin-top 0.3s ease;
  margin-top: 0;
}

.canvas-section.shifted {
  margin-top: 1rem;
}

/* =============================================================================
   TEXT PANEL
   ============================================================================= */

/* Controls grid layout */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: #64748b;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.control-section {
  margin-bottom: 1.25rem;
}

/* Text preview container */
.text-preview-container {
  position: relative;
  margin-top: 0.75rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.25rem;
  overflow: hidden;
  background: linear-gradient(45deg, #f9fafb 25%, transparent 25%, transparent 75%, #f9fafb 75%, #f9fafb), 
              linear-gradient(45deg, #f9fafb 25%, transparent 25%, transparent 75%, #f9fafb 75%, #f9fafb);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.text-preview {
  padding: 0.75rem 0.75rem 0.75rem 2rem;
  min-height: 3rem;
  height: auto;
  max-height: 6rem;
  overflow-y: auto;
  display: flex;
  align-items: center;
  text-align: center;
  justify-content: center;
  cursor: text;
  background-color: #f8fafc;
  font-family: Arial;
  font-size: 1rem;
  word-break: break-word;
  transition: background-color 0.2s;
  outline: none;
}

.text-preview:hover {
  background-color: #f1f5f9;
}

.text-preview:empty:before {
  content: attr(data-placeholder);
  color: #808080;
  pointer-events: none;
}

/* Drag handle */
.drag-handle {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e2e8f0;
  cursor: grab;
  color: #64748b;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 5;
}

.drag-handle:hover {
  opacity: 1;
}

.drag-active {
  opacity: 0.7;
  background-color: #e2e8f0;
}

/* Text effects sections */
.text-effects-section {
  margin-top: 0.25rem;
  border-top: none;
  padding-top: 0.25rem;
  padding-right: 0.25rem;
  float: left;
  width: 50%;
}

.effects-header {
  margin-bottom: 0.5rem;
}

.effects-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  white-space: nowrap;
  width: 110px;
}

.effects-toggle input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: #3b82f6;
  width: 1rem;
  height: 1rem;
}

.effects-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background-color: #f8fafc;
  border-radius: 0.25rem;
  border: 1px solid #e2e8f0;
}

/* Two-column layout for text panel */
.text-panel-layout {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.text-panel-column-left {
  flex: 1;
  min-width: 0;
  max-width: 250px;
}

.text-panel-column {
  flex: 1;
  min-width: 0;
}

/* Effects panel layout */
.effects-panel {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.effects-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  padding-top: 0.25rem;
}

.effects-controls-column {
  flex: 1;
  min-width: 0;
}

.effects-controls-group {
  margin-bottom: 1rem;
  padding: 0.375rem 0;
}

/* Effect row layout */
.effect-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background-color: #f8fafc;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

.effect-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
  color: #4b5563;
}

.toggle-label input[type="checkbox"] {
  margin-right: 0.5rem;
}

.effect-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid #e2e8f0;
}

.control-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slider-container {
  flex: 1;
  min-width: 150px;
  max-width: 200px;
}

.control-group-text-outline,
.control-group-text-shadow {
  flex-direction: row;
}

/* Font family styling */
.font-family {
  width: 120px !important;
}

/* =============================================================================
   SHAPES PANEL
   ============================================================================= */

#shapes-panel .panel-content {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 15px !important;
  padding: 16px !important;
}

#shapes-panel .mb-4 {
  margin-bottom: 0 !important;
  flex: 0 0 auto !important;
}

#shapes-panel .grid,
#shapes-panel .grid-cols-3 {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 10px !important;
  margin-bottom: 0 !important;
  flex: 1 !important;
}

.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px !important;
  height: 48px !important;
  padding: 8px !important;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  background-color: white;
  cursor: pointer;
  flex: 0 0 auto !important;
}

.shape-btn:hover {
  background-color: #f9fafb;
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.shape-btn.active {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.shape-btn.active svg {
  color: white;
}

.shape-btn svg {
  width: 24px !important;
  height: 24px !important;
  margin-bottom: 0 !important;
  color: #3b82f6;
  transition: color 0.2s;
}

.shape-btn span {
  display: none !important;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Opacity control */
#shapes-panel .mb-2 {
  width: 100% !important;
  margin-top: 15px !important;
  order: 99 !important;
}

#shapeOpacity {
  width: 200px;
  margin: 0 auto;
  display: block;
  padding: none !important;
}

.mb-2 {
  max-width: 200px;
  margin: 10px auto;
}

/* =============================================================================
   LAYERS PANEL
   ============================================================================= */

/* Enhanced layers panel */
#layers-panel .panel-content {
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem;
  max-height: 500px;
  overflow: visible;
}

#layers-panel {
  min-height: 200px;
}

.tool-panel#layers-panel.active {
  max-height: 600px;
}

/* Layers panel grid layout */
.layers-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

/* Z-Order section (left) */
.z-order-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.z-order-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

/* Objects list section (right) */
.objects-list-section {
  width: 100%;
  min-width: 0;
}

/* Layer buttons */
.layer-btn {
  flex: 1;
  min-width: 80px;
  font-size: 0.875rem;
}

.layer-btn i {
  margin-right: 0.25rem;
}

/* Layer grid layout */
.layer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 300px;
  margin: 0;
}

.layer-grid .layer-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  height: 40px;
  font-size: 0.875rem;
  margin: 0;
  text-align: left;
}

.layer-grid .layer-btn i {
  margin-right: 4px;
}

.z-order-section .layer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

.z-order-section .layer-btn {
  font-size: 0.75rem;
  padding: 0.5rem;
  height: 36px;
}

.z-order-section .layer-btn i {
  font-size: 0.875rem;
}

/* Layers list container */
.layers-list-container {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-height: 300px;
}

.layers-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background-color: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.list-title {
  font-weight: 600;
  color: #334155;
  font-size: 0.875rem;
}

.object-count {
  font-size: 0.75rem;
  color: #64748b;
  background-color: #f1f5f9;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

/* Layers list */
.layers-list {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 336px; /* 7 items × 48px */
  min-height: 100px;
  flex: 1;
}

/* Empty state */
.layers-list-empty {
  padding: 2rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* Layer item */
.layer-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.layer-item:last-child {
  border-bottom: none;
}

.layer-item:hover {
  background-color: #f1f5f9;
}

.layer-item.selected {
  background-color: #dbeafe;
  border-left: 3px solid #3b82f6;
  padding-left: calc(0.75rem - 3px);
}

/* Layer number */
.layer-number {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e2e8f0;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.layer-item.selected .layer-number {
  background-color: #3b82f6;
  color: white;
}

/* Layer icon */
.layer-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  margin-right: 0.75rem;
  flex-shrink: 0;
  font-size: 1rem;
  color: #64748b;
  overflow: hidden;
  position: relative;
  background-image: 
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

.layer-item.selected .layer-icon {
  border-color: #3b82f6;
  background-color: #fff;
}

.layer-item:hover .layer-icon {
  border-color: #cbd5e1;
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* Layer preview */
.layer-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.25rem;
  display: block;
}

.layer-icon img {
  image-rendering: crisp-edges;
  image-rendering: -webkit-crisp-edges;
}

/* Layer info */
.layer-info {
  flex: 1;
  min-width: 0;
  margin-right: 0.5rem;
}

.layer-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.layer-type {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.125rem;
}

/* Layer actions */
.layer-actions {
  display: flex;
  gap: 0.25rem;
  margin-left: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.layer-item:hover .layer-actions {
  opacity: 1;
}

.layer-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.layer-action-btn:hover {
  background-color: #fff;
  border-color: #e2e8f0;
  color: #334155;
}

.layer-action-btn.delete:hover {
  color: #ef4444;
  border-color: #fecaca;
  background-color: #fee2e2;
}

/* Edit button hover effect */
.layer-item button[title="Rename"]:hover {
  opacity: 1 !important;
  transform: scale(1.1);
}

/* Editable layer names */
.layer-item span[contenteditable="true"] {
  background-color: #fff !important;
  outline: 2px solid #2196F3 !important;
  outline-offset: -2px;
  padding: 2px 6px !important;
  border-radius: 3px;
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

.layer-item span[title="Double-click to rename"]:hover {
  background-color: rgba(0, 0, 0, 0.05);
  cursor: text;
}

.layer-item span[contenteditable="true"]:focus {
  animation: pulse-outline 0.5s ease-in-out;
}

/* Drag and drop styles */
.layer-item.dragging {
  opacity: 0.4;
}

.layer-item.drag-over {
  background-color: #e3f2fd !important;
}

.layer-item.drag-over-top {
  border-top: 3px solid #2196F3;
  padding-top: 5px;
}

.layer-item.drag-over-bottom {
  border-bottom: 3px solid #2196F3;
  padding-bottom: 5px;
}

.layer-item:hover .drag-handle {
  opacity: 0.7;
}

.layers-list.dragging .layer-item {
  cursor: move;
  transition: transform 0.2s ease, opacity 0.2s ease, border 0.2s ease, padding 0.2s ease;
}

.layers-list.dragging {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.layers-list.dragging .layer-item:not(.dragging) {
  cursor: pointer;
}

.layers-list.dragging .layer-item:not(.dragging):hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.layer-item.drag-ghost {
  transform: rotate(2deg);
  opacity: 0.8;
}

.drag-handle {
  cursor: grab;
}

.layer-item:active .drag-handle {
  cursor: grabbing;
}

.layer-item.drop-success {
  animation: drop-success 0.3s ease;
}

/* Loading state */
.layer-icon.loading {
  background-color: #f8fafc;
}

.layer-icon.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Layer controls section */
.layer-controls-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.layer-controls-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.75rem;
}

/* Scrollbar styling */
.layers-list::-webkit-scrollbar {
  width: 6px;
}

.layers-list::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.layers-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.layers-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* =============================================================================
   ALIGN PANEL
   ============================================================================= */

#align-panel .panel-content {
  padding: 1rem;
}

/* Align panel tab system */
.align-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}

.align-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: -2px;
}

.align-tab:hover {
  color: #334155;
  background-color: #f8fafc;
}

.align-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background-color: transparent;
}

.align-tab i {
  font-size: 1rem;
}

/* Tab content */
.align-content {
  min-height: 150px;
  position: relative;
}

.align-section-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.align-section-content.active {
  display: block;
}

/* Section styling */
.align-section,
.distribute-section,
.spacing-section,
.quick-actions-section {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.quick-actions-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.75rem;
}

/* Align reference dropdown */
.align-reference {
  margin-bottom: 1rem;
}

.align-reference label {
  font-size: 0.875rem;
  color: #64748b;
  margin-right: 0.5rem;
}

.align-reference select {
  padding: 0.25rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  background-color: white;
  cursor: pointer;
}

/* Align and distribute grids */
.align-grid,
.distribute-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.align-group,
.distribute-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.align-label,
.distribute-label {
  font-size: 0.75rem;
  color: #64748b;
  min-width: 65px;
}

/* Align and distribute buttons */
.align-btn,
.distribute-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #334155;
}

.align-btn:hover:not(:disabled),
.distribute-btn:hover:not(:disabled) {
  background-color: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.align-btn:active:not(:disabled),
.distribute-btn:active:not(:disabled) {
  transform: translateY(0);
  animation: align-flash 0.3s ease;
}

.align-btn:disabled,
.distribute-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.align-btn svg,
.distribute-btn svg {
  width: 20px;
  height: 20px;
}

/* Spacing controls */
.spacing-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.spacing-controls label {
  font-size: 0.875rem;
  color: #64748b;
}

.spacing-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spacing-input-group input {
  width: 80px;
  padding: 0.375rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.spacing-input-group span {
  font-size: 0.875rem;
  color: #64748b;
}

.spacing-buttons {
  display: flex;
  gap: 0.5rem;
}

.spacing-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.spacing-btn:hover:not(:disabled) {
  background-color: #e2e8f0;
  border-color: #94a3b8;
}

.spacing-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.spacing-btn:active:not(:disabled) {
  animation: align-flash 0.3s ease;
}

/* Quick action buttons */
.quick-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.quick-action-btn {
  padding: 0.5rem 0.75rem;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  white-space: nowrap;
}

.quick-action-btn:hover:not(:disabled) {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.quick-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quick-action-btn:active:not(:disabled) {
  animation: align-flash 0.3s ease;
}

.quick-action-btn i {
  font-size: 0.875rem;
}

/* =============================================================================
   CANVAS PANEL
   ============================================================================= */

#canvas-panel .panel-content {
  padding: 1rem;
}

/* Canvas preset container */
.canvas-preset-container {
  margin-bottom: 1rem;
  width: 100%;
  max-width: 100%;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

#canvasPresets {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  background-color: #fff;
  font-size: 0.875rem;
}

#canvasPresets option[value="default"] {
  font-weight: bold;
}

/* =============================================================================
   EXPORT PANEL
   ============================================================================= */

#export-panel .panel-content {
  padding: 1rem;
}

/* =============================================================================
   CONTEXT MENUS
   ============================================================================= */

/* Canvas context menu */
.canvas-context-menu {
  position: fixed;
  z-index: 1000;
  background: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  border-radius: 4px;
  padding: 8px 0;
}

.object-context-menu {
  z-index: 9999 !important;
}

/* Text editing in context menu */
#contextTextContent {
  width: 100%;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  max-height: 150px;
}

#contextTextContent:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Text alignment buttons */
.text-align-buttons {
  display: flex;
  gap: 4px;
}

.text-align-buttons .align-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  color: #64748b;
  font-size: 12px;
}

.text-align-buttons .align-btn:hover {
  background-color: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

.text-align-buttons .align-btn.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* Font family dropdown in context menu */
#contextFontFamily {
  width: 100%;
  max-width: 100%;
}

#contextFontFamily optgroup {
  font-weight: bold;
  color: #64748b;
}

#textSection {
  max-height: 400px;
  overflow-y: auto;
}

/* Flip buttons */
.flip-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.flip-btn {
  flex: 1;
  padding: 6px 10px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.flip-btn:hover {
  background: #e0e0e0;
}

.flip-btn.active {
  background: #4CAF50;
  color: white;
}

/* =============================================================================
   FORM CONTROLS AND INPUTS
   ============================================================================= */

/* Style toggles */
.style-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.style-toggles-horizontal {
  display: flex;
  gap: 1.5rem;
  margin: 1rem 0;
}

.style-toggles-horizontal label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
}

/* Custom range inputs */
input[type="range"] {
  width: 100%;
  height: 0.5rem;
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 0.25rem;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
}

/* Custom color inputs */
input[type="color"] {
  height: 2rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.25rem;
  cursor: pointer;
  background: white;
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

/* Custom form control */
.customform-control {
  display: block;
  width: 395px;
  padding-top: 2px;
  padding-left: 2px;
  height: 22px;
  font-size: 14px;
  line-height: 1.42857143;
  color: #71706f;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
  -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
  -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
  transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
  border-radius: 0px !important;
}

/* =============================================================================
   ANIMATIONS AND KEYFRAMES
   ============================================================================= */

@keyframes pulse-outline {
  0% {
    outline-width: 2px;
  }
  50% {
    outline-width: 3px;
  }
  100% {
    outline-width: 2px;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes drop-success {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes align-flash {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

/* Tablet and larger screens */
@media (min-width: 1024px) {
  .layers-panel-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .z-order-section {
    order: 2;
  }
  
  .objects-list-section {
    order: 1;
  }
  
  .layers-list {
    max-height: 240px;
  }
}

/* Desktop screens */
@media (min-width: 1280px) {
  .layers-panel-grid {
    grid-template-columns: minmax(200px, 300px) 1fr;
    max-width: 800px;
    margin: 0 auto;
  }
}

/* Tablet responsive */
@media (max-width: 1024px) {
  .layers-panel-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .z-order-section {
    order: 2;
  }
  
  .objects-list-section {
    order: 1;
  }
  
  .layers-list {
    max-height: 240px;
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .layers-panel-grid {
    gap: 0.75rem;
  }
  
  .z-order-section .layer-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
  }
  
  .z-order-section .layer-btn {
    font-size: 0.625rem;
    padding: 0.25rem;
    height: 32px;
  }
  
  .z-order-section .layer-btn i {
    display: none;
  }
  
  .layers-list {
    max-height: 200px;
  }
  
  .layer-item {
    padding: 0.375rem 0.5rem;
  }
  
  .layer-number {
    width: 20px;
    height: 20px;
    font-size: 0.625rem;
    margin-right: 0.5rem;
  }
  
  .layer-action-btn {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }
  
  .quick-action-buttons {
    grid-template-columns: 1fr;
  }
  
  .align-group,
  .distribute-group {
    flex-wrap: wrap;
  }
  
  .align-label,
  .distribute-label {
    width: 100%;
    margin-bottom: 0.25rem;
  }
}

/* Small mobile responsive */
@media (max-width: 600px) {
  .align-tabs {
    gap: 0.25rem;
  }
  
  .align-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .align-tab i {
    font-size: 0.875rem;
  }
  
  .text-panel-layout {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .text-panel-column:first-child {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
  }
  
  .effects-panel {
    flex-direction: row;
  }
  
  .effects-checkboxes {
    gap: 1.75rem;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .effects-controls {
    grid-template-columns: 1fr;
  }
  
  .text-effects-section {
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin-top: 0.75rem;
    float: left;
    width: 50%;
  }
  
  .effects-header {
    margin-bottom: 0.375rem;
  }
  
  .effects-controls {
    border: none;
    padding: 0.375rem 0 0 0;
    background-color: transparent;
  }
}

/* Very small mobile */
@media (max-width: 400px) {
  .effects-panel {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .effects-checkboxes {
    flex-direction: row;
    gap: 1rem;
    justify-content: flex-start;
  }
  
  #shadowControls {
    margin-top: 0.5rem;
  }
}

/* Additional responsive adjustments */
@media (max-width: 767px) {
  .text-panel-layout {
    gap: 1rem;
  }
  
  .effects-panel {
    gap: 0.75rem;
  }
}