/* Modern apparel designer UI - matches BlueRidgeCustomCo design system */

:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-secondary: #0ea5e9;
  --color-accent: #8b5cf6;
  --color-success: #10b981;
  --color-dark: #0f172a;
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e1;
  --color-gray-400: #94a3b8;
  --color-gray-500: #64748b;
  --color-gray-600: #475569;
  --color-gray-700: #334155;
  --color-gray-800: #1e293b;
  --color-gray-900: #0f172a;
}

/* Main layout */
.mockups {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: calc(100vh - 72px);
  max-height: calc(100vh - 72px);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-attachment: fixed;
  overflow: hidden;
}

/* Sidebar */
.mockups__sidebar {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--color-gray-200);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
  height: 100%;
  max-height: 100%;
}

.mockups__sidebar-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--color-gray-100);
  background: linear-gradient(to bottom, rgba(255,255,255,1), rgba(248,250,252,0.95));
}

.mockups__title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mockups__filters {
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
}

.mockups__search,
.mockups__select {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-gray-200);
  border-radius: 0.75rem;
  font-size: 0.938rem;
  background: white;
  transition: all 0.2s;
  font-family: inherit;
}

.mockups__search:focus,
.mockups__select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.mockups__catalog {
  overflow: auto;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
  flex: 1;
}

.mockups__catalog-footer {
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  border-top: 2px solid var(--color-gray-100);
  background: var(--color-gray-50);
}

.mockups__results-info {
  color: var(--color-gray-600);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Editor/Canvas area */
.mockups__editor {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  margin: 1rem;
  border-radius: 1.5rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  height: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
}

.mockups__toolbar {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 2px solid var(--color-gray-100);
  align-items: center;
  flex-wrap: wrap;
  background: linear-gradient(to bottom, white, var(--color-gray-50));
}

.mockups__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-gray-700);
  cursor: pointer;
  user-select: none;
}

.mockups__spacer {
  flex: 1;
}

.mockups__stage-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  position: relative;
  padding: 1.5rem;
  min-height: 400px;
  max-height: 100%;
  overflow: hidden;
}

.mockups__stage-wrap canvas {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
}

.mockups__stage-wrap canvas.lower-canvas {
  background: #fff;
  border: 2px solid var(--color-gray-200);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.15);
  border-radius: 0.75rem;
}

.mockups__stage-wrap canvas.upper-canvas {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.mockups__hint {
  margin: 0;
  padding: 1rem 1.5rem;
  color: var(--color-gray-600);
  font-size: 0.875rem;
  text-align: center;
  background: var(--color-gray-50);
  border-top: 1px solid var(--color-gray-100);
}

/* Background chooser modal styling */
.designer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.designer-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}

.designer-modal__dialog {
  position: relative;
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  max-width: 90vw;
  max-height: 90vh;
  width: 1200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.designer-modal__header {
  padding: 1.5rem 2rem;
  border-bottom: 2px solid var(--color-gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, white, var(--color-gray-50));
}

.designer-modal__header h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-dark);
}

.designer-modal__subtitle {
  margin: 0.5rem 0 0;
  color: var(--color-gray-600);
  font-size: 0.938rem;
}

.designer-modal__body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.designer-modal__stage {
  min-height: 400px;
}

.designer-modal__footer {
  padding: 1.5rem 2rem;
  border-top: 2px solid var(--color-gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  background: var(--color-gray-50);
}

.icon-button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--color-gray-500);
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: all 0.2s;
  border-radius: 0.5rem;
}

.icon-button:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

/* Background chooser – three-column layout */
.bgchooser {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 1rem;
  padding: 1.5rem;
}

.bgchooser__pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 50vh;
  max-height: 65vh;
  overflow: auto;
  padding: 1rem;
  border: 2px solid var(--color-gray-200);
  border-radius: 1rem;
  background: var(--color-gray-50);
}

.bgchooser__pane h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bgchooser__list {
  display: grid;
  gap: 0.75rem;
}

.bgchooser__list .card {
  cursor: pointer;
  transition: all 0.2s;
}

.bgchooser__list .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--color-primary);
}

.bgchooser__list .card__body {
  grid-template-columns: 1fr;
}

/* Vectorize loading overlay */
.mockups__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  color: #fff;
  font-weight: 600;
  z-index: 5;
  padding: 2rem;
}

.mockups__loading[hidden] {
  display: none;
}

.mockups__spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-primary);
  animation: mockups-spin 0.8s linear infinite;
}

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

.mockups__loading-text {
  min-width: 200px;
  text-align: center;
  font-size: 1.125rem;
}

.mockups__progress {
  width: 100%;
  max-width: 300px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.mockups__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-success);
  transition: width 200ms ease;
  border-radius: 999px;
}

/* Buttons */
.btn {
  appearance: none;
  border: 2px solid var(--color-gray-200);
  background: white;
  color: var(--color-gray-800);
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.938rem;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn:hover {
  background: var(--color-gray-50);
  border-color: var(--color-gray-300);
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

/* Cards */
.card {
  border: 2px solid var(--color-gray-200);
  border-radius: 1rem;
  background: white;
  overflow: visible;
  display: block;
  width: 100%;
  transition: all 0.2s;
  position: relative;
}

.card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

.card__preview {
  width: 100%;
  display: block;
  background: var(--color-gray-50);
  height: 140px;
  min-height: 140px;
  max-height: 140px;
  position: relative;
  overflow: hidden;
  border-radius: 1rem 1rem 0 0;
}

.card__preview > .card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  transition: transform 0.3s ease, z-index 0s;
  position: relative;
  z-index: 1;
}

.card:hover .card__preview {
  overflow: visible;
  z-index: 50;
}

.card:hover .card__preview > .card__img {
  transform: scale(1.8);
  z-index: 100;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.25));
}

.card__img {
  display: block;
  max-width: 100%;
  height: auto;
}

.card__body {
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.card__title {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--color-dark);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card__meta {
  color: var(--color-gray-600);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.card__btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.813rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .mockups {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .mockups__sidebar {
    height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--color-gray-200);
  }

  .mockups__editor {
    margin: 0.5rem;
  }

  .bgchooser {
    grid-template-columns: 1fr;
  }

  .designer-modal__dialog {
    max-width: 95vw;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .mockups__sidebar {
    height: 60vh;
  }

  .mockups__toolbar {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .bgchooser {
    padding: 1rem;
  }
}
