/* Image Studio Mode Styles */

.image-studio {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  position: relative;
}

/* Header */
.studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  z-index: 10;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-header .logo-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border-radius: 20px;
  font-weight: 500;
}

.studio-header .logo-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

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

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Main layout */
.studio-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Version sidebar */
.version-sidebar {
  width: 120px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-title {
  padding: 16px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: center;
}

.version-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-versions {
  padding: 20px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.version-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.version-item:hover {
  border-color: var(--text-muted);
}

.version-item.active {
  border-color: var(--accent);
}

.version-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.version-number {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

/* Image canvas */
.image-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  padding-bottom: 100px; /* Space for input bar */
  position: relative;
  background: var(--bg);
}

.canvas-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
}

.placeholder-icon {
  width: 80px;
  height: 80px;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: white;
}

.placeholder-icon svg {
  width: 100%;
  height: 100%;
}

.canvas-placeholder p {
  font-size: 16px;
  opacity: 0.7;
}

.canvas-image {
  max-width: 100%;
  max-height: calc(100% - 60px); /* Leave space for caption */
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.image-caption {
  margin-top: 16px;
  max-width: 70%;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Skeleton loading */
.skeleton-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.skeleton-image {
  position: relative;
  width: 100%;
  max-width: 800px;
  max-height: 70vh;
  aspect-ratio: 16 / 9; /* Default landscape, overridden by JS */
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.03) 8%,
    rgba(255, 255, 255, 0.08) 18%,
    rgba(255, 255, 255, 0.03) 33%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skeleton-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.skeleton-loader .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.skeleton-loader p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Prompt shown during skeleton loading */
.skeleton-prompt {
  display: none;
  margin-bottom: 16px;
  max-width: 70%;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Floating input bar */
.studio-input {
  position: absolute;
  bottom: 20px;
  left: 120px; /* Account for sidebar width */
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  pointer-events: none;
}

.studio-input .input-container {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 700px;
  padding: 8px 8px 8px 16px;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.studio-input .input-field {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 100px;
}

.studio-input .input-field::placeholder {
  color: var(--text-muted);
}

.studio-input .send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.studio-input .send-btn:hover:not(:disabled) {
  background: var(--accent-dim);
  transform: scale(1.05);
}

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

.studio-input .send-btn svg {
  width: 20px;
  height: 20px;
}

/* Attach button */
.studio-input .attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.studio-input .attach-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Aspect ratio selector */
.aspect-ratio-selector {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-right: 8px;
}

.aspect-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.aspect-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.aspect-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.studio-input .attach-btn svg {
  width: 20px;
  height: 20px;
}

/* Image attachments preview */
.input-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 700px;
  width: 100%;
  padding: 8px 16px;
  margin-bottom: 4px;
  pointer-events: auto;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.attachment-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.attachment-item:hover .attachment-remove {
  opacity: 1;
}

.attachment-remove svg {
  width: 12px;
  height: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .version-sidebar {
    width: 80px;
  }
  
  .image-canvas {
    padding: 20px;
  }
  
  .studio-input .input-container {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .version-sidebar {
    display: none;
  }
}

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

