/* === General Modal Styles === */
.gfem-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(60,72,100,0.27); 
  justify-content: center;
  align-items: flex-start;
  padding-top: 44px;
  direction: rtl;
}
.gfem-modal.open { display: flex !important; }
.gfem-modal-dialog, .gfem-modal-dialog.gfem-receipt {
  background: #fff;
  color: #233;
  border-radius: 12px;
  box-shadow: 0 8px 40px 2px #3332;
  width: 600px;
  max-width: 98vw;
  margin: 0 auto;
  position: relative;
  padding: 36px 32px 26px 32px;
  font-family: Tahoma, Arial, sans-serif;
  direction: rtl;
  min-height: 200px;
  animation: fadeInModal 0.3s;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: thin;     
  scrollbar-color: #bad1de #f2f6fa;
}
.gfem-modal-dialog::-webkit-scrollbar,
.gfem-modal-dialog.gfem-receipt::-webkit-scrollbar {
  width: 8px;
  background: #f2f6fa;
  border-radius: 6px;
}
.gfem-modal-dialog::-webkit-scrollbar-thumb,
.gfem-modal-dialog.gfem-receipt::-webkit-scrollbar-thumb {
  background: #bad1de;
  border-radius: 6px;
}
.gfem-modal-dialog::-webkit-scrollbar-thumb:hover,
.gfem-modal-dialog.gfem-receipt::-webkit-scrollbar-thumb:hover {
  background: #91bbd8;
}
.gfem-modal-dialog.large { max-width: 700px !important; }

#gfem-receipt-modal-close, #gfem-edit-modal-close {
  color: #bbb;
  position: absolute;
  top: 12px;
  left: 18px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  z-index: 12;
  line-height: 1;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  transition: color 0.13s, background .16s;
}
#gfem-receipt-modal-close:hover, #gfem-edit-modal-close:hover {
  color: #fff;
  background: #d9534f;
}

/* === Receipt Modal Specific Styles === */
.gfem-receipt-container {
  font-family: Tahoma, Arial, sans-serif;
  background: #f7fbfe;
  border-radius: 7px;
  box-shadow: 0 2px 12px #c8d6e524;
  padding: 17px 7px 8px 7px;
  color: #183057;
}

.gfem-receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #e8eeff;
  padding-bottom: 8px;
  margin-bottom: 18px;
}
.gfem-receipt-header h2 {
  margin: 0 0 0 20px;
  font-size: 18px;
  color: #144777;
  font-weight: bold;
}
.gfem-print-btn {
  background-color: #27ae60;
  color: #fff;
  padding: 6px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13.5px;
  box-shadow: 0 1px 9px #70cda276;
  margin-right: 4px;
}
.gfem-print-btn:hover { background-color: #228751; }
.gfem-receipt-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.gfem-receipt-list li {
  padding: 9px 5px 7px 5px;
  border-bottom: 1px solid #eff5fb;
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #1d3655;
}
.gfem-receipt-list li:last-child { border-bottom: none; }
.gfem-receipt-list li strong   { color: #2554a1; flex-basis: 37%; text-align: right; }
.gfem-receipt-list li span     { color: #122844; flex-basis: 63%; text-align: left; direction: ltr; font-family: Arial, Tahoma, sans-serif; }

/* === جستجوی اینلاین و ریسپانسیو === */
.gfem-search-form,
.gfem-search-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 14px !important;
    align-items: center !important;
    justify-content: flex-start !important;
}
.gfem-search-btn {
    padding: 10px 28px !important;
    border-radius: 6px !important;
    border: none !important;
    background: #eceff2 !important;
    color: #233 !important;
    font-size: 15px !important;
    cursor: pointer !important;
    transition: background 0.2s;
    min-width: 80px !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 9px #d8e8fa66 !important;
}
.gfem-input {
    min-width: 155px !important;
    border-radius: 6px !important;
    border: 1px solid #dde8f3 !important;
    background: #f4fafd !important;
    padding: 9px 10px !important;
    font-size: 15px !important;
}

.gfem-search-btn {
  padding: 10px 28px;
  border-radius: 6px;
  border: none;
  background: #eceff2;
  color: #233;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.gfem-search-btn:hover { background: #bad1de; color: #183057; }
@media (max-width: 600px) {
  .gfem-search-form,
  .gfem-search-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
}


/* ==== جدول و دکمه‌ها ==== */
.gfem-table { border: none; border-radius: 5px; overflow: hidden; background: #fff; width: 100%; max-width: 1000px; margin: 35px auto 22px auto; box-shadow: 0 4px 24px #b7eaff33, 0 1.5px 0 #e6fbff; direction: rtl; font-family: Tahoma, Arial, sans-serif; }
.gfem-table th, .gfem-table td { padding: 10px 7px; text-align: center; border-bottom: 1px solid #f0f8fa; font-size: 14px; vertical-align: middle;}
.gfem-table th { background: linear-gradient(90deg, #d1f1fb 0%, #e7fcff 100%); font-weight: bold; color: #115178;}
.gfem-table tr:hover td { background: #e8fbff !important;}
.gfem-receipt-btn, .gfem-edit-btn, .gfem-search-btn {
  padding: 7px 18px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  color: white;
}
.gfem-receipt-btn { background: #22A7F2; }
.gfem-receipt-btn:hover { background: #1178bc; }
.gfem-edit-btn { background: #ffbe2e; color: #444; }
.gfem-edit-btn:hover { background: #ffdb7d; color:#222; }
/* دکمه حذف */
.gfem-delete-btn {
  background: linear-gradient(90deg, #ff6a9f 0%, #ffd0ea 100%);
  color: #fff !important;
  border: none;
  border-radius: 5px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px #ffb4d862;
  outline: none;
  margin: 0 2px;
  line-height: 1.7;
  transition: background 0.14s, color 0.13s, box-shadow 0.16s;
  position: relative;
}
.gfem-delete-btn:hover {
  background: linear-gradient(90deg, #e93371 0%, #fe95c5 100%);
  color: #fff !important;
}
.gfem-delete-btn:active {
  background: #ff3e79;
  color: #fff !important;
}

/* ==== لودینگ و ارور ==== */
.gfem-loading-spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  width: 40px; height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}
@keyframes spin { 0% { transform: rotate(0deg);} 100% {transform: rotate(360deg);} }
.gfem-error-msg {
  color: #d9534f;
  background-color: #f9e3e3;
  border: 1px solid #ecb8b9;
  padding: 15px 6px;
  text-align: center;
  border-radius: 7px;
  font-size: 15.5px;
  margin: 18px 5px;
}

/* انیمیشن مدال */
@keyframes fadeInModal {
  from {transform: translateY(28px); opacity: 0;}
  to {transform: translateY(0); opacity: 1;}
}

/* ==== Responsive for modal (موبایل) ==== */
@media (max-width: 700px) {
  .gfem-modal-dialog, .gfem-modal-dialog.gfem-receipt { width: 98vw !important; padding: 14px 6vw !important; }
  .gfem-receipt-header h2 { font-size: 16.5px; }
  .gfem-modal-dialog.large { max-width: 99vw !important; }
}

/* فقط رسید چاپ شود هنگام پرینت */
@media print {
  body * { visibility: hidden !important; }
  .gfem-receipt-container, .gfem-receipt-container * { visibility: visible !important; }
  .gfem-receipt-container { position: absolute; left: 0; top: 0; width: 100%; background: #fff; color: #152037;}
  .gfem-print-btn, #gfem-receipt-modal-close, #gfem-edit-modal-close { display: none !important; }
}
