/* =========================================================
   Jersey Customizer – Box Layout
   ========================================================= */

.jersey-customizer {
    display: block;
    margin-bottom: 1.5em;
}

/* Botiga Theme Integration */
body.theme-botiga .jersey-customizer {
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
}

@media (min-width: 600px) {
    .jersey-customizer {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 2em;
        row-gap: 1em;
    }

    .jersey-customizer__title,
    .jersey-customizer__price {
        grid-column: 1 / -1;
    }

    .jersey-customizer__price {
        margin-top: 1.5em;
    }
}

/* =========================================================
   Modal Overlay
   ========================================================= */

.jc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@media (max-width: 640px) {
    .jc-modal-overlay {
        padding: 8px;
    }
}

/* =========================================================
   Modal Container (scrollbarfrei)
   ========================================================= */

.jc-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 1100px;
    width: 100%;
    height: 90vh;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
    display: flex;
    flex-direction: column;
}

@media (max-width: 640px) {
    .jc-modal {
        height: 100dvh;
        max-height: 100dvh;
    }
}

/* =========================================================
   Modal Close Button
   ========================================================= */

.jc-modal-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .jc-modal-close {
        right: 12px;
        top: 12px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* =========================================================
   Modal Body
   ========================================================= */

.jc-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}



/* =========================================================
   Canvas (Preview)
   ========================================================= */
.jc-modal-canvas {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: relative;
  border: 1px solid #e6e6e6;
}

.jc-modal-controls {
  flex-shrink: 0;
}


.jc-modal-name,
.jc-modal-number {
    position: absolute;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    pointer-events: none;
    text-align: center;
}

/* =========================================================
   Modal Controls
   ========================================================= */

.jc-modal-controls {
    margin-top: 12px;
}

.jc-modal-controls-inner {
    width: 100%;
}

@media (min-width: 768px) {
    .jc-modal-controls-inner {
        display: grid;
        grid-template-columns: repeat(3, minmax(220px, 1fr));
        column-gap: 16px;
        row-gap: 8px;
        align-items: start;
    }
}

/* Feldstruktur */

.jc-modal-controls-inner label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 92px;
    font-size: 14px;
}

/* Inputs & Select */

.jc-modal-controls-inner input,
.jc-modal-controls-inner select {
    height: 38px;
    padding: 6px 8px;
    box-sizing: border-box;
    max-width: 100%;
}

/* Preis unter Feldern */

.jc-modal-controls-inner label small {
    min-height: 16px;
    font-size: 12px;
    color: #666;
    display: block;
}

/* unsichtbarer Platzhalter für Farbe */

.jc-modal-controls-inner label select + small {
    visibility: hidden;
}

/* =========================================================
   Preis & Actions
   ========================================================= */

.jc-modal-price,
.jc-modal-actions {
    grid-column: 1 / -1;
}

.jc-modal-price {
    font-size: 16px;
}

.jc-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start !important;
    margin-left: 0 !important;
}

/* Mobile Controls */

@media (max-width: 640px) {
    .jc-modal-controls-inner {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
}

/* =========================================================
   Utility
   ========================================================= */

body.jc-modal-open {
    overflow: hidden;
}

/* Button placement outside modal */

#jc-open-preview {
    margin: 0.5em auto 0;
    display: inline-block;
}

/* Cart / Order Badges */

.jc-meta-badge,
.jc-order-meta {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.jc-meta-name,
.jc-order-name {
    background: #ffe6f0;
}

.jc-meta-number,
.jc-order-number {
    background: #e6fff0;
}

.jc-meta-price {
    font-weight: 400;
    margin-left: 6px;
    color: #444;
}


/* =========================================================
   MOBILE FIX – Buttons immer sichtbar, Canvas flexibel
   CSS-ONLY, ohne HTML/JS-Änderung
   ========================================================= */

@media (max-width: 640px) {

  /* Modal nimmt exakt die Viewport-Höhe */
  .jc-modal {
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Body verteilt Platz */
  .jc-modal-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Canvas ist der flexible Bereich */
  .jc-modal-canvas {
    flex: 1 1 auto;
    min-height: 30dvh;   /* darf klein werden, aber nicht kollabieren */
    max-height: none;
  }

  /* Controls blockieren keine Höhe */
  .jc-modal-controls {
    flex: 0 0 auto;
  }

  /* 🔑 Buttons IMMER sichtbar */
  .jc-modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: #fff;
    padding-bottom: env(safe-area-inset-bottom);
    margin-top: 8px;
  }

  /* Buttons nutzbar auf kleinen Screens */
  .jc-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .jc-modal-actions .button {
    flex: 1 1 48%;
    min-width: 0;
  }

}
