/* =====================================================
   LA VINIA – PRODUCT MODAL (FINAL / CLEAN / iOS SAFE)
===================================================== */

/* Overlay */
.lv-modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
}

/* Modal box */
.lv-modal-box{
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  background: #111;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* desktop için iyi */
  position: relative;
}

/* Close (fallback – pm-header yoksa bile görünür) */
.lv-modal-close{
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 20;
}

/* Warning */
.pm-warning{
  background: #3a0f0f;
  color: #ffb3b3;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  display: none;
}

/* Qty */
.pm-qty{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 0.8rem 0;
}

/* Selected extras preview */
.pm-selected{
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

/* =========================
   EXTRAS SUB PANEL
========================= */
.pm-subpanel{
  position: absolute;
  inset: 0;
  background: #0b0b0b;
  display: none;
  flex-direction: column;
  z-index: 20;
}

.pm-subpanel-header{
  flex-shrink: 0;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #222;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pm-subpanel-body{
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
}

.pm-subpanel-body label{
  display: block;
  padding: 0.45rem 0;
  font-size: 0.95rem;
  border-bottom: 1px dashed #222;
}

.pm-subpanel .btn-primary{
  flex-shrink: 0;
  margin: 0.8rem;
}

/* =====================================================
   MOBILE (iPhone Safari) – SINGLE SOURCE OF TRUTH
===================================================== */
@media (max-width: 768px){

  .lv-modal{
    align-items: flex-start;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Mobilde modal kendi içinde scroll alsın */
  .lv-modal-box{
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* pm-header varsa, X burada konumlanır */
  .pm-header{
    position: relative;
    padding: 1rem 3rem 0.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .pm-header h3{
    margin: 0;
    line-height: 1.2;
  }

  .pm-header .lv-modal-close{
    position: absolute;
    top: 50%;
    right: 0.9rem;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    box-shadow: none !important;
  }

  /* Modal içindeki butonlar: inline padding’i bile ez */
  .lv-modal-box a.btn-primary,
  .lv-modal-box button.btn-primary{
    width: 100%;
    box-sizing: border-box;
    font-size: 0.82rem !important;
    padding: 0.55rem 0.9rem !important;
    min-height: 40px !important;
    line-height: 1.1 !important;
  }

  /* + / − butonları */
  .lv-modal-box .pm-qty a.btn-primary,
  .lv-modal-box .pm-qty button.btn-primary{
    width: auto;
    min-width: 42px !important;
    padding: 0.45rem 0.7rem !important;
    font-size: 0.9rem !important;
  }

  #pm-qty{
    font-size: 0.95rem;
  }

  /* Alt CTA */
  #pm-add-btn{
    padding: 0.65rem 0 !important;
    font-size: 0.85rem !important;
  }
}

@media (max-width: 600px){
  .pm-header{
    padding: 0.85rem 2.8rem 0.45rem 0.9rem;
  }
}
