@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* R8 Dark Theme Colors */
:root {
  --gray-1: #111111;
  --gray-2: #191919;
  --gray-3: #222222;
  --gray-4: #2a2a2a;
  --gray-5: #313131;
  --gray-6: #3a3a3a;
  --gray-7: #484848;
  --gray-8: #606060;
  --gray-9: #6e6e6e;
  --gray-10: #7b7b7b;
  --gray-11: #b4b4b4;
  --gray-12: #eeeeee;

  --blue-9: #0090ff;
  --blue-10: #3b9eff;
  --blue-11: #70b8ff;

  --green-9: #46a758;
  --green-10: #55b467;

  --red-9: #e5484d;
  --red-10: #ec6d71;

  --yellow-9: #ffc53d;
  --yellow-10: #ffd60a;

  /* Always dark mode */
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--gray-1);
  color: var(--gray-12);
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 120rem; /* 1920px */
  margin: 0 auto;
  padding: 0 1.25rem; /* 20px */
}

/* Button styles - no rounded corners like Replicate */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  background: transparent;
}

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

.btn-primary {
  background-color: var(--gray-12);
  color: var(--gray-1);
  border-color: var(--gray-12);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--gray-11);
  border-color: var(--gray-11);
}

.btn-green {
  background-color: var(--green-9);
  color: white;
  border-color: var(--green-9);
}

.btn-green:hover:not(:disabled) {
  background-color: var(--green-10);
  border-color: var(--green-10);
}

.btn-red {
  background-color: var(--red-9);
  color: white;
  border-color: var(--red-9);
}

.btn-red:hover:not(:disabled) {
  background-color: var(--red-10);
  border-color: var(--red-10);
}

.btn-secondary {
  background-color: var(--gray-3);
  color: var(--gray-11);
  border-color: var(--gray-5);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--gray-4);
  border-color: var(--gray-6);
}

/* Card styles - no rounded corners */
.card {
  background-color: var(--gray-2);
  border: 1px solid var(--gray-4);
  padding: 1rem;
}

.card-interactive {
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  padding: 0.75rem;
  border: 1px solid var(--gray-4);
  background-color: var(--gray-2);
}

.card-interactive:hover {
  background-color: var(--gray-3);
  border-color: var(--gray-5);
}

/* Input styles */
.input {
  background-color: var(--gray-2);
  border: 1px solid var(--gray-5);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  color: var(--gray-12);
  font-size: 0.875rem;
}

.input:focus {
  outline: none;
  border-color: var(--blue-9);
  box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.1);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid;
}

.badge-starting {
  background-color: rgba(255, 197, 61, 0.1);
  color: var(--yellow-9);
  border-color: rgba(255, 197, 61, 0.3);
}

.badge-processing {
  background-color: rgba(0, 112, 243, 0.1);
  color: var(--blue-9);
  border-color: rgba(0, 112, 243, 0.3);
}

.badge-successful {
  background-color: rgba(70, 167, 88, 0.1);
  color: var(--green-9);
  border-color: rgba(70, 167, 88, 0.3);
}

.badge-failed {
  background-color: rgba(229, 72, 77, 0.1);
  color: var(--red-9);
  border-color: rgba(229, 72, 77, 0.3);
}

/* Grid */
.grid-5 {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .grid-5 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 2000px) {
  .grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Model output images - square aspect ratio */
.model-output-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background-color: var(--gray-3);
  border: 1px solid var(--gray-4);
}

/* Grid images for multiple outputs */
.output-images-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.output-images-grid.single {
  grid-template-columns: 1fr;
}

.output-images-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background-color: var(--gray-3);
  border: 1px solid var(--gray-4);
}

/* Tabs */
.tabs {
  border-bottom: 1px solid var(--gray-5);
  display: flex;
  gap: 0.25rem;
}

.tab {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  color: var(--gray-9);
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

.tab:hover {
  color: var(--gray-11);
  border-bottom-color: var(--gray-7);
}

.tab.active {
  color: var(--blue-9);
  border-bottom-color: var(--blue-9);
}

/* Utility classes */
.text-muted {
  color: var(--gray-9);
}

.text-secondary {
  color: var(--gray-11);
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.space-y-8 > * + * {
  margin-top: 2rem;
}

.space-x-2 > * + * {
  margin-left: 0.5rem;
}

.space-x-4 > * + * {
  margin-left: 1rem;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}
.mb-8 {
  margin-bottom: 2rem;
}

.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-6 {
  margin-top: 1.5rem;
}
.mt-8 {
  margin-top: 2rem;
}

.py-8 {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.text-sm {
  font-size: 0.875rem;
}
.text-lg {
  font-size: 1.125rem;
}
.text-xl {
  font-size: 1.25rem;
}
.text-2xl {
  font-size: 1.5rem;
}
.text-3xl {
  font-size: 1.875rem;
}

.font-medium {
  font-weight: 500;
}
.font-semibold {
  font-weight: 600;
}
.font-bold {
  font-weight: 700;
}

.rounded {
  border-radius: 0.375rem;
}
.rounded-lg {
  border-radius: 0.5rem;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Header with input set responsive layout */
.header-with-input-set {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.header-content {
  flex: 1;
  min-width: 0;
}

.input-set-container {
  flex: 0 0 40%;
  min-width: 300px;
}

@media (max-width: 768px) {
  .header-with-input-set {
    flex-direction: column;
  }

  .input-set-container {
    flex: none;
    width: 100%;
    min-width: auto;
  }
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.toast-success {
  background-color: var(--green-9);
  color: white;
}

.toast-error {
  background-color: var(--red-9);
  color: white;
}

.toast-info {
  background-color: var(--blue-9);
  color: white;
}

/* Checkmark fade out animation */
@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: scale(0.8);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}
