/* === Sidebar hook block === */
.malu-sidebar-block .block-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.malu-model-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.malu-model-list li {
  padding: 3px 0;
}
.malu-model-list a {
  color: inherit;
  text-decoration: none;
}
.malu-model-list a:hover {
  text-decoration: underline;
}

/* === Model grid (models.tpl) === */
.malu-models-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 0 2rem;
}
.malu-subtitle {
  color: #666;
  margin-bottom: 1.5rem;
}
.malu-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.malu-model-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  transition: box-shadow 0.2s;
}
.malu-model-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
}
.malu-model-img img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
.malu-model-info {
  padding: 1rem;
  flex: 1;
}
.malu-model-info h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.malu-model-info p {
  font-size: 0.9rem;
  color: #555;
  margin: 0;
}
.malu-model-action {
  padding: 0.75rem 1rem;
  border-top: 1px solid #f0f0f0;
}
.malu-configure-btn {
  width: 100%;
  text-align: center;
}

/* === Configurator page (display.tpl) === */
.malu-configurator {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 0 3rem;
  align-items: flex-start;
}

/* Render panel */
.malu-render-panel {
  flex: 1 1 60%;
  position: sticky;
  top: 80px;
}
.malu-render-wrap {
  background: #f7f7f9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8e8e8;
}
#malu-canvas {
  display: block;
  width: 100%;
}
.malu-render-caption {
  padding: 0.4rem 0.75rem;
  text-align: right;
}

/* Options panel */
.malu-options-panel {
  flex: 0 0 380px;
  min-width: 300px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 88px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.malu-options-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #d0d0d0 transparent;
  padding: 0 1rem;
}
.malu-options-footer {
  flex: 0 0 auto;
  padding: 0.4rem 1rem 0.5rem;
  background: #fff;
  border-top: 2px solid #e8e8e8;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.malu-model-header {
  margin-bottom: 1.25rem;
}
.malu-model-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}
.malu-model-desc {
  color: #555;
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
}
.malu-back-link {
  font-size: 0.85rem;
  color: #888;
  text-decoration: none;
}
.malu-back-link:hover {
  color: #333;
}

/* Option groups */
.malu-group {
  margin-bottom: 1.25rem;
}

/* Collapsible group header (replaces static label) */
.malu-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.malu-group-header:hover {
  border-color: #e0e0e0;
}
.malu-group-label-text {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #444;
}
.malu-group-summary {
  flex: 1;
  font-size: 0.8rem;
  color: #888;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 2px;
}
.malu-group-chevron {
  font-size: 0.7rem;
  color: #bbb;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}
.malu-group-body {
  padding-top: 0.4rem;
  overflow: hidden;
}
.malu-group.is-collapsed .malu-group-body {
  display: none;
}
.malu-group.is-collapsed .malu-group-chevron {
  transform: rotate(-90deg);
}

.malu-required {
  color: #e74c3c;
  margin-left: 2px;
}
.malu-group-error {
  color: #e74c3c;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

/* Dropdown fallback */
.malu-select {
  width: 100%;
  font-size: 0.95rem;
}
.malu-select.is-invalid {
  border-color: #e74c3c;
}

/* === Swatch selector === */
.malu-swatch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 6px;
}
/* Specific selector wins over theme button resets */
#malu-config-form .malu-swatch {
  width: 62px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: transform 0.12s, box-shadow 0.12s;
  outline: none;
  position: relative;
  display: inline-block;
  min-width: 0;
  min-height: 0;
}
#malu-config-form .malu-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.32);
}
#malu-config-form .malu-swatch.selected {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111, 0 2px 8px rgba(0,0,0,0.28);
}
.malu-swatch-group.is-invalid .malu-swatch {
  box-shadow: 0 0 0 2px #e74c3c;
}

/* === Button selector === */
.malu-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0;
}
.malu-size-btn {
  padding: 7px 18px;
  border: 2px solid #d0d0d0;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
  line-height: 1;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.malu-size-btn .btn-price {
  font-weight: 400;
  font-size: 0.78rem;
  color: #888;
  margin-left: 3px;
}
.malu-size-btn:hover {
  border-color: #888;
}
.malu-size-btn.selected {
  border-color: #111;
  background: #111;
  color: #fff;
}
.malu-size-btn.selected .btn-price {
  color: #bbb;
}
.malu-btn-group.is-invalid .malu-size-btn {
  border-color: #e74c3c;
}

/* === Card carousel === */
.malu-card-carousel {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}
.malu-card-carousel.is-invalid {
  border-color: #e74c3c;
}
.malu-carousel-viewport {
  overflow: hidden !important;
  position: relative;
}
.malu-card-carousel .malu-card-track {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  transition: transform 0.25s ease;
}
.malu-option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  box-sizing: border-box;
  flex: 0 0 auto;       /* set by JS; never shrink */
  min-width: 0;
}
.malu-option-card:hover {
  background: #fafafa;
  border-color: #f0f0f0;
}
.malu-option-card.selected {
  background: #f5f5f5;
  box-shadow: inset 3px 0 0 #111;
}
.malu-card-thumb {
  flex: 0 0 90px;
}
.malu-card-thumb img {
  width: 90px;
  height: 110px;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  background: #fff;
}
.malu-card-thumb .card-no-img {
  width: 90px;
  height: 110px;
  background: #eee;
  border-radius: 4px;
}
.malu-card-info {
  flex: 1;
  min-width: 0;
}
.card-name {
  font-size: 0.87rem;
  font-weight: 700;
  color: #222;
  margin: 0 0 3px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-desc {
  font-size: 0.77rem;
  color: #777;
  margin: 0 0 4px;
  line-height: 1.3;
}
.card-price {
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  margin: 0;
}
.malu-carousel-nav {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
  gap: 8px;
}
.malu-carousel-btn {
  padding: 4px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s;
  color: #333;
}
.malu-carousel-btn:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #aaa;
}
.malu-carousel-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.malu-carousel-counter {
  flex: 1;
  text-align: center;
  font-size: 0.82rem;
  color: #888;
}

/* Price block — inline with button in footer */
.malu-price-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.malu-price-label {
  font-weight: 600;
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.malu-price-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: #1a1a2e;
  white-space: nowrap;
}

/* Add to cart button — natural width, not stretched */
.malu-addtocart-btn {
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  white-space: nowrap;
}
.malu-addtocart-btn i.material-icons {
  vertical-align: middle;
  margin-right: 5px;
  font-size: 0.95rem;
}

/* === Zoom — hover scale (desktop/tablet only) === */
@media (min-width: 769px) {
  .malu-render-wrap {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: zoom-in;
  }
  .malu-render-wrap:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  }
}

/* === Zoom overlay (lightbox) === */
#malu-zoom-overlay {
  display: none; /* JS-managed; hidden on mobile via media query below */
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}
#malu-zoom-overlay.is-open {
  display: flex;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#malu-zoom-canvas {
  /* Fill viewport while always locking 1000:667 aspect ratio */
  width: min(90vw, calc(82vh * 1.498));
  height: auto;
  max-height: 82vh;
  aspect-ratio: 1000 / 667;
  border-radius: 10px;
  background: #fff;
  filter: drop-shadow(0 0 28px rgba(255,255,255,0.35));
  transform: scale(0.85);
  opacity: 0;
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity   0.25s ease;
  pointer-events: none;
}
#malu-zoom-overlay.is-open #malu-zoom-canvas {
  transform: scale(1);
  opacity: 1;
}
@media (max-width: 768px) {
  #malu-zoom-overlay { display: none !important; }
}

/* Responsive */
@media (max-width: 768px) {
  .malu-configurator {
    flex-direction: column;
    gap: 0;
    padding-top: 0;
  }
  .malu-render-panel {
    position: sticky;
    top: 56px; /* below the fixed mobile navbar */
    z-index: 20;
    flex: none;
    width: 100%;
    background: #fff;
  }
  .malu-render-wrap {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }
  .malu-render-caption {
    display: none;
  }
  .malu-options-panel {
    flex: none;
    min-width: 0;
    width: 100%;
    max-height: none;
    overflow: visible;
  }
  .malu-options-scroll {
    min-height: 0;
    overflow-y: visible;
  }
  .malu-options-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
  }
  .malu-card-carousel {
    border-radius: 6px;
  }
}
