// .controls {
//   margin-bottom: 20px;
// }

// .controls textarea {
//   width: 100%;
//   height: 200px;
//   padding: 10px;
//   font-size: 14px;
//   font-family: monospace;
//   border: 1px solid #ccc;
//   border-radius: 4px;
//   resize: vertical;
//   box-sizing: border-box;
//   margin-bottom: 10px;
// }

// .controls button {
//   padding: 10px 20px;
//   background-color: #1976d2;
//   color: white;
//   border: none;
//   border-radius: 4px;
//   cursor: pointer;
// }

// .controls button:hover {
//   background-color: #1565c0;
// }

// .toolbar {
//   display: flex;
//   gap: 10px;
//   align-items: flex-start;
//   padding: 1rem;
//   background-color: #f7f7f7;
// }

// textarea {
//   width: 300px;
//   height: 120px;
//   font-family: monospace;
//   padding: 10px;
//   border-radius: 8px;
//   border: 1px solid #ccc;
// }

// button {
//   padding: 10px 20px;
//   background-color: #3f51b5;
//   color: white;
//   border: none;
//   border-radius: 6px;
//   cursor: pointer;
//   transition: background-color 0.3s ease;
// }

// button:hover {
//   background-color: #303f9f;
// }

// mat-tab-group {
//   margin: 1rem;
// }

// .tab-content {
//   padding: 1rem;
//   background-color: #fafafa;
//   border: 1px solid #ddd;
//   border-radius: 10px;
//   min-height: 400px;
// }



// .active-tab {
//   border-bottom: 2px solid #007bff;
//   color: #007bff;
// }

// .tab-button {
//   padding: 8px 16px;
//   margin-right: 8px;
//   background: #f1f1f1;
//   border: none;
//   border-bottom: 2px solid transparent;
//   cursor: pointer;
//   color: black; /* 👈 Text color black */
//   font-weight: bold;
// }

// .tab-button.active {
//   border-bottom: 2px solid #000;
//   background: #e0e0e0;
//   color: black; /* 👈 Ensure active tab also stays black */
// }


// .editor-container {
//   position: relative; /* 🔑 Important to contain absolute button */
//   max-width: 1200px;
//   margin: 0 auto;
//   font-family: 'Segoe UI', sans-serif;
//   padding: 20px;
//   background-color: #ffffff;
// }

// .style-panel {
//   position: fixed;
//   top: 100px;
//   right: 20px;
//   width: 220px;
//   padding: 15px;
//   background: white;
//   border: 1px solid #ccc;
//   border-radius: 6px;
//   box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
//   z-index: 9999;

//   h4 {
//     margin-bottom: 10px;
//   }

//   label {
//     display: block;
//     margin-bottom: 10px;
//     font-size: 13px;
//   }

//   input {
//     width: 100%;
//     padding: 4px;
//     margin-top: 2px;
//   }

//   button {
//     margin-right: 8px;
//     padding: 6px 12px;
//   }
// }


.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

/* Main Popup Content */
.popup-content {
  width: 600px;
  max-height: none;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  border-radius: 8px;
  background-color: snow;
  animation: slideIn 0.4s ease-out;
}

.close-btn {
  background: transparent;
  border: none;
  color: #666;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  height: 36px;
  width: 36px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.input-textarea {
  width: 100%;
  margin-bottom: 20px;
  font-family: inherit;
  resize: vertical;
  transition: border 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.input-textarea:focus {
  border-color: #1976d2;
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.page-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 15px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background-color: white;
  color: #333;
}

.cancel-btn {
  padding: 8px 16px;
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-btn:hover {
  background: #e0e0e0;
  transform: translateY(-1px);
}

.generate-btn {
  padding: 8px 18px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.generate-btn:hover {
  background: #1565c0;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Loading Container */
.loading-container {
  width: 400px;
  padding: 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: slideIn 0.4s ease-out;
}

.bg-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.1;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255,255,255,0.1) 10px,
    rgba(255,255,255,0.1) 20px
  );
}

.loader-content {
  position: relative;
  z-index: 2;
}

.thinking-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: spinPulse 2s ease-in-out infinite;
}

.brain-emoji {
  font-size: 36px;
  animation: brainThink 1.5s ease-in-out infinite;
}

.thinking-text {
  color: white;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 16px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dots {
  animation: typewriter 1.5s infinite;
}

.thinking-subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  margin-bottom: 32px;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: dotPulse 1.4s infinite ease-in-out;
}

.dot-1 { animation-delay: 0s; }
.dot-2 { animation-delay: 0.2s; }
.dot-3 { animation-delay: 0.4s; }
.dot-4 { animation-delay: 0.6s; }
.dot-5 { animation-delay: 0.8s; }

.particles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  animation: float 3s infinite ease-in-out;
}

.particle-1 {
  width: 4px;
  height: 4px;
  top: 20%;
  left: 15%;
  animation-duration: 3s;
}

.particle-2 {
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.4);
  top: 60%;
  right: 20%;
  animation-duration: 4s;
  animation-direction: reverse;
}

.particle-3 {
  width: 3px;
  height: 3px;
  background: rgba(255,255,255,0.7);
  bottom: 30%;
  left: 25%;
  animation-duration: 2.5s;
}

.particle-4 {
  width: 5px;
  height: 5px;
  background: rgba(255,255,255,0.5);
  top: 40%;
  right: 15%;
  animation-duration: 3.5s;
  animation-direction: reverse;
}

/* Error Container */
.error-container {
  width: 450px;
  padding: 32px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  text-align: center;
  position: relative;
  animation: slideIn 0.4s ease-out;
}

.error-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: errorShake 0.5s ease-in-out;
}

.error-title {
  color: white;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.error-message {
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.retry-btn {
  padding: 12px 20px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.retry-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

.error-close-btn {
  padding: 12px 20px;
  background: white;
  color: #ee5a52;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.error-close-btn:hover {
  background: #f8f8f8;
  transform: translateY(-1px);
}

/* Keyframe Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spinPulse {
  0%, 100% {
    transform: rotate(0deg) scale(1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  }
  50% {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 12px 48px rgba(0,0,0,0.3);
  }
}

@keyframes brainThink {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(0.95) rotate(5deg); }
}

@keyframes typewriter {
  0%, 20% { opacity: 1; }
  50% { opacity: 0; }
  80%, 100% { opacity: 1; }
}

@keyframes dotPulse {
  0%, 20%, 80%, 100% {
    transform: scale(1);
    background: rgba(255,255,255,0.4);
  }
  40% {
    transform: scale(1.5);
    background: rgba(255,255,255,0.9);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 1;
  }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .popup-content, .loading-container, .error-container {
    width: 90%;
    margin: 0 20px;
  }
}

/* Your existing styles */
.controls {
  margin-bottom: 20px;
}

.controls textarea {
  width: 100%;
  height: 200px;
  padding: 10px;
  font-size: 14px;
  font-family: monospace;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.controls button {
  padding: 10px 20px;
  background-color: #1976d2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.controls button:hover {
  background-color: #1565c0;
}

.active-tab {
  border-bottom: 2px solid #007bff;
  color: #007bff;
}

.tab-button {
  padding: 8px 16px;
  margin-right: 8px;
  background: #f1f1f1;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: black;
  font-weight: bold;
}

.tab-button.active {
  border-bottom: 2px solid #000;
  background: #e0e0e0;
  color: black;
}

:host {
  --zoom-level: 1;
  --primary-color: #2196f3;
  --spacing-unit: 8px;
}

:root {
  --level: 0;
  --primary-color: #2196f3;
  --border-color: #e2e8f0;
}