/* =========================
   DESIGN GALLERY
   ========================= */

.theme-design {
  background: #f6f7fb;
}

.design-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  padding: 18px;
}

/* --- Tile --- */
.design-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.design-tile.enabled {
  cursor: pointer;
}
.design-tile.enabled:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}
.design-tile.enabled:focus {
  outline: 3px solid rgba(64, 115, 255, 0.35);
  outline-offset: 2px;
}

.design-tile.disabled {
  opacity: 0.55;
  filter: saturate(0.2);
}

/* --- Image viewport (FIXED & CORRECT) --- */
.design-thumb {
  height: 180px;
  width: 100%;
  background: #f2f4f7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.design-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.design-thumb.placeholder {
  background: repeating-linear-gradient(
    45deg,
    #e9ecf5,
    #e9ecf5 12px,
    #f4f6fb 12px,
    #f4f6fb 24px
  );
}

/* --- Body --- */
.design-body {
  padding: 14px 14px 16px;
}

.design-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.design-desc {
  color: #444;
  font-size: 14px;
  line-height: 1.3;
  min-height: 44px;
}

.design-meta {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.design-badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f2ff;
  color: #0b4aa5;
  font-weight: 600;
}

.design-badge.muted {
  background: #f0f0f0;
  color: #666;
}

/* =========================
   DESIGN GALLERY TILE FIX
   ========================= */

/* Tile chrome */
.design-tile {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden; /* 🔑 clips oversized images */
  background: #fff;
}

/* Image viewport */
.design-thumb {
  height: 180px; /* 👈 THIS is the key */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f2f4f7;
}

/* Image behavior */
.design-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* preserve aspect ratio */
}

/* =========================================================
   DESIGN STACKING MODULE — LAYOUT
   ========================================================= */

.design-stack-layout {
  display: flex;
  gap: 28px;
  padding: 20px 22px;
  align-items: flex-start;
}

/* =========================================================
   LEFT PANEL — IMAGE + DESCRIPTION
   ========================================================= */

.design-stack-left {
  flex: 1 1 45%;
  max-width: 480px;
}

.design-image-frame {
  width: 100%;
  background: #f2f4f7;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 12px;
}

.design-image-frame img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.design-description {
  margin-top: 14px;
  font-size: 14px;
  color: #444;
  line-height: 1.45;
}

/* =========================================================
   RIGHT PANEL — CONTROLS
   ========================================================= */

.design-stack-right {
  flex: 1 1 55%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* =========================================================
   DESIGN PANELS (Dimensions / Options / Results)
   ========================================================= */

.design-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 14px 16px 16px;
}

.design-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */

.design-panel label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 14px;
}

.design-panel input[type='number'] {
  width: 120px; /* 👈 intentional constraint */
  padding: 4px 6px;
  font-size: 14px;
}

.design-panel input[type='checkbox'] {
  transform: translateY(1px);
}

.design-panel .checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* =========================================================
   RESULTS PANEL
   ========================================================= */

.design-results {
  background: #f9fafc;
}

.result-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px dotted rgba(0, 0, 0, 0.15);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row span:last-child {
  font-weight: 700;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.design-actions {
  padding-top: 8px;
}

.design-actions .wm-btn.primary {
  padding: 8px 16px;
  font-size: 14px;
}

/* =========================================================
   RESPONSIVE (Optional but nice)
   ========================================================= */

@media (max-width: 900px) {
  .design-stack-layout {
    flex-direction: column;
  }

  .design-stack-left,
  .design-stack-right {
    max-width: 100%;
  }
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-left: 8px;
}

.hidden {
  display: none;
}

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