/*
 * Homepage prompt attachments.
 * Adapted from homepage-v2 FileUploadButton.module.scss.
 */

/* Left-side action group in the prompt button row */
.hero-generator .attachment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-generator .file-upload-container {
  display: flex;
  position: relative;
}

.hero-generator .attachment-hidden-input {
  display: none;
}

/* "Add file" button */
.hero-generator .attachment-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #eaeaeb;
  border-radius: 6px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #2b2b35;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.hero-generator .attachment-add-btn:hover {
  background-color: #00000014;
}

.hero-generator .attachment-add-btn[aria-expanded="true"] {
  background-color: #0069d114;
  border-color: #0052a3;
  color: #0052a3;
}

@media only screen and (max-width: 600px) {
  .hero-generator .attachment-add-btn {
    border: none;
  }
}

/* Dropdown */
.hero-generator .attachment-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 174px;
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: attachmentFadeIn 0.15s ease-out;
}

.hero-generator .attachment-dropdown[hidden] {
  display: none;
}

/* On mobile the prompt box sits near the bottom of the viewport, so open the
   dropdown above the "Add file" button instead of below it. */
@media only screen and (max-width: 600px) {
  .hero-generator .attachment-dropdown {
    top: auto;
    bottom: calc(100% + 4px);
    animation: attachmentFadeInUp 0.15s ease-out;
  }
}

.hero-generator .attachment-menu[hidden],
.hero-generator .attachment-link-panel[hidden] {
  display: none;
}

.hero-generator .attachment-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-generator .attachment-dropdown-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 4px 8px;
  background: transparent;
  border: none;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #717178;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  border-radius: 4px;
}

.hero-generator .attachment-dropdown-option:hover {
  background-color: #0069d114;
  color: #0052a3;
}

/* Add-link panel */
.hero-generator .attachment-link-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 280px;
  padding: 4px;
}

.hero-generator .attachment-link-back {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #717178;
  cursor: pointer;
}

.hero-generator .attachment-link-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid #eaeaeb;
  border-radius: 6px;
  background: #fff;
}

.hero-generator .attachment-link-input-wrapper:focus-within {
  border-color: #0073e6;
}

.hero-generator .attachment-link-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 40px;
  padding: 0 40px 0 12px;
  border: none;
  border-radius: 6px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: #2b2b35;
  background: transparent;
  outline: none;
}

.hero-generator .attachment-link-input::placeholder {
  color: #8c8c8c;
}

.hero-generator .attachment-link-submit {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #8c8c8c;
  cursor: pointer;
}

.hero-generator .attachment-link-submit:hover {
  color: #0052a3;
}

.hero-generator .attachment-link-error {
  margin: 0;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  color: #e53e3e;
}

.hero-generator .attachment-link-error[hidden] {
  display: none;
}

/* ---- Toast (mirrors homepage-v2 Toast) ---------------------------------- */

.vg-toast-container {
  position: fixed;
  bottom: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 100000;
}

.vg-toast-item {
  display: flex;
  width: fit-content;
  transform-origin: bottom left;
  animation: vgToastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.vg-toast-item--out {
  animation: vgToastSlideOut 0.2s ease-in forwards;
}

@keyframes vgToastSlideIn {
  0% {
    opacity: 0;
    transform: translateY(100px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes vgToastSlideOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.vg-toast {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  max-width: 360px;
  color: #ffffff;
  background: #2b2b35;
  border-radius: 0.375rem;
  font-family: "Inter", sans-serif;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.vg-toast-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 12px 32px 8px 16px;
  gap: 0.75rem;
}

.vg-toast-icon {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  line-height: 1;
}

.vg-toast-icon svg {
  display: block;
}

.vg-toast-text {
  display: flex;
  flex-direction: column;
}

.vg-toast-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5rem;
}

.vg-toast-desc {
  font-size: 14px;
  line-height: 1.5;
}

.vg-toast-footer {
  width: 100%;
}

.vg-toast-bar {
  height: 5px;
  width: 100%;
}

.vg-toast-close {
  position: absolute;
  top: 0;
  right: 0;
  margin: 4px;
  padding: 4px;
  display: flex;
  align-items: center;
  border: none;
  background: none;
  cursor: pointer;
}

.vg-toast-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

/* Chip row above the textarea */
.hero-generator .attachment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 12px 0;
}

.hero-generator .attachment-chips[hidden] {
  display: none;
}

.hero-generator .attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid #cacaca;
  border-radius: 4px;
  background: #f4f4f4;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #2b2b35;
  width: fit-content;
  max-width: 240px;
  position: relative;
  cursor: default;
}

@media only screen and (max-width: 600px) {
  .hero-generator .attachment-chip {
    max-width: 180px;
  }
}

.hero-generator .attachment-chip-close {
  position: absolute;
  top: -6px;
  right: -8px;
  background: rgba(25, 25, 26, 1);
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.hero-generator .attachment-chip-close:hover {
  background: #4a5568;
}

.hero-generator .attachment-chip-close:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.hero-generator .attachment-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #2b2b35;
}

.hero-generator .attachment-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Upload spinner (chip) */
.hero-generator .attachment-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(66, 153, 225, 0.3);
  border-top-color: #4299e1;
  border-radius: 50%;
  animation: attachmentSpin 0.6s linear infinite;
}

@keyframes attachmentSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes attachmentFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes attachmentFadeInUp {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
