:root {
  --primary-color: #588157; /* Fern */
  --primary-light: #a3b18a; /* Dry Sage */
  --primary-dark: #3a5a40; /* Hunter Green */
  --secondary-color: #344e41; /* Pine Teal */
  --secondary-light: #588157; /* Fern */
  --secondary-dark: #3a5a40; /* Hunter Green */
  --text-on-primary: #ffffff;
  --text-on-secondary: #ffffff;
  --background-color: #dad7cd; /* Dust Grey */
  --surface-color: #ffffff;
  --error-color: #ef476f;
  --success-color: #588157;
  --border-radius: 12px;
  --box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  --transition-speed: 0.3s;
}

/* Main Container */
.meme-generator-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background-color: var(--background-color);
}

.generator-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 0.5rem;
  background: linear-gradient(
    135deg,
    var(--primary-light),
    var(--secondary-color)
  );
  color: var(--text-on-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  position: relative;
  overflow: hidden;
}

.generator-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at top right,
    rgba(255, 255, 255, 0.2),
    transparent 70%
  );
  z-index: 1;
}

.generator-header h1,
.generator-header p {
  position: relative;
  z-index: 2;
}

.generator-header h1 {
  font-size: 2.8rem;
  color: var(--text-on-primary);
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-description {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
  padding: 0 1rem;
}

/* Meme Studio Layout */
.meme-studio {
  display: grid;
  grid-template-columns: minmax(500px, 3fr) minmax(350px, 2fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
  position: relative;
  padding: 2rem;
  border-radius: var(--border-radius);
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.9),
    rgba(240, 245, 255, 0.8)
  );
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(76, 175, 80, 0.1);
}

/* Preview Panel */
.meme-studio-preview {
  background: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  min-height: 700px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.preview-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.preview-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f0f0f0;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
}

.action-btn:hover {
  background: var(--primary-light);
  color: var(--text-on-primary);
}

.canvas-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto 2rem;
  background: #f8f9fa;
  border: none;
  border-radius: var(--border-radius);
  overflow: visible;
  position: relative;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.canvas-container:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

#meme-canvas {
  max-width: 100%;
  max-height: 600px;
  display: block;
  cursor: crosshair;
  object-fit: contain;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.meme-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.download-btn {
  padding: 1rem 2rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: var(--text-on-primary);
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(76, 175, 80, 0.4);
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--primary-color)
  );
}

.download-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(76, 175, 80, 0.4);
}

.share-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.share-btn {
  flex: 1;
  padding: 0.75rem;
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.share-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.share-btn.facebook {
  background: linear-gradient(135deg, #3b5998, #2d4373);
  border: 1px solid rgba(59, 89, 152, 0.2);
}

.share-btn.twitter {
  background: linear-gradient(
    135deg,
    var(--secondary-color),
    var(--secondary-dark)
  );
  border: 1px solid rgba(33, 150, 243, 0.2);
}

.share-btn.reddit {
  background: linear-gradient(135deg, #ff4500, #cc3700);
  border: 1px solid rgba(255, 69, 0, 0.2);
}

.canvas-instructions {
  background: linear-gradient(to right, #e8f5e9, #e3f2fd);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  margin-top: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.canvas-instructions p {
  margin: 0 0 1rem 0;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 1.1rem;
}

.canvas-instructions .pro-tips {
  margin-top: 1.5rem;
  font-size: 1rem;
  border-top: 1px dashed #ccc;
  padding-top: 1rem;
}

.canvas-instructions ol {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

.canvas-instructions ul {
  margin: 0;
  padding-left: 1.5rem;
}

.canvas-instructions li {
  margin-bottom: 0.75rem;
  color: #333;
  font-size: 0.95rem;
  line-height: 1.4;
}

.canvas-instructions ol li {
  padding-left: 0.5rem;
  font-weight: 500;
}

.canvas-instructions i {
  margin-right: 0.5rem;
  color: var(--primary-color);
  width: 20px;
  text-align: center;
}

/* Tools Panel */
.meme-studio-tools {
  background: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  min-height: 700px;
}

.tools-tabs {
  display: flex;
  background: #f5f5f7;
  border-bottom: 1px solid #eee;
}

.tab-btn {
  flex: 1;
  padding: 1rem 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #666;
  transition: all var(--transition-speed) ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--primary-color);
  background: rgba(76, 175, 80, 0.05);
}

.tab-btn.active {
  color: var(--primary-color);
  background: white;
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  box-shadow: 0 1px 3px rgba(76, 175, 80, 0.3);
}

.tab-btn i {
  font-size: 1.1rem;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.tab-pane {
  display: none;
  padding: 2rem;
  height: 100%;
  overflow-y: auto;
}

.tab-pane.active {
  display: block;
}

.tab-pane-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 1.5rem;
}

.tab-pane-header .text-box-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start; /* Align items to the start */
}

.text-position-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  justify-content: flex-start; /* Align items to the start */
}

.text-position-controls .position-btn,
.text-position-controls .remove-text-btn {
  background: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  font-size: 0.9rem;
  line-height: 1; /* Reset line-height to ensure proper vertical alignment */
}

.tab-pane-header .text-box-controls .control-btn i,
.text-position-controls i {
  display: block; /* Ensure icons take up the full button space */
  margin: 0; /* Remove any default margins */
}

.text-position-controls .position-btn:hover {
  background: #e0e0e0;
}

.text-position-controls .remove-text-btn {
  background: #f44336;
  color: #fff;
}

.text-position-controls .remove-text-btn:hover {
  background: #d32f2f;
}
.tab-pane-header h3 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--primary-color);
}

/* Templates Tab */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f9f9f9;
  border-radius: var(--border-radius);
  scrollbar-width: thin;
  margin-bottom: 1rem;
}

.template-grid::-webkit-scrollbar {
  width: 6px;
}

.template-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.template-grid::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.template-grid::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.template-item {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  transition: all var(--transition-speed) ease;
  position: relative;
}

.template-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.template-item.selected {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.template-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f0f0f0;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  font-weight: 600;
}

.pagination-btn:hover {
  background: var(--primary-light);
  color: white;
}

.pagination-btn.active {
  background: var(--primary-color);
  color: white;
}

.pagination-info {
  font-size: 0.9rem;
  color: #666;
  margin: 0 0.5rem;
}

.random-meme-btn {
  padding: 0.5rem 1rem;
  background: linear-gradient(
    135deg,
    var(--secondary-color),
    var(--secondary-dark)
  );
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 5px rgba(33, 150, 243, 0.3);
}

.random-meme-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(33, 150, 243, 0.4);
  background: linear-gradient(
    135deg,
    var(--secondary-dark),
    var(--secondary-color)
  );
}

.or-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #ddd;
}

.or-divider span {
  padding: 0 10px;
  font-weight: bold;
  color: #777;
}

.upload-container {
  text-align: center;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(76, 175, 80, 0.2);
}

.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(76, 175, 80, 0.3);
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--secondary-dark)
  );
}

/* Text Tab */
#text-boxes-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 1rem;
  padding-bottom: 1rem;
}

.text-input-group {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: all var(--transition-speed) ease;
  border-left: 3px solid transparent;
}

.text-input-group:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.text-input-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #444;
  font-weight: 600;
  font-size: 0.95rem;
}

.text-input-group input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all var(--transition-speed) ease;
  font-family: inherit;
}

.text-input-group input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
  background-color: #f0fff1;
}

/* Highlight the active text input group */
.text-input-group:has(input:focus) {
  background-color: #f0fff1;
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.1);
  transform: translateY(-3px);
  border-left: 3px solid var(--primary-color);
}

.text-controls-header {
  background: #f5f7fa;
  padding: 1rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.text-box-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.text-counter {
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-left: auto;
}

#text-box-counter {
  color: var(--primary-color);
  font-weight: 700;
}

.control-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 50px;
  background: #f0f0f0;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  min-width: 140px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
  background: #e0e0e0;
}

/* Text Position Controls */
.text-controls-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  background: #f5f7fa;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.text-position-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.text-position-controls .position-btn {
  background: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.text-position-controls .position-btn:hover {
  background: #e0e0e0;
  transform: scale(1.1);
}

.remove-text-btn {
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
}

.remove-text-btn:hover {
  background: #d32f2f;
  transform: scale(1.1);
}

#add-text-box {
  background: linear-gradient(135deg, #4caf50, #388e3c);
  color: white;
}

#add-text-box:hover {
  background: linear-gradient(135deg, #388e3c, #4caf50);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
}

#remove-text-box {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
}

#remove-text-box:hover {
  background: linear-gradient(135deg, #d32f2f, #f44336);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(244, 67, 54, 0.3);
}

.text-options,
.image-options {
  background: #ffffff;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #e0e0e0;
  margin-bottom: 2rem;
}

.option-group {
  display: flex;
  align-items: center;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
  position: relative;
}

.option-group label {
  width: 100px;
  font-weight: 600;
  color: #444;
  margin-right: 1rem;
}

.option-group select,
.option-group input[type="range"],
.option-group input[type="color"] {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all var(--transition-speed) ease;
}

.option-group select:focus,
.option-group input[type="range"]:focus,
.option-group input[type="color"]:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.option-group input[type="color"] {
  height: 40px;
  padding: 0.25rem;
  cursor: pointer;
}

.option-group input[type="range"] {
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  border-radius: 5px;
  outline: none;
  padding: 0;
  margin: 0 1rem;
}

.option-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(76, 175, 80, 0.3);
}

.option-group input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--primary-light);
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.checkbox-group {
  display: flex;
  align-items: center;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.range-value {
  min-width: 50px;
  text-align: center;
  font-weight: 600;
  color: #555;
}

/* Stickers Tab */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f9f9f9;
  border-radius: var(--border-radius);
  max-height: 400px;
  overflow-y: auto;
}

.sticker-btn {
  width: 100%;
  aspect-ratio: 1;
  font-size: 2rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticker-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.sticker-btn.selected {
  transform: scale(1.1);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
  position: relative;
}

.sticker-btn.selected::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 15px;
  height: 15px;
  background: var(--primary-color);
  border-radius: 50%;
  border: 2px solid white;
}

.sticker-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.resize-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#increase-sticker-size,
#decrease-sticker-size {
  min-width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  background: #f5f5f5;
  display: none;
}

#increase-sticker-size {
  background: linear-gradient(135deg, #4caf50, #388e3c);
  color: white;
}

#decrease-sticker-size {
  background: linear-gradient(135deg, #ff9800, #f57c00);
  color: white;
}

#resize-stickers.active + .resize-controls #increase-sticker-size,
#resize-stickers.active + .resize-controls #decrease-sticker-size {
  display: flex;
}

/* Style for active resize button */
#resize-stickers.active {
  background-color: #9c27b0; /* Purple to match the highlight */
  color: white;
  box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.3);
  transform: scale(1.05);
}

.sticker-hint {
  margin-left: auto;
  font-size: 0.9rem;
  color: #666;
  background: #f0f0f0;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Apply Changes Button */
.generate-btn {
  padding: 1rem 2rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem;
  margin-top: auto;
}

.generate-btn:hover {
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--secondary-dark)
  );
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(76, 175, 80, 0.4);
}

.generate-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(76, 175, 80, 0.4);
}

.generate-btn::before {
  content: "✨";
  font-size: 1.2rem;
}

/* Loading indicator */
.loading-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Canvas tooltip */
.canvas-tooltip {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Popular Templates Section */
.popular-templates,
.recent-memes {
  background: var(--surface-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--box-shadow);
}

.popular-templates h2,
.recent-memes h2 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.popular-grid,
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.5rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .meme-studio {
    grid-template-columns: 1fr;
  }

  .meme-studio-preview,
  .meme-studio-tools {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .generator-header h1 {
    font-size: 2.2rem;
  }

  .tools-tabs {
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
  }

  .tab-btn {
    flex: 0 0 auto;
    padding: 1rem;
  }

  .stickers-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .share-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .generator-header {
    padding: 1.5rem 0.5rem;
  }

  .generator-header h1 {
    font-size: 1.8rem;
  }

  .page-description {
    font-size: 1rem;
  }

  .preview-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .stickers-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .option-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .option-group label {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}
