/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1f1f1f, #2c2c2c);
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.header {
  width: 100%;
  background: linear-gradient(135deg, #536976, #292e49);
  padding: 20px 0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-content img {
  height: 50px;
  margin-right: 15px;
}

.header-content h1 {
  font-size: 28px;
  font-weight: 300;
}

/* Main Container */
.container {
  max-width: 800px;
  width: 90%;
  background: #262626;
  padding: 30px;
  margin: 20px 0;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

.container h1 {
  margin-top: 0;
  margin-bottom: 20px;
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #b0b0b0;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  background: #333;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  box-shadow: 0 0 5px rgba(255, 255, 255, 1); /* Changed to white */
}

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

/* Color Field */
.color-field {
  display: flex;
  align-items: center;
}

.color-field input {
  flex: 1;
}

.color-link {
  margin-left: 15px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ff0037, #8800ff);
  color: #fff;
  border-radius: 30px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
}

.color-link:hover {
  background: linear-gradient(150deg, #ff004c, #7700ff);
}

/* Buttons */
button {
  padding: 12px 25px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

button.primary {
  background-color: #7289da;
  color: #fff;
  width: 100%;
  margin-top: 0;
}

button.primary:hover {
  background-color: #5b6dcd;
}

button.secondary {
  background-color: #f44336;
  color: #fff;
  margin-top: 10px; /* Reduced from 20px to bring closer to "Fields:" */
  margin-bottom: 18px;
}

button.secondary:hover {
  background-color: #d32f2f;
}

/* Fields Container */
.fields-container {
  margin-top: 30px;
}

.fields-container h2 {
  margin-top: 0;
  margin-bottom: 0; /* Set to 0 to reduce space below "Fields:" */
  font-size: 20px;
  color: #fff;
}

/* Field Item */
.field-item {
  background: #2b2b2b;
  border: 1px solid #3a3a3a;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.field-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.field-input label {
  font-size: 14px;
  color: #b0b0b0;
  margin-bottom: 4px;
}

.field-input input,
.field-input textarea {
  width: 100%;
  padding: 10px;
  background: #333;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
}

.field-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.toggle-switch {
  display: flex;
  align-items: center;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch label {
  position: relative;
  display: block;
  width: 40px;
  height: 24px;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.3s;
  margin-right: 8px;
}

.toggle-switch label::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + label {
  background: #4caf50;
}

.toggle-switch input:checked + label::before {
  transform: translateX(16px);
}

.toggle-text {
  font-size: 14px;
  color: #b0b0b0;
}

.remove-field {
  background-color: #f44336;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s;
}

.remove-field:hover {
  background-color: #d32f2f;
}

/* Toggle Switch (Repeated Section) */
.toggle-switch {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch label {
  position: relative;
  display: block;
  width: 50px;
  height: 28px;
  background: #ccc;
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-switch label::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + label {
  background: #4caf50;
}

.toggle-switch input:checked + label::before {
  transform: translateX(22px);
}

.speech-bubble-container {
  position: relative;
  margin-left: 10px;
}

.speech-bubble {
  visibility: hidden;
  width: 80px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

.speech-bubble-container:hover .speech-bubble {
  visibility: visible;
  opacity: 1;
}

/* Output */
#output {
  background: #333;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 20px;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-top: 20px;
  cursor: pointer;
  font-size: 14px;
}

/* Copied Animation */
#output.copied {
  background: #2a2a2a;
}

#notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #66bb6a, #43a047); /* A pleasant green gradient */
  color: #fff;
  padding: 15px 25px;
  border-radius: 8px;
  display: none;
  z-index: 1000;
  font-size: 15px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: opacity 0.6s ease;
}

#notification a {
  color: #e0f2f1;  /* A light accent that stands out on the green background */
  text-decoration: underline;
}

#notification a:hover {
  color: #b2dfdb;
}

.header-text-container {
  display: inline-block;
  text-align: left;
}

.header-subtext {
  display: block;
  font-size: 14px; /* Adjust size as needed */
  font-weight: 300;
  color: #d0d0d0; /* Lighter shade than the main header */
  margin-top: 5px; /* Space between the main text and subtext */
  max-width: 100%; /* Ensures it doesn't exceed the width of the header content */
}

/* Additional spacing for Generated JSON heading */
.container > h2 {
  margin-top: 30px;
  margin-bottom: 10px;
}

/* make the "Generate Color" label sit beneath the picker */
.color-picker-wrapper {
  position: relative;
  display: inline-block;
}

/* invisible full-size picker overlay */
#colorPicker {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0; margin: 0;
}

/* force the label text white */
label.color-link {
  color: #fff !important;
}

/* Discord Embed Preview Styles */
.preview-section {
  margin: 20px 0;
  padding: 20px;
  background: #2f3136;
  border-radius: 8px;
}

.embed-preview {
  margin-top: 15px;
}

.discord-embed {
  background: #313338;
  border-radius: 8px;
  border: 1px solid #232428;
  border-left-width: 4px;
  padding: 18px 22px 18px 18px;
  margin: 0;
  position: relative;
  display: flex;
  flex-direction: row;
  min-height: 120px;
  flex: 1 1 0%;
  max-width: 600px;
  box-shadow: none;
}

.discord-embed-main {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.discord-embed-thumbnail {
  margin-left: 16px;
  margin-top: 2px;
  align-self: flex-start;
}

.discord-embed-thumbnail img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.discord-embed-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0;
}

.discord-embed-author-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.discord-embed-author-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.embed-title {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.embed-description {
  color: #dcddde;
  font-size: 15px;
  margin-bottom: 2px;
}

.embed-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
}

.embed-fields-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
  margin-bottom: 12px;
}

.embed-field {
  flex: 1 1 0;
  min-width: 0;
  max-width: 33%;
  display: flex;
  flex-direction: column;
  margin-right: 0;
}

.embed-field-name {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.embed-field-value {
  color: #dcddde;
  font-size: 14px;
  word-break: break-word;
}

.embed-footer {
  color: #b9bbbe;
  font-size: 12px;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.embed-footer img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.discord-embed-image {
  margin-top: 12px;
  width: 100%;
}

.discord-embed-image img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
}

#togglePreviewButton {
  margin-bottom: 10px;
}

/* Discord Preview Button */
.discord-preview-btn {
  background: #039dfc;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  padding: 12px 0;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
  width: 100%;
  box-shadow: none;
  display: block;
  margin-top: 10px;
  margin-bottom: 14px;
}
.discord-preview-btn:hover {
  background: #0280d1;
}

/* Discord Modal Overlay */
.discord-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 31, 34, 0.98);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}
.discord-modal-content {
  background: #232428;
  border-radius: 12px;
  padding: 40px 24px 32px 24px;
  min-width: 350px;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  position: relative;
}
.back-to-builder-btn {
  position: absolute;
  top: 18px;
  right: 24px;
  background: #23272a;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 2;
}
.back-to-builder-btn:hover {
  background: #36393f;
}

/* Discord Message Style */
.discord-message {
  display: flex;
  align-items: flex-start;
  background: none;
  margin-top: 0;
}

#builderPage .discord-message {
  margin-top: 30px;
}

.bot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin-right: 14px;
  margin-top: 2px;
  background: #23272a;
  border: 2px solid #23272a;
}
.bot-message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.bot-username-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.bot-username {
  color: #d1d5db;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.bot-app-tag {
  display: inline-block;
  background: #5865f2;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  vertical-align: middle;
  height: 20px;
  line-height: 16px;
  margin-left: 4px;
  margin-right: 4px;
}
.bot-timestamp {
  color: #949ba4;
  font-size: 12px;
  font-weight: 400;
  margin-left: 0;
}
.bot-embed-preview {
  margin-top: 8px;
}

/* Make embed preview fill modal width */
.discord-modal .discord-embed {
  max-width: 100%;
  margin: 0;
}

/* Utility classes for conditional spacing */
.discord-embed-main.has-author > :not(.discord-embed-author):first-child {
  margin-top: 2px;
}
.discord-embed-main.has-footer > .embed-footer {
  margin-top: 10px;
}

.discord-blockquote {
  border-left: 2px solid #4f545c;
  background: none;
  color: #dbdee1;
  padding: 0 0 0 12px;
  margin: 4px 0;
  border-radius: 0;
  font-size: 16px;
  font-family: inherit;
}
.discord-spoiler {
  background: #18191c;
  color: #18191c;
  border-radius: 3px;
  padding: 0 4px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
}
.discord-spoiler.revealed {
  color: #fff !important;
  background: #2f3136 !important;
}

.preview-page {
  animation: fadeIn 0.3s;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: none;
}

.preview-banner {
  width: 100%;
  /* background: linear-gradient(90deg, #23272a 80%, #23272a00 100%); */
  background: none !important;
  padding: 0 0 18px 0;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.back-to-builder-btn {
  background: #5865F2;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 28px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin: 5px 0 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.back-to-builder-btn:hover {
  background: #4752c4;
}

/* Fade in for both pages */
#builderPage, #previewPage {
  animation: fadeIn 0.3s;
}

button.primary {
  background-color: #5865F2;
  color: #fff;
  width: 100%;
  margin-top: 0;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 0;
  transition: background 0.2s;
}
button.primary:hover {
  background-color: #4752c4;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.container.preview-page {
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.preview-banner {
  margin-top: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.container.preview-page > .discord-message {
  margin-top: 0 !important;
  padding-top: 0 !important;
  background: none !important;
}

.embed-title-link {
  color: #00AEEF;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  display: block;
  margin-bottom: 2px;
  cursor: pointer;
  transition: color 0.15s;
}
.embed-title-link:hover {
  text-decoration: underline;
}
.author-link {
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: text-decoration 0.15s;
}
.author-link:hover {
  text-decoration: underline;
}

