/**
 * Színvarázs - Modern Pólótervező UI Stíluslap
 * 3 Rétegű realisztikus transzformációval és reszponzív elrendezéssel
 */

/* ==========================================================================
   1. FŐ ELRENDEZÉS ÉS WRAPPER
   ========================================================================== */
.designer-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
  justify-content: space-between;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu,
    Cantarell, 'Helvetica Neue', sans-serif;
  padding: 20px 0;
}

/* Oldalsávok (Eszköztár és Termék opciók) közös modernizálása */
.designer-sidebar,
.designer-options {
  flex: 1;
  min-width: 290px;
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #f0f0f0;
  transition: all 0.3s ease;
}

.designer-sidebar h3,
.designer-options h2 {
  margin-top: 0;
  color: #1a202c;
  font-weight: 700;
  border-bottom: 2px solid #f7fafc;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

/* Középső nagy konténer a pólónak */
.designer-canvas-container {
  flex: 2;
  min-width: 340px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f7fafc;
  border-radius: 24px;
  padding: 40px;
  border: 1px dashed #e2e8f0;
}

/* ==========================================================================
   2. REÁLIS 3 RÉTEGŰ MOCKUP STRUKTÚRA (JAVÍTVA ÉS PONTOSÍTVA)
   ========================================================================== */
.shirt-mockup {
  position: relative;
  width: 450px; /* A HTML canvasod 450x450-es méretéhez igazítva */
  height: 450px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Minden réteget hajszálpontosan egymásra zárunk */
.shirt-base-layer,
#shirt-color-layer,
.shirt-graphic-layer,
.shirt-shadow-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 450px; /* Szigorúan fixáljuk a canvas méretére */
  height: 450px; /* Szigorúan fixáljuk a canvas méretére */
  box-sizing: border-box;
}

/* A képek tökéletes kitöltése */
.shirt-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* RÉTEG SORRENDEK ÉS ÁTFEDÉSEK */
/* 2. réteg: A póló textúrája és árnyékai, ami RÁKEVEREDIK a színre */
.shirt-base-layer {
  z-index: 2; /* A szín fölé helyezzük */
  mix-blend-mode: multiply; /* Ez végzi el a zseniális szín-összemosást! */
  pointer-events: none;
}

.shirt-base-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0.95; /* Finomítjuk a textúra intenzitását */
}

/* 1. réteg: Az alapszín, amit maszkolunk a póló alakjára */
#shirt-color-layer {
  z-index: 1; /* Alulra tesszük a színt */
  transition: background-color 0.4s ease;
  pointer-events: none;

  /* Maszkolás a teljes póló alakjára */
  -webkit-mask-image: url('../images/shirt-base.png');
  mask-image: url('../images/shirt-base.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* A grafikai réteg - Ebbe kerül a canvas, itt KELL engedélyezni az egeret! */
/* 3. réteg: A grafika és a Canvas (változatlanul szuper!) */
.shirt-graphic-layer {
  z-index: 3;
  pointer-events: auto;
}

/* A maszkolt canvas zóna */
.graphic-mask {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto; /* Kulcsfontosságú! */

  -webkit-mask-image: url('../images/shirt-mask-torso.png');
  mask-image: url('../images/shirt-mask-torso.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* 4. réteg: A legfelső extra árnyékok a realisztikus gyűrődésekért */
/* A legfelső réteg az árnyékoké és a gyűrődéseké */
.shirt-shadow-layer {
  z-index: 4;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.6; /* Kicsit visszavesszük, mert a base-layer már eleve sötétít */
}

/* Magát a canvast is rögzítjük, hogy ne nyúlhasson el a maszk miatt */
#tshirt-canvas {
  width: 450px !important;
  height: 450px !important;
  display: block;
}

/* ==========================================================================
   FABRIC.JS INTERAKTÍV RÉTEGEK JAVÍTÁSA (KATTINTHATÓSÁG ÉS MOZGATÁS)
   ========================================================================== */

/* Kényszerítjük a Fabric.js által létrehozott konténert a megfelelő méretre */
.canvas-container {
  width: 450px !important;
  height: 450px !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  pointer-events: auto !important;
  z-index: 10;
}

/* Biztosítjuk, hogy mindkét belső canvas elem (az alsó és az interaktív felső) 
   pontosan kitöltse a területet és reagáljon az egérre */
.lower-canvas,
.upper-canvas {
  width: 450px !important;
  height: 450px !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  pointer-events: auto !important;
}

/* Dupla ellenőrzés: Az árnyék réteg véletlenül se fogja fel a kattintásokat */
.shirt-shadow-layer,
.shirt-shadow-layer img {
  pointer-events: none !important;
}

/* ==========================================================================
   3. ESZKÖZTÁR ÉS DESIGNER ELEMEK
   ========================================================================== */
.tool-group,
.option-group {
  margin-bottom: 22px;
}

.tool-label,
.option-group label {
  font-weight: 600;
  font-size: 14px;
  color: #4a5568;
  display: block;
  margin-bottom: 8px;
}

.tool-label i {
  margin-right: 6px;
  color: #718096;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

/* Form beviteli mezők prémium megjelenése */
.form-control,
.file-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e0;
  border-radius: 10px;
  font-size: 14px;
  background-color: #fcfdfd;
  color: #2d3748;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus,
.file-input:focus {
  border-color: #ff6b00;
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
  outline: none;
  background-color: #fff;
}

/* Rejtett fájlfeltöltő szépítése trükkel (ha szükséges) */
.file-input {
  cursor: pointer;
}

hr {
  border: 0;
  border-top: 1px solid #edf2f7;
  margin: 20px 0;
}

/* ==========================================================================
   4. MODERNEBB GOMBOK ÉS ÁRAZÁS
   ========================================================================== */
.product-price {
  font-size: 28px;
  font-weight: 800;
  color: #ff6b00;
  margin: 10px 0 20px 0;
}

.product-price small {
  font-size: 14px;
  color: #718096;
  font-weight: 400;
  margin-left: 5px;
}

.btn {
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn i {
  font-size: 16px;
}

.btn-primary {
  background: #ff6b00;
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 107, 0, 0.3);
}

.btn-primary:hover {
  background: #e05e00;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #4a5568;
  color: #fff;
}

.btn-secondary:hover {
  background: #2d3748;
}

.btn-danger {
  background: #fff;
  color: #e53e3e;
  border: 1px solid #fed7d7;
}

.btn-danger:hover {
  background: #fff5f5;
  border-color: #e53e3e;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
  display: flex;
}

/* Tipp üzenet a zoomhoz */
.zoom-hint {
  background: #ebf8ff;
  border-left: 4px solid #3182ce;
  padding: 12px;
  border-radius: 0 8px 8px 0;
  margin-top: 15px;
}

.zoom-hint small {
  color: #2b6cb0;
  font-size: 12px;
  line-height: 1.4;
  display: block;
}
