/* action icons */
.base-prompt-header {
  grid-template-columns: 1fr auto 1fr;
  gap: .5rem;
}

.base-prompt-title {
  font-size: 1.15rem;
  color: #495057;
}

.past-prompts-container {
  max-width: 640px;
  margin-inline: auto;
}

.past-prompts-list {
  list-style: none;
  padding: 0;
  max-width: 640px;
  margin: 0 auto;
}

.past-prompt-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .25rem 1rem;
  padding: .875rem .5rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.past-prompt-creator {
  color: #6c757d;
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.past-prompt-content {
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--bs-body-color);
}

.copy-prompt-button {
  padding: .375rem;
  border: 0;
  border-radius: .375rem;
  background: transparent;
  color: #6c757d;
}

.copy-prompt-button:hover,
.copy-prompt-button:focus-visible {
  background: var(--bs-secondary-bg);
  color: #343a40;
}

.past-prompt-link {
  color: #495057;
  text-decoration: none;
}

.past-prompt-link:hover,
.past-prompt-link:focus-visible {
  color: #212529;
  text-decoration: underline;
}

.current-prompt-badge {
  display: inline-block;
  margin-left: .5rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: #e4f3e9;
  color: #4f8b69;
  font-size: .75rem;
  font-weight: 500;
}

.base-prompt-save {
  --bs-btn-bg: #495057;
  --bs-btn-border-color: #495057;
  --bs-btn-hover-bg: #343a40;
  --bs-btn-hover-border-color: #343a40;
}

.base-prompt-header .justify-self-end {
  justify-self: end;
  text-align: right;
}

.base-prompt-editor {
  position: relative;
}

.base-prompt-editor textarea {
  padding-bottom: 2rem;
}

.base-prompt-version {
  position: absolute;
  right: 1.5rem;
  bottom: .5rem;
  padding: 0 .25rem;
  background: var(--bs-body-bg);
  color: #a6acb1;
  font-size: .7rem;
  pointer-events: none;
}

@media (max-width: 575.98px) {
  .base-prompt-header {
    grid-template-columns: 1fr 1fr;
  }

  .base-prompt-header h1 {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: .5rem;
  }

  .past-prompts-header {
    grid-template-columns: 1fr auto 1fr;
  }

  .past-prompts-header h1 {
    grid-column: auto;
    grid-row: auto;
    margin-top: 0;
  }

  .past-prompt-detail-header {
    grid-template-columns: 1fr auto 1fr;
  }

  .past-prompt-detail-header h1 {
    grid-column: auto;
    grid-row: auto;
    margin-top: 0;
  }

  .base-prompt-header .justify-self-end {
    grid-column: 2;
    grid-row: 1;
  }

  .base-prompt-editor textarea {
    height: clamp(280px, 52dvh, 500px);
    padding-bottom: .5rem;
  }

  .base-prompt-version {
    display: none;
  }

  .base-prompt-reset-notice {
    max-width: calc(100vw - 2rem);
    text-align: center;
    white-space: nowrap;
  }
}

.base-prompt-reset-notice {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1050;
  transform: translate(-50%, -50%);
  padding: .875rem 1.25rem;
  border: 1px solid #a3cfbb;
  border-radius: .5rem;
  background: var(--bs-body-bg);
  box-shadow: 0 .5rem 1.5rem rgb(0 0 0 / 15%);
  color: #4f8b69;
  animation: base-prompt-notice-fade 400ms ease-out 800ms forwards;
}

@keyframes base-prompt-notice-fade {
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .base-prompt-reset-notice { animation: none; }
}

.base-prompt-reset-notice span {
  margin-right: .375rem;
}

.workspace-shell {
  display: flex;
  align-items: stretch;
}

.workspace-main {
  flex: 1;
  min-width: 0;
  padding-inline: 1.5rem;
}

.edit-sidebar {
  flex: 0 0 240px;
  width: 240px;
  padding: .5rem;
  border-right: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
}

.recent-works {
  max-height: calc(100dvh - 240px);
  overflow-y: auto;
}

.new-chat {
  display: flex;
  align-items: center;
  gap: .375rem;
  padding: .625rem;
  border-radius: .5rem;
  color: var(--bs-body-color);
  text-decoration: none;
  font-size: .875rem;
}

.new-chat:hover {
  background: var(--bs-secondary-bg);
}

.recent-works-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .625rem;
}

.recent-works-heading h2 {
  margin: 0;
  font-size: .75rem;
  font-weight: 400;
  color: #93979b;
}

.recent-works-more {
  opacity: 0;
  pointer-events: none;
  font-size: .75rem;
  text-decoration: none;
}

.recent-works-heading:hover .recent-works-more,
.recent-works-heading:focus-within .recent-works-more {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .recent-works-more {
    opacity: 1;
    pointer-events: auto;
  }
}

body.image_edits {
  --bs-link-color: #495057;
  --bs-link-color-rgb: 73, 80, 87;
  --bs-link-hover-color: #212529;
  --bs-link-hover-color-rgb: 33, 37, 41;
}

.image_edits .page-title::after {
  display: none;
}

.image_edits .file-dropzone.dragover,
.image_edits .form-control:focus {
  border-color: #868e96;
  box-shadow: 0 0 0 .2rem rgb(108 117 125 / 15%);
}

.image_edits .pagination {
  --bs-pagination-color: #495057;
  --bs-pagination-hover-color: #212529;
  --bs-pagination-focus-color: #212529;
  --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgb(108 117 125 / 15%);
  --bs-pagination-active-bg: #343a40;
  --bs-pagination-active-border-color: #343a40;
}

.recent-work {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem;
  border-radius: .5rem;
  color: var(--bs-body-color);
  text-decoration: none;
  font-size: calc(.875rem - 2px);
}

.recent-work img {
  flex-shrink: 0;
  object-fit: cover;
  border-radius: .25rem;
}

.recent-work:hover,
.recent-work.active {
  background: var(--bs-secondary-bg);
}

.mobile-recent-works {
  display: none;
}

@media (max-width: 767.98px) {
  .workspace-shell {
    flex-direction: column;
  }

  .edit-sidebar {
    flex-basis: auto;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--bs-border-color);
  }

  .edit-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border: 0;
    background: #fff;
  }

  .edit-sidebar .new-chat,
  .edit-sidebar .mobile-recent-works {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin: 0 !important;
    padding: 8px;
    border: 0;
    border-radius: 4px;
    background: #f1f3f5;
    color: var(--bs-body-color);
    font-size: 14px;
    text-decoration: none;
  }

  .edit-sidebar .new-chat:hover,
  .edit-sidebar .mobile-recent-works:hover {
    background: var(--bs-secondary-bg);
  }

  .edit-sidebar .recent-works-heading,
  .edit-sidebar .recent-works {
    display: none;
  }

  .workspace-main {
    padding-inline: .5rem;
  }
}

a:has(svg.bi) {
  text-decoration: none;
}

/* hover only visibility */
.hover-container .hover-only {
  opacity: 0;
  transition: opacity 0.1s ease;
}

.hover-container:hover .hover-only,
.hover-container:focus-within .hover-only {
  opacity: 1;
}

.file-dropzone {
  border: 2px dashed #bbb;
  border-radius: 8px;
  padding: 40px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  width: 100%;
}

.file-dropzone.dragover {
  background-color: #f8f9fa;
  border-color: #0d6efd;
}

.file-drop-preview {
  display: block;
  max-height: 360px;
  object-fit: contain;
  width: 100%;
}

.image-edit-prompt {
  background-color: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  max-height: 32rem;
  overflow-y: auto;
  padding: 1rem;
}

.image-edit-history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--bs-border-color);
  border-radius: 4px;
  text-decoration: none;
}

.image-edit-history-card:hover,
.image-edit-history-card:focus-visible {
  border-color: #adb5bd;
  box-shadow: 0 3px 10px rgb(0 0 0 / 7%);
}

.image-edit-history-title {
  font-size: calc(1rem - 1px);
  margin-top: calc(1rem - 2px);
}

.image-edit-history-time,
.image-edit-history-note {
  font-size: calc(.875rem - 1px);
}

.image-edit-history-preview {
  width: 100%;
  min-width: 0;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  background-color: var(--bs-tertiary-bg);
}

.image-edit-metadata {
  background-color: var(--bs-tertiary-bg);
  border-left: 0.25rem solid var(--bs-secondary);
  border-radius: var(--bs-border-radius);
  padding: 1rem;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.upload-zone {
  max-width: 900px;
}

.pictures-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.picture-thumb {
  width: 140px;
}

.sortable-item {
  cursor: grab;
}

.sortable-item.dragging {
  opacity: 0.5;
}

.carousel {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.carousel-track {
  display: flex;
  transition: transform 0.4s ease;
  will-change: transform;
}

.carousel-slide {
  min-width: 100%;
  padding: 40px;
  text-align: center;
  background: #f5f5f5;
  font-size: 24px;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
}

.carousel-btn.prev {
  left: 10px;
}

.carousel-btn.next {
  right: 10px;
}

/* Page title (global) */
.page-title {
  font-size: 1.75rem;
  /* h1이지만 과하지 않게 */
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: #212529;
  /* Bootstrap body color */
  position: relative;
}

/* subtle underline accent */
.page-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 0.4rem;
  background-color: var(--bs-primary);
  border-radius: 999px;
}

/* optional subtitle */
.page-subtitle {
  font-size: 0.95rem;
  color: #6c757d;
  /* text-muted */
  margin-top: -0.25rem;
  margin-bottom: 1.5rem;
}

/* Back link (global) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #495057;
  text-decoration: none;
  margin-bottom: 0.75rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.back-link__icon {
  font-size: 1rem;
  transition: transform 0.15s ease;
}

/* hover */
.back-link:hover {
  color: var(--bs-primary);
  text-decoration: none;
}

.back-link:hover .back-link__icon {
  transform: translateX(-2px);
}

/* hotwire inline edit */
[data-controller="hotwire-inline-edit"]:empty::before {
  content: attr(data-hotwire-inline-edit-blank-placeholder-value);
  color: #999;
  cursor: pointer;
}

[data-controller="hotwire-inline-edit"] {
  .fit-1 {
    width: 1em;
  }

  .fit-2 {
    width: 2em;
  }

  .fit-3 {
    width: 3em;
  }

  .fit-4 {
    width: 4em;
  }

  .fit-5 {
    width: 5em;
  }

  .fit-6 {
    width: 6em;
  }

  .fit-7 {
    width: 7em;
  }

  .fit-8 {
    width: 8em;
  }

  .fit-9 {
    width: 9em;
  }

  .fit-10 {
    width: 10em;
  }

  .fit-15 {
    width: 15em;
  }

  .fit-20 {
    width: 20em;
  }

  .fit-25 {
    width: 25em;
  }

  .fit-30 {
    width: 30em;
  }

  .fit-full {
    width: 100%;
  }

  .fit-auto {
    width: auto;
  }
}

img.persona-thumbnail {
  width: 150px;
  border-radius: 8px;
}

.persona-picture {
  width: 100%;
  text-align: center;

  img.persona-large {
    width: 800px;
    border-radius: 12px;
  }
}

/* ==========================================================================
   Persona Card Component
   ========================================================================== */
.persona-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a2e;
  aspect-ratio: 3 / 4;
}

.persona-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.persona-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 12px 12px;
  background: linear-gradient(to top,
      rgba(26, 26, 46, 0.95) 0%,
      rgba(26, 26, 46, 0.6) 60%,
      transparent 100%);
}

.persona-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.persona-card-nationality {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
}

/* ==========================================================================
   Persona Select Component
   ========================================================================== */
.persona-select-wrapper {
  margin-bottom: 1rem;
}

.persona-select-trigger {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}

.persona-select-trigger .selected-persona {
  display: flex;
  flex-direction: column;
  gap: 10px;

  img {
    width: 180px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }

  .description {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }

  .description .name {
    font-size: 1.15rem;
    font-weight: 600;
    color: #212529;
    letter-spacing: -0.01em;
  }

  .description .nationality {
    font-size: 0.9rem;
    color: #6c757d;
  }

  .description .hint {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #adb5bd;
    transition: color 0.2s;
  }

  @media (min-width: 768px) {
    flex-direction: row;
    gap: 16px;
  }
}

.persona-select-trigger:hover .selected-persona .hint {
  color: var(--bs-primary);
}

.persona-select-trigger .persona-card {
  width: 120px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

.persona-select-trigger:hover .persona-card {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.persona-select-hint {
  font-size: 0.85rem;
  color: #6c757d;
  transition: color 0.2s;
}

.persona-select-trigger:hover .persona-select-hint {
  color: var(--bs-primary);
}

/* Modal */
.persona-select-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.persona-select-modal.active {
  opacity: 1;
  visibility: visible;
}

.persona-select-modal-content {
  width: 95%;
  max-width: 1000px;
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s;
}

.persona-select-modal.active .persona-select-modal-content {
  transform: scale(1);
}

.persona-select-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
}

.persona-select-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.persona-select-close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  transition: color 0.2s;
}

.persona-select-close-btn:hover {
  color: #212529;
}

/* Persona Grid */
.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  overflow-y: scroll;
}

.persona-grid-item {
  display: block;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 14px;
  background: none;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.persona-grid-item .persona-card {
  border-radius: 11px;
}

.persona-grid-item:hover {
  transform: scale(1.03);
}

.persona-grid-item.selected {
  border-color: var(--bs-primary);
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .persona-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
  }

  .persona-select-modal-content {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
.persona-thumbnail {
  width: 100px;
  height: 100px;
}

.persona-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* Image Modal */
.image-modal-container {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.image-modal-container.active {
  opacity: 1;
  visibility: visible;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.image-modal-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.image-modal-close {
  position: absolute;
  top: -40px;
  right: -40px;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.image-modal-close:hover {
  transform: scale(1.1);
}

/* Image editing workspace */
.image_edits > .app > .navbar {
  --bs-navbar-padding-y: 1px;
  min-height: 48px;
}

.image_edits:has(.image-edit-studio) .workspace-main {
  display: flex;
  padding: 0 !important;
}

.image_edits:has(.image-edit-studio) .workspace-main > .container {
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0;
}

.app > .navbar .navbar-brand { font-size: 18px; }
.app > .navbar .nav-link { font-size: 14px; }
.app > .navbar .profile-icon { font-size: 18px; }

.image-edit-studio {
  position: relative;
  flex: 1;
  min-height: 480px;
}

.image-edit-upload {
  position: absolute;
  top: 8px;
  bottom: 170px;
  left: 50%;
  transform: translateX(-50%);
  width: min(800px, calc(100% - 64px));
}

.image-edit-upload-area {
  position: absolute;
  inset: 0;
  border-radius: 1.25rem;
}

.image-edit-upload-area:hover {
  background: #fafafa;
}

.image-edit-welcome {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.image-edit-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.image-edit-intro h1,
.image-edit-intro p { margin: 0; }

.image-edit-welcome h1 {
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -.04em;
  text-align: center;
}

.image-edit-composer {
  position: fixed;
  bottom: 24px;
  left: calc(240px + (100% - 240px) / 2);
  transform: translateX(-50%);
  width: min(800px, calc(100% - 304px));
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 1.25rem;
  background: var(--bs-body-bg);
  box-shadow: 0 4px 24px rgb(0 0 0 / 6%);
  z-index: 10;
}

.image-edit-prompt-input {
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--bs-body-color);
  padding: .25rem .25rem .75rem;
}

.image-edit-composer:focus-within {
  border-color: #868e96;
}

.image-edit-composer-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.image-edit-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.image-edit-upload-area:has(.image-edit-file-input:focus-visible) {
  outline: 2px solid #868e96;
  outline-offset: -4px;
}

.image-edit-file-hint {
  font-size: .75rem;
  color: var(--bs-secondary-color);
}

.image-edit-send {
  margin-left: auto;
  border-radius: .625rem;
  padding: .375rem .625rem;
  font-size: .875rem;
}

.image-edit-send i { margin-right: .375rem; }

.image-edit-attachment {
  max-width: min(640px, 100%);
  max-height: 45dvh;
  object-fit: contain;
  border-radius: .75rem;
}

.image-edit-upload-area.dragover {
  background: var(--bs-tertiary-bg);
  outline: 2px dashed #868e96;
  outline-offset: -8px;
}

@media (max-width: 767.98px) {
  .image-edit-upload {
    width: calc(100% - 32px);
  }

  .image-edit-composer {
    left: 50%;
    width: calc(100% - 32px);
    bottom: 16px;
  }

  .image-edit-welcome h1 {
    font-size: 1.4rem;
  }
}

.image-edit-base-prompt-note {
  color: #93979b;
  font-size: .75rem;
}

.image-edit-base-prompt-note a {
  color: inherit;
  text-underline-offset: 3px;
}

.image-edit-base-prompt-note a:hover,
.image-edit-base-prompt-note a:focus-visible {
  color: #495057;
}

.image-edit-base-prompt {
  position: absolute;
  inset: 0 0 190px;
  overflow-y: auto;
  padding: 24px;
}

.image-edit-back {
  border: 0;
  background: transparent;
  padding: .375rem .5rem;
  color: var(--bs-secondary-color);
  font-size: .875rem;
}

.image-edit-back:hover { color: var(--bs-body-color); }

.image-edit-base-prompt-content {
  max-width: 800px;
  margin: 24px auto;
}

.image-edit-base-prompt-content h2 {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.image-edit-base-prompt-content pre {
  font: inherit;
  font-size: .875rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.image-edit-upload.has-image .image-edit-upload-area {
  position: absolute;
  border: 0;
  overflow: visible;
  background: transparent;
  outline: none;
}

.image-edit-upload.has-image .image-edit-welcome { padding: 0; }

.image-edit-upload.has-image .image-edit-attachment {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}

.image-edit-upload.has-image .image-edit-upload-area:hover .image-edit-attachment,
.image-edit-upload.has-image .image-edit-upload-area.dragover .image-edit-attachment,
.image-edit-upload.has-image .image-edit-upload-area:has(.image-edit-file-input:focus-visible) .image-edit-attachment {
  box-shadow: 0 0 0 1px #adb5bd, 0 3px 10px rgb(0 0 0 / 7%);
}

.image-edit-direction {
  align-self: center;
  text-align: center;
  color: #adb5bd;
  font-size: 24px;
}

.image-edit-generating {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--bs-secondary-color);
  font-size: .875rem;
}

.image-edit-generating[hidden] { display: none; }

.image-edit-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
}

.image-edit-photo-column {
  min-width: 0;
  display: flex;
  justify-content: center;
}

.image-edit-photo {
  position: relative;
  max-width: 100%;
  margin: 0;
}

.image-edit-photo > img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 104px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.image-edit-photo-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
}

.image-edit-photo:hover .image-edit-photo-actions,
.image-edit-photo:focus-within .image-edit-photo-actions {
  opacity: 1;
  pointer-events: auto;
}

.image-edit-photo-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: rgb(255 255 255 / 92%);
  color: #495057;
  box-shadow: 0 1px 6px rgb(0 0 0 / 12%);
  text-decoration: none;
}

.image-edit-photo-action[hidden] { display: none; }
.image-edit-photo-action:hover { background: #fff; color: #212529; }

.image-edit-copy-status {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  padding: 6px 10px;
  background: rgb(255 255 255 / 94%);
  border-radius: 4px;
  font-size: .75rem;
  text-align: center;
}

@media (hover: none) {
  .image-edit-photo-actions { opacity: 1; pointer-events: auto; }
}

.image-edit-mobile-label { display: none; }

@media (max-width: 575.98px) {
  .image-edit-comparison { gap: 24px; grid-template-columns: minmax(0, 1fr); }
  .image-edit-comparison > .image-edit-direction { display: none; }
  .image-edit-comparison .image-edit-photo-column { flex-direction: column; }
  .image-edit-mobile-label {
    display: block;
    margin: 0 0 8px;
    color: var(--bs-secondary-color);
    font-size: 14px;
  }
  .image-edit-comparison .image-edit-photo > img {
    width: 100%;
    max-height: none;
  }
  .image-edit-photo-actions { top: 4px; right: 4px; gap: 4px; }
}

.image-edit-note {
  max-width: 1100px;
  margin-inline: auto;
}

.image-edit-note-field {
  padding: 12px;
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  background: var(--bs-body-bg);
}

.image-edit-note-field:focus-within {
  border-color: #adb5bd;
  box-shadow: 0 0 0 2px rgba(33, 37, 41, 0.06);
}

.image-edit-note-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.image-edit-note-field textarea.form-control {
  min-height: 1.5em;
  resize: none;
  overflow: hidden;
  padding: 0;
  margin-bottom: 10px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .image_edits.show .workspace-main {
    padding-inline: 24px;
  }

  .image_edits.show .workspace-main > .container {
    max-width: none;
    padding-inline: 0;
  }
}

.openai-beta-badge {
  background-color: #e9f2ff;
  color: #526f94;
}

.app-navbar {
  min-height: 48px;
  padding-block: 0;
}

.app-navbar > .container-fluid {
  min-height: 48px;
  gap: 12px;
}

.app-navbar .navbar-brand {
  margin-right: 0;
  padding-block: 0;
}

.app-navbar .navbar-collapse {
  min-width: 0;
}

.app-navbar #userDropdown {
  min-width: 40px;
  min-height: 40px;
  justify-content: center;
}

.app-navbar .dropdown-menu {
  position: absolute;
}

@media (max-width: 991.98px) {
  .app-navbar > .container-fluid {
    padding-inline: 12px;
    gap: 16px;
  }

  .app > .app-navbar .navbar-brand {
    font-size: 17px;
    letter-spacing: -.3px;
  }

  .app > .app-navbar .nav-link {
    padding: 10px 9px;
    font-size: 13px;
    white-space: nowrap;
  }

  .app-navbar .nav-link.active {
    color: #fff;
  }

  .app-navbar #userDropdown {
    padding: 8px;
  }

  .app-navbar #userDropdown::after {
    display: none;
  }

  .app-navbar .dropdown-menu {
    margin-top: 4px;
    min-width: 190px;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
  }

  .app-navbar .dropdown-item {
    padding: 9px 12px;
    border-radius: 4px;
    font-size: 14px;
  }
}

@media (max-width: 575.98px) {
  .image-edit-base-prompt-prefix,
  .image-edit-send .bi-image {
    display: none;
  }

  .image-edit-base-prompt-note,
  .image-edit-send {
    white-space: nowrap;
  }

  .image-edit-send {
    flex-shrink: 0;
  }
}

/* Image refinement conversation */
.image-edit-chat {
  max-width: 800px;
  margin-inline: auto;
  padding-bottom: 240px;
}

.image-edit-chat-heading {
  text-align: center;
  margin-bottom: 32px;
}

.image-edit-chat-heading h1 {
  max-width: 340px;
  margin: 0 auto;
  font-size: 1.25rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-edit-turn {
  margin-bottom: 40px;
  scroll-margin-top: 24px;
}

.image-edit-user-message {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}

.image-edit-user-prompt {
  max-width: 85%;
  margin: 0;
  padding: 12px 18px;
  border-radius: 20px 20px 4px 20px;
  background: var(--bs-tertiary-bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.image-edit-chat .image-edit-photo-column { justify-content: flex-start; }
.image-edit-chat .image-edit-source { max-width: min(280px, 70%); }
.image-edit-chat .image-edit-source img { max-height: 280px; }
.image-edit-assistant-message { max-width: 640px; }
.image-edit-assistant-message .image-edit-photo > img { max-height: 70dvh; }
.image-edit-reply .image-edit-base-prompt { position: static; padding: 0; }

.image-edit-reply-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--bs-secondary-color);
  font-size: .875rem;
}

.image-edit-reply-loading[hidden] { display: none; }

@media (max-width: 575.98px) {
  .image-edit-chat { padding-bottom: 260px; }
  .image-edit-chat-heading { margin-bottom: 24px; }
  .image-edit-user-prompt { max-width: 95%; }
}

/* Image details share the chat's available width on desktop. */
.image-edit-chat-heading {
  display: grid;
  grid-template-columns: 36px minmax(0, 340px) 36px;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.image-edit-chat-heading h1 {
  grid-column: 2;
  width: 100%;
  min-width: 0;
}

.image-edit-details-trigger,
.image-edit-details-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bs-secondary-color);
}

.image-edit-details-trigger:hover,
.image-edit-details-close:hover { background: var(--bs-tertiary-bg); }

.image-edit-details-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  z-index: 1040;
}

.image-edit-details-panel[open] { display: flex; flex-direction: column; }
.image-edit-details-panel::backdrop { background: rgb(0 0 0 / 30%); }
body:has(.image-edit-details-panel[open][aria-modal="true"]) { overflow: hidden; }

.image-edit-details-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--bs-border-color);
}

.image-edit-details-header h2 { margin: 0; font-size: 1.125rem; font-weight: 500; }
.image-edit-details-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.image-edit-details-content { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; }
.image-edit-file-details { margin-bottom: 32px; font-size: .875rem; }
.image-edit-file-details dt { margin-bottom: 6px; color: var(--bs-secondary-color); font-weight: 400; }
.image-edit-file-details dd { margin-bottom: 20px; overflow-wrap: anywhere; }
.image-edit-details-content .form-label { font-size: .875rem; }
.image-edit-details-content textarea { resize: vertical; }
.image-edit-details-footer { flex: 0 0 auto; padding: 20px 24px; }
.image-edit-details-footer .text-success { margin-bottom: 12px; }

@media (min-width: 1200px) {
  .image_edits.show .workspace-main { transition: padding-right 220ms ease; }
  .image_edits.show .image-edit-composer { transition: left 220ms ease, width 220ms ease; }

  body:has(.image-edit-details-shell.details-open) .workspace-main {
    padding-right: calc(360px + 1.5rem);
  }

  body:has(.image-edit-details-shell.details-open) .image-edit-composer {
    left: calc(240px + (100% - 240px - 360px) / 2);
    width: min(800px, calc(100% - 664px));
  }

  .image-edit-details-panel {
    inset: 48px 0 0 auto;
    width: 360px;
    height: calc(100dvh - 48px);
    border-left: 1px solid var(--bs-border-color);
    transform: translateX(100%);
    transition: transform 220ms ease, display 220ms allow-discrete;
  }

  .image-edit-details-panel[open] { transform: translateX(0); }

  @starting-style {
    .image-edit-details-panel[open] { transform: translateX(100%); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .image_edits.show .workspace-main,
  .image_edits.show .image-edit-composer,
  .image-edit-details-panel { transition: none; }
}
