:root {
  --primary-color: #6a5af9;
  --secondary-color: #f72585;
  --background-start: #f5f7fa;
  --background-end: #c3cfe2;
  --card-background: rgba(255, 255, 255, 0.85);
  --text-color: #2d3748;
  --subtle-text-color: #718096;
  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-color: rgba(106, 90, 249, 0.15);
  --success-color: #48bb78;
  --font-primary: 'Poppins', 'IBM Plex Sans Thai', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-primary);
  background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  width: 100%;
  min-height: 100%;
}

.main-container.content-locked {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.main-container {
  width: 100%;
  max-width: 1200px;
  transition: filter 0.3s ease;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: -webkit-linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  font-size: 1.1rem;
  color: var(--subtle-text-color);
  margin-top: 0.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--card-background);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 25px var(--shadow-color);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px var(--shadow-color);
}

.feature-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.feature-header .icon {
  font-size: 2rem;
  color: var(--primary-color);
  flex-shrink: 0;
}

.feature-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.feature-card p.description {
  color: var(--subtle-text-color);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.input-label {
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.9rem;
  margin-bottom: -0.5rem;
}

textarea.input-field, input.input-field {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-family: var(--font-primary);
  font-size: 1rem;
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.input-field:focus, input.input-field:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(106, 90, 249, 0.2);
}

textarea.input-field {
  resize: vertical;
  min-height: 100px;
}

.btn-generate {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  align-self: flex-start;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.output-container {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.output-container h3 {
  font-size: 1.1rem;
  color: var(--subtle-text-color);
  margin-bottom: 1rem;
  font-weight: 500;
}

.output-area {
  background-color: #f7fafc;
  border-radius: 8px;
  padding: 1rem;
  min-height: 100px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-color);
  font-size: 0.95rem;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loader {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* API Key Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-box {
  background: white;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 500px;
  text-align: center;
}

.modal-box h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.modal-box p {
  color: var(--subtle-text-color);
  margin-bottom: 1.5rem;
}

.modal-box .input-field {
  text-align: center;
}

.modal-box button {
  width: 100%;
  margin-top: 1rem;
  background: var(--primary-color);
}

.modal-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 1rem;
    display: inline-block;
}

.modal-box a:hover {
    text-decoration: underline;
}


@media (max-width: 768px) {
  #root {
    padding: 1rem;
  }
  header h1 {
    font-size: 2rem;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
}