#meme-editor-container {
  max-width: 1200px;
  margin: 20px auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Meme Templates */
.meme-templates {
  margin-bottom: 20px;
  background: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.meme-templates h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 18px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  max-height: 120px;
  overflow-y: auto;
}

.template-item {
  width: 80px;
  height: 80px;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-size: cover;
  background-position: center;
}

.template-item:hover {
  border-color: #007cba;
  transform: scale(1.05);
}

.template-item.active {
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* Main Editor */
.editor-main {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Toolbar */
.meme-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f1f3f4;
  border-radius: 8px;
}

.tool-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tool-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #007cba;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn:hover {
  background: #005a87;
  transform: translateY(-1px);
}

.tool-btn:active {
  transform: translateY(0);
}

.tool-btn.active {
  background: #28a745;
}

/* Canvas Container */
.canvas-container {
  text-align: center;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  border: 2px dashed #ddd;
}

#meme-canvas {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Panels */
.panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  min-width: 300px;
  max-width: 400px;
}

.panel::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.panel h4 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 18px;
  border-bottom: 2px solid #007cba;
  padding-bottom: 10px;
}

/* Spacing Panel */
.spacing-options {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.spacing-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.spacing-options label:hover {
  background: #f8f9fa;
}

.spacing-options input[type="radio"]:checked + label,
.spacing-options label:has(input[type="radio"]:checked) {
  background: #e3f2fd;
  border-color: #007cba;
}

.spacing-color, .spacing-width {
  margin-bottom: 15px;
}

.spacing-color label, .spacing-width label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.spacing-color select, .spacing-width select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Draw Panel */
.draw-options {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.draw-tool {
  flex: 1;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.draw-tool:hover {
  border-color: #007cba;
}

.draw-tool.active {
  background: #007cba;
  color: white;
  border-color: #007cba;
}

.brush-settings, .brush-color {
  margin-bottom: 15px;
}

.brush-settings label, .brush-color label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.brush-settings input[type="range"] {
  width: 100%;
  margin-bottom: 5px;
}

#brush-size-value {
  font-weight: bold;
  color: #007cba;
}

/* Effects Panel */
.effect-item {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #f9f9f9;
}

.effect-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  font-weight: 500;
}

.effect-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.effect-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.effect-item.active .effect-slider {
  opacity: 1;
}

.effect-slider input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  cursor: pointer;
}

.effect-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #007cba;
  cursor: pointer;
}

.effect-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #007cba;
  cursor: pointer;
  border: none;
}

.effect-slider span {
  min-width: 30px;
  text-align: right;
  font-weight: bold;
  color: #007cba;
  font-size: 14px;
}

/* Text Panel */
.text-inputs {
  margin-bottom: 20px;
}

.text-inputs input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 16px;
}

.text-options, .text-color, .text-stroke {
  margin-bottom: 15px;
}

.text-options label, .text-color label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.text-stroke {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.text-stroke label {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Draw Actions */
.draw-actions {
  margin: 15px 0;
  text-align: center;
}

.secondary-btn {
  padding: 8px 16px;
  border: 1px solid #dc3545;
  border-radius: 4px;
  background: white;
  color: #dc3545;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: #dc3545;
  color: white;
}

/* Panel Actions */
.panel-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #eee;
  padding-top: 20px;
  margin-top: 20px;
}

.panel-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-actions button:first-child {
  background: #007cba;
  color: white;
}

.panel-actions button:first-child:hover {
  background: #005a87;
}

.panel-actions button:not(:first-child) {
  background: #6c757d;
  color: white;
}

.panel-actions button:not(:first-child):hover {
  background: #545b62;
}

/* Responsive Design */
@media (max-width: 768px) {
  #meme-editor-container {
    margin: 10px;
    padding: 15px;
  }
  
  .meme-tools {
    flex-direction: column;
    gap: 10px;
  }
  
  .tool-group {
    justify-content: center;
  }
  
  .panel {
    margin: 20px;
    min-width: auto;
    max-width: none;
    left: 20px;
    right: 20px;
    transform: translateY(-50%);
  }
}
