/* =============================================
   WSP Position Modal - پیشوند wspp- (جدا از wsp-)
   ============================================= */

/* ========== FIX: Modal z-index hierarchy ========== */


/* در wspp-style.css */
.wspp-overlay {
    position: fixed !important;
    z-index: 100000000 !important;  /* ✅ بالاتر از 99999999 */
    pointer-events: auto !important;
}

.wspp-dialog {
    position: fixed;
    z-index: 100000002;
    background-color: #ffffff;
    border-radius: 12px;
    padding: 12px;
    max-width: 90%;
    width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin: auto;
	 max-height: 90vh; /* جلوگیری از overflow در صفحات کوچک */
	 bottom: 0;
    left: 0;
    right: 0;
	TOP:0;

}

/* ریسپانسیو برای موبایل */
@media (max-width: 768px) {
    .wspp-dialog {
        width: 95%;
        max-width: 95%;
        padding: 16px;
        max-height: 96vh;
        border-radius: 8px;
    }
}


/* دکمه باز کردن مودال */
#wsp-open-position-modal {
    position: relative !important;
       pointer-events: auto !important;
}

/* غیرفعال کردن overlayهای WGC وقتی مودال باز است */
body.wsp-modal-open .wgc-popup-overlay:not(.active),
body.wsp-modal-open #wgc-global-loader:not(.active) {
    pointer-events: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}


/* هدر */
.wspp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.wspp-title {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  color: #222;
}

#wsp-close-position-modal, .wspp-close-btn {
  background: #e53935;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
#wsp-close-position-modal, .wspp-close-btn:hover { background: #c62828; }

/* ردیف منوها */
.wspp-selects-row {
  display: flex;
  gap: 12px;
  padding: 16px 18px 8px;
  flex-wrap: wrap;
}

.wspp-select-group {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wspp-label {
  font-size: 13px;
  font-weight: bold;
  color: #444;
}

.wspp-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #333;
  cursor: pointer;
  appearance: auto;
  box-sizing: border-box;
}
.wspp-select:focus { outline: 2px solid #1976d2; border-color: #1976d2; }
.wspp-select:disabled { background: #f5f5f5; color: #aaa; cursor: not-allowed; }

/* هشدار */
.wspp-warning {
  margin: 0 18px;
  padding: 8px 12px;
  background: #fff3e0;
  border: 1px solid #ffb74d;
  border-radius: 6px;
  color: #e65100;
  font-size: 13px;
}

/* دکمه تایید */
#wsp-confirm-position, 
.wspp-confirm-btn {
  display: block;
  width: calc(100% - 36px);
  margin: 12px 18px;
  padding: 12px;
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 15px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
   margin-top: auto; /* چسباندن به پایین */
}
#wsp-confirm-position, 
.wspp-confirm-btn {:hover { background: #1565c0; }

/* مختصات */
.wspp-coords {
  margin: 0 18px 10px;
  padding: 10px 12px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 13px;
  color: #555;
  line-height: 1.7;
}

/* بخش SVG */
.wspp-svg-wrap {
  margin: 0 18px 18px;
  border: 1px dashed #ccc;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #fafafa;
}

.wspp-zoom-hint {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin: 6px 0 0;
  padding: 0;
}

.wspp-svg-item {
  position: relative;
  width: 100%;
}

.wspp-svg-img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
  transition: opacity 0.2s;
}
.wspp-svg-img:hover { opacity: 0.85; }

/* لایت‌باکس */
.wspp-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wspp-lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

#wspp-lightbox-inner svg,
#wspp-lightbox-inner img {
  max-width: 85vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
}

.wspp-lightbox-close {
  position: fixed;
  top: 18px;
  left: 24px;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  line-height: 1;
  z-index: 10;
  transition: color 0.2s;
}
.wspp-lightbox-close:hover { color: #f44336; }

/* ریسپانسیو */
  .wspp-selects-row {
    flex-direction: column;
    gap: 10px;
  }
  .wspp-select-group { min-width: unset; }
  .wspp-confirm-btn { font-size: 14px; padding: 11px; }
  .wspp-title { font-size: 14px; }
}
/* ========================================
   اصلاحات ریسپانسیو و z-index
   ======================================== */

/* 1. اطمینان از box-sizing سراسری */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 2. اصلاح z-index مودال اصلی */
#wsp-modal {
    z-index: 100001 !important; /* بالاتر از wspp-overlay */
}

/* 3. بهبود فاصله‌گذاری در تبلت */
@media (max-width: 1024px) {
    .wsp-modal-content {
        padding: 15px;
    }
    .wsp-size-inputs {
        gap: 12px;
    }
}

/* 4. بهبود موبایل - لت کوچک */
@media (max-width: 768px) {
    #wsp-modal {
        padding: 10px;
        overflow-y: auto;
    }
    
    .wsp-modal-header {
        margin-bottom: 15px;
    }
    
    .wsp-modal-header h2,
    .wsp-main-title {
        font-size: 1.2em;
        line-height: 1.4;
    }
    
    /* فیلدهای ورودی */
    .wsp-size-inputs {
        flex-direction: column;
        gap: 12px;
    }
/* ========================================
   استایل دکمه بستن مودال تکرار چاپ
   ======================================== */

.wgc-repeat-close-btn {
    transition: all 0.3s ease;
}

.wgc-repeat-close-btn:hover {
    background: #d32f2f !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.wgc-repeat-close-btn:active {
    transform: scale(0.98);
}

/* ========================================
   ریسپانسیو برای موبایل
   ======================================== */

@media (max-width: 768px) {
    .wgc-repeat-title {
        font-size: 14px !important;
    }
    
    .wgc-repeat-close-btn {
        padding: 10px 25px !important;
        font-size: 13px !important;
    }
    
    .wgc-repeat-body {
        max-height: 60vh !important;
    }
}
/* ========================================
   اصلاح موقعیت دکمه‌های مودال
   ======================================== */

.wgc-buttons-group {
    position: absolute;
    top: 15px;
    left: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    z-index: 10001;
    width: max-content;
}

.wgc-buttons-group #wsp-close-modal,
.wgc-buttons-group #wgc-show-repeat-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 150px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s;
}

.wgc-buttons-group button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .wgc-buttons-group {
        top: 37px;
            left: 10px;
            gap: 6px;
            padding-top: 0;
    }
    .wgc-buttons-group button {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}
@media (max-width: 480px) {
    #wsp-close-modal {
        top: 10px !important;
        left: 10px !important;
        padding: 5px 10px !important;
        font-size: 12px !important;
    }
	.wgc-buttons-group {
        top: 37px;
            left: 10px;
            gap: 6px;
            padding-top: 0;
    }
}

/* دکمه بستن */
#wsp-close-modal {
    position: relative !important;
    margin: 0 !important;
    padding: 8px 16px !important;
    background: #f44336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: bold !important;
    transition: all 0.2s !important;
    inset: unset !important;
}

#wsp-close-modal:hover {
    background: #d32f2f !important;
    transform: scale(1.05) !important;
}


#wgc-show-repeat-btn:hover {
    background: #555 !important;
    transform: scale(1.05) !important;
}
/* مخفی کردن بخش fpf-fields-config-wrapper */
.fpf-fields-config-wrapper {
    display: none !important;
}
