/* === Root / Base === */
.aepg-finishing-calculator {
    direction: rtl;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding: 40px 16px;
    background: radial-gradient(circle at top left, #1e293b 0, #020617 55%, #000 100%);
    color: #e5e7eb;
}

.aepg-calculator-inner {
    max-width: 980px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 28px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow:
        0 25px 60px rgba(15, 23, 42, 0.8),
        0 0 0 1px rgba(15, 23, 42, 0.7);
    padding: 32px 24px 28px;
    backdrop-filter: blur(18px);
    position: relative;
    overflow: hidden;
}

.aepg-title {
    font-size: 28px;
    font-weight: 800;
    color: #f9fafb;
    margin: 0 0 8px;
    text-align: center;
    letter-spacing: 0.03em;
}

.aepg-subtitle {
    margin: 0 0 24px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.aepg-finishing-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.aepg-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aepg-row > label {
    font-size: 14px;
    font-weight: 600;
    color: #e5e7eb;
}

.aepg-row input[type="text"],
.aepg-row input[type="number"],
.aepg-row select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background-color: rgba(15, 23, 42, 0.9);
    color: #f9fafb;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
}

.aepg-row input::placeholder,
.aepg-row select:invalid {
    color: #6b7280;
}

.aepg-row input[type="text"]:focus,
.aepg-row input[type="number"]:focus,
.aepg-row select:focus {
    border-color: #22d3ee;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.4);
    background-color: rgba(15, 23, 42, 0.98);
    transform: translateY(-1px);
}

.aepg-note,
.aepg-row small {
    font-size: 11px;
    color: #9ca3af;
}

.aepg-kitchen-warning {
    margin-top: 4px;
    color: #f97316;
    font-weight: 600;
}

.aepg-radio-group {
    display: grid;
    gap: 8px;
    margin-top: 4px;
}

.aepg-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.85);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    font-size: 13px;
    color: #e5e7eb;
}

.aepg-radio input[type="radio"] {
    accent-color: #22c55e;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.aepg-radio:hover {
    border-color: #22d3ee;
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.2);
    transform: translateY(-1px);
}

.aepg-btn {
    border: none;
    outline: none;
    border-radius: 999px;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    background-image: linear-gradient(135deg, #22c55e, #eab308, #22d3ee);
    color: #020617;
    box-shadow:
        0 12px 30px rgba(34, 197, 94, 0.35),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
    width: 100%;
}

.aepg-btn:hover {
    transform: translateY(-1px) scale(1.01);
    filter: brightness(1.02);
}

.aepg-btn-pdf {
    margin-top: 10px;
    background-image: linear-gradient(135deg, #22d3ee, #6366f1);
    color: #f9fafb;
}

.aepg-result {
    margin-top: 18px;
    padding: 16px 14px 14px;
    border-radius: 18px;
    border: 1px solid rgba(52, 211, 153, 0.5);
    background:
        linear-gradient(to bottom right, rgba(22, 163, 74, 0.16), rgba(15, 23, 42, 0.98));
    color: #ecfdf5;
}

/* عنوان النتيجة التقديرية */
.aepg-result-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 10px;
    color: #facc15; /* لون دهبي مميز */
    text-align: right; /* غيّر لـ center لو حابب */
}

.aepg-result-summary {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
}

.aepg-result-details {
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
    font-size: 13px;
}

.aepg-result-details li {
    margin-bottom: 3px;
}


/* === Info icon + Modal === */
.aepg-info-btn{
  margin-right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.45);
  background: rgba(2,6,23,.35);
  color: #e5e7eb;
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.aepg-info-btn:hover{
  transform: translateY(-1px);
  background: rgba(34,211,238,.12);
  border-color: rgba(34,211,238,.55);
}

/* ✅ اقفل سكرول الصفحة لما المودال مفتوح */
body.aepg-modal-open{
  overflow: hidden !important;
}

/* ✅ مودال ثابت */
.aepg-modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 99999;
}
.aepg-modal.is-open{ display:block; }

.aepg-modal__backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}

/* ✅ panel يبقى fixed عشان يتحرك جنب الزر */
.aepg-modal__panel{
  position: fixed;                /* ✅ بدل relative */
  margin: 0;                      /* ✅ بدل auto */
  width: min(760px, calc(100% - 24px));
  max-height: calc(100dvh - 24px); /* ✅ بدل 100% */
  background: rgba(15,23,42,.97);
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  overflow: hidden;
}

/* fallback لو dvh مش مدعوم */
@supports not (height: 100dvh){
  .aepg-modal__panel{ max-height: calc(100vh - 24px); }
}

.aepg-modal__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(148,163,184,.18);
}

.aepg-modal__title{
  margin:0;
  font-size: 16px;
  font-weight: 900;
  color:#f9fafb;
}

.aepg-modal__close{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.35);
  color:#fff;
  cursor:pointer;
}

.aepg-modal__body{
  padding: 14px;
  overflow:auto;
  max-height: calc(100dvh - 130px); /* ✅ بدل 100vh */
  overscroll-behavior: contain;
}

@supports not (height: 100dvh){
  .aepg-modal__body{ max-height: calc(100vh - 130px); }
}

.aepg-info__section{
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.25);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
}

.aepg-info__h{
  font-weight: 900;
  color:#e5e7eb;
  margin-bottom: 6px;
}

.aepg-info__list{
  margin:0;
  padding: 0 18px 0 0;
  color:#cbd5e1;
  line-height: 1.8;
}

.aepg-modal .aepg-price-preview{ display:none !important; }


.aepg-info__list li{ margin-bottom: 4px; }

/* Popup content scroll */
.aepg-modal-content{
    max-height:70vh;
    overflow:auto;
}