/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f4f5f9;
  color: #111827;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.studio-shell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.studio-card {
  width: min(1120px, 100%);
  margin: 0 auto;
  background-color: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.studio-header h1 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  font-weight: 700;
}

.studio-header p {
  margin: 0;
  color: #4b5563;
  font-size: 1.05rem;
}

.studio-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.studio-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 240px;
}

.toolbar-field label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.toolbar-field select {
  padding: 0.7rem 1rem;
  border: 1px solid #d5d9e4;
  border-radius: 12px;
  font-size: 1rem;
  background: #f8f9fc;
  color: inherit;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 2rem;
}

.studio-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.studio-panel--controls {
  min-height: 100%;
}

.studio-panel--preview {
  background: linear-gradient(140deg, rgba(79, 70, 229, 0.12), rgba(129, 140, 248, 0.08));
  border-radius: 20px;
  padding: 1.5rem;
  position: relative;
}

.file-field {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.file-field label {
  font-weight: 600;
}

.file-field input[type="file"] {
  padding: 0.75rem;
  border: 1px dashed #c7cbe0;
  border-radius: 12px;
  background: #fbfcff;
  font-size: 0.95rem;
}

.preview-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 16px;
  padding: 1rem;
}

.preview-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  color: #1f2937;
}

.effects-section,
.adjustments-section,
.prompt-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.effects-loading {
  margin: 0;
  font-size: 0.9rem;
  color: #4b5563;
}

.effects-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: 0.9rem;
}

.effects-error__message {
  flex: 1 1 auto;
  min-width: 0;
}

.effects-error__retry {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.effects-error__retry:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
}

.effects-error__retry:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.effects-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 130px;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scroll-snap-type: x proximity;
}

.effects-strip::-webkit-scrollbar,
.adjustments-strip::-webkit-scrollbar {
  height: 6px;
}

.effects-strip::-webkit-scrollbar-thumb,
.adjustments-strip::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 999px;
}

.effect-card {
  position: relative;
  width: 130px;
  height: 130px;
  border-radius: 16px;
  border: 2px solid transparent;
  padding: 0;
  overflow: hidden;
  background: #e0e7ff;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  scroll-snap-align: center;
}

.effect-card img,
.effect-card__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.effect-card__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  color: rgba(30, 64, 175, 0.85);
  background: linear-gradient(180deg, rgba(165, 180, 252, 0.45), rgba(59, 130, 246, 0.45));
}

.effect-card__label {
  position: relative;
  display: block;
  width: 100%;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.9));
  color: #ffffff;
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
}

.effect-card:is(:hover, :focus-visible) {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.25);
}

.effect-card.is-active {
  border-color: #4f46e5;
  box-shadow: 0 16px 32px rgba(79, 70, 229, 0.35);
}

.adjustments-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.adjustment-chip {
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
  color: #312e81;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease;
}

.adjustment-chip:is(:hover, :focus-visible) {
  background: rgba(79, 70, 229, 0.22);
  transform: translateY(-1px);
}

.prompt-input {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.prompt-input textarea {
  flex: 1;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  resize: vertical;
}

.prompt-history {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2.25rem;
}

.prompt-history__empty {
  margin: 0;
  font-size: 0.9rem;
  color: #6b7280;
}

.prompt-history__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(79, 70, 229, 0.14);
  color: #312e81;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.prompt-history__remove {
  border: none;
  background: rgba(49, 46, 129, 0.12);
  color: #1f2937;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  padding: 0;
}

.prompt-history__remove:hover {
  background: rgba(49, 46, 129, 0.24);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.primary-button,
.secondary-button,
.ghost-button,
.link-button {
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-button {
  padding: 0.85rem 1.9rem;
  border: none;
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(79, 70, 229, 0.35);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-button {
  padding: 0.75rem 1.25rem;
  border: 1px solid rgba(79, 70, 229, 0.35);
  background: rgba(99, 102, 241, 0.1);
  color: #312e81;
}

.secondary-button:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.18);
}

.ghost-button {
  padding: 0.65rem 1.1rem;
  border: 1px solid rgba(100, 116, 139, 0.35);
  background: #ffffff;
  color: #1f2937;
}

.ghost-button:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.12);
}

.ghost-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link-button {
  padding: 0.45rem 0.75rem;
  border: none;
  background: none;
  color: #4f46e5;
  text-decoration: underline;
}

.progress {
  min-height: 1.25rem;
  font-size: 0.95rem;
  color: #475569;
}

.status {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  min-height: 1.5rem;
  font-weight: 600;
  background: #eef2ff;
  color: #3730a3;
}

.status--info {
  background-color: #eef2ff;
  color: #3730a3;
}

.status--success {
  background-color: #ecfdf5;
  color: #047857;
}

.status--error {
  background-color: #fef2f2;
  color: #b91c1c;
}

.comparison {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

.comparison-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  overflow: hidden;
  background: #0f172a;
  --comparison-split: 50%;
}

.comparison-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comparison-stage [data-upload-target="comparisonProcessed"] {
  z-index: 1;
}

.comparison-stage [data-upload-target="comparisonOriginal"] {
  z-index: 2;
  clip-path: inset(0 0 calc(100% - var(--comparison-split, 50%)) 0);
  box-shadow: inset 0 -40px 60px rgba(15, 23, 42, 0.35);
}

.comparison-slider {
  position: absolute;
  top: 50%;
  right: 0.8rem;
  transform: translateY(-50%);
  height: 70%;
  writing-mode: bt-lr;
  -webkit-appearance: slider-vertical;
  background: transparent;
}

.comparison-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4f46e5;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35);
}

.comparison-slider::-webkit-slider-runnable-track {
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}

.comparison-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4f46e5;
  border: 2px solid #ffffff;
}

.comparison-slider::-moz-range-track {
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}

.comparison-footer {
  display: flex;
  justify-content: flex-end;
}

.comparison-footer a {
  color: #312e81;
  font-weight: 600;
  text-decoration: none;
}

.comparison-footer a:hover {
  text-decoration: underline;
}

.empty-result {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  font-size: 1.05rem;
  text-align: center;
  padding: 2rem;
}

.hidden {
  display: none !important;
}

.empty-state {
  font-size: 1.1rem;
  color: #475569;
  background-color: #eef2ff;
  border: 1px dashed #6366f1;
  padding: 1.25rem;
  border-radius: 12px;
}

/* Content page styles for policy/legal pages */
.content-page-wrapper {
  max-width: 900px;
  margin: 0 auto;
}

.content-page {
  line-height: 1.7;
  font-size: 1rem;
  color: #374151;
}

.content-meta {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4338ca;
  margin-bottom: 2rem;
  border: 1px solid #c7d2fe;
}

.content-page h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: #1f2937;
  line-height: 1.3;
}

.content-page h2:first-of-type {
  margin-top: 1.5rem;
}

.content-page h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.875rem;
  color: #374151;
  line-height: 1.3;
}

.content-page p {
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.content-page ul {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
  list-style-type: disc;
}

.content-page li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
  line-height: 1.6;
}

.content-page li::marker {
  color: #6366f1;
}

.content-page strong {
  font-weight: 600;
  color: #1f2937;
}

.content-page a {
  color: #4f46e5;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.content-page a:hover {
  color: #6366f1;
}

.content-divider {
  margin: 2.5rem 0;
  border: none;
  border-top: 2px solid #e5e7eb;
}

.info-callout {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-left: 4px solid #4f46e5;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  margin: 1.5rem 0;
}

.info-callout p {
  margin-bottom: 0.75rem;
}

.info-callout p:last-child {
  margin-bottom: 0;
}

.info-callout ul {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.studio-header--page {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.studio-header--page h1 {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.studio-header--page p {
  font-size: 1.1rem;
  color: #6b7280;
}

.studio-header--centered {
  text-align: center;
}

.studio-header--centered h1,
.studio-header--centered p {
  text-align: center;
}

@media (max-width: 960px) {
  .studio-card {
    padding: 2rem;
  }

  .studio-layout {
    grid-template-columns: 1fr;
  }

  .studio-panel--preview {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .studio-shell {
    padding: 2rem 1rem;
  }

  .studio-card {
    padding: 1.75rem;
  }

  .studio-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button {
    width: 100%;
  }

  .prompt-input {
    flex-direction: column;
  }

  .comparison-slider {
    right: 0.4rem;
  }

  .content-page {
    padding: 0;
    font-size: 0.95rem;
  }

  .content-page h2 {
    font-size: 1.35rem;
  }

  .content-page h3 {
    font-size: 1.15rem;
  }

  .studio-header--page h1 {
    font-size: 1.75rem;
  }

  .studio-header--page p {
    font-size: 1rem;
  }

  .info-callout {
    padding: 1rem 1.25rem;
  }
}
