/* ═══════════════════════════════════════════════════════════════
   MODAL CSS - Tam Düzəlişlər (Scroll, Responsive, Z-Index)
   ═══════════════════════════════════════════════════════════════ */

/* ── Z-INDEX FIX ─────────────────────────────────────────────────── */
.modal-overlay {
  z-index: 9999 !important;
}

/* Navbar-ı modal-dan aşağı sal */
nav,
.navbar,
header,
.header,
.site-header,
.main-nav,
.top-bar {
  z-index: 1000 !important;
  position: relative;
}

/* ── MODAL OVERLAY ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 31, 58, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0.32s ease;
  overflow: hidden;
  /* Overlay scroll etməsin! */
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── MODAL CONTAINER ─────────────────────────────────────────────── */
.modal-container {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  /* Ekranın 85%-dən çox olmasın */
  margin: auto;
  background: var(--bg-card, #ffffff);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(11, 31, 58, 0.28), 0 0 0 1px rgba(200, 146, 42, 0.12);
  transform: translateY(28px) scale(0.97);
  transition: transform 0.38s cubic-bezier(0.34, 1.26, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

/* ── SCROLLBAR STYLING ──────────────────────────────────────────── */
.modal-container::-webkit-scrollbar {
  width: 6px;
}

.modal-container::-webkit-scrollbar-track {
  background: transparent;
}

.modal-container::-webkit-scrollbar-thumb {
  background: var(--border, #e2e8f0);
  border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb:hover {
  background: var(--gold, #c8922a);
}

/* ── CLOSE BUTTON ────────────────────────────────────────────────── */
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.22s ease, transform 0.22s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.08);
}

/* ── MODAL HERO ──────────────────────────────────────────────────── */
.modal-hero {
  position: relative;
  height: 220px;
  min-height: 220px;
  overflow: hidden;
  flex-shrink: 0;
  /* Hero sıxılmasın! */
}

.modal-hero-img {
  position: absolute;
  inset: 0;
}

.modal-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.55) saturate(1.1);
  transition: transform 6s ease;
}

.modal-overlay.active .modal-hero-img img {
  transform: scale(1.04);
}

.modal-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(11, 31, 58, 0.3) 0%, rgba(11, 31, 58, 0.75) 100%);
  padding: 2rem 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.modal-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold, #c8922a);
  margin-bottom: 0.5rem;
}

.modal-eyebrow-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold, #c8922a);
  flex-shrink: 0;
}

.modal-title {
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  margin: 0 0 0.4rem;
  letter-spacing: 0.01em;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 400;
  margin: 0;
  line-height: 1.5;
}

/* ── MODAL BODY ──────────────────────────────────────────────────── */
.modal-body {
  padding: 1.75rem 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  /* Body scroll etsin! */
  flex: 1;
  /* Qalan yer tutsun */
}

.modal-about p {
  font-size: 0.88rem;
  color: var(--text, #334155);
  line-height: 1.8;
  margin: 0;
}

/* ── META STRIP ──────────────────────────────────────────────────── */
.modal-meta-strip {
  display: flex;
  align-items: stretch;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.meta-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.9rem 0.5rem;
  text-align: center;
}

.meta-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
}

.meta-val {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--heading, #0f172a);
  line-height: 1.25;
}

.meta-val.accent {
  color: var(--gold, #c8922a);
  font-weight: 700;
}

.meta-sep {
  width: 1px;
  background: var(--border, #e2e8f0);
  align-self: stretch;
  flex-shrink: 0;
}

/* ── SECTION LABEL ───────────────────────────────────────────────── */
.modal-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold, #c8922a);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: -0.5rem;
  flex-shrink: 0;
}

/* ── STEPS (accordion) ───────────────────────────────────────────── */
.modal-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.modal-steps::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--navy, #1b4280) 0%, var(--gold, #c8922a) 70%, transparent 100%);
  opacity: 0.12;
  pointer-events: none;
}

.mstep {
  display: flex;
  align-items: flex-start;
  gap: 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.mstep-num {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: var(--bg-secondary, #f8fafc);
  border: 2px solid var(--border, #e2e8f0);
  color: var(--text-muted, #64748b);
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 14px;
  box-shadow: 0 0 0 4px var(--bg-card, #ffffff);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
  z-index: 2;
  position: relative;
}

.mstep.ms-open .mstep-num,
.mstep:hover .mstep-num {
  background: linear-gradient(135deg, var(--navy, #1b4280) 0%, #2a5298 100%);
  border-color: var(--navy, #1b4280);
  color: #fff;
}

.mstep-right {
  flex: 1;
  margin-left: 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  min-width: 0;
}

.mstep:last-child .mstep-right {
  border-bottom: none;
}

.mstep.ms-open .mstep-right {
  border-color: rgba(200, 146, 42, 0.18);
}

.mstep-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  user-select: none;
}

.mstep-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  background: rgba(27, 66, 128, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--navy, #1b4280);
  transition: background 0.3s, color 0.3s;
}

.mstep-icon svg {
  stroke: var(--navy, #1b4280);
  transition: stroke 0.3s;
}

.mstep.ms-open .mstep-icon,
.mstep:hover .mstep-icon {
  background: linear-gradient(135deg, var(--navy, #1b4280) 0%, #2a5298 100%);
}

.mstep.ms-open .mstep-icon svg,
.mstep:hover .mstep-icon svg {
  stroke: #fff;
}

.mstep-title {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--heading, #0f172a);
  line-height: 1.35;
  min-width: 0;
  transition: color 0.25s;
}

.mstep.ms-open .mstep-title {
  color: var(--navy, #1b4280);
}

.dark-mode .mstep.ms-open .mstep-title {
  color: var(--haqqimizda-title, #e8e4dc);
}

.mstep-chev {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted, #64748b);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s, border-color 0.3s;
}

.mstep-chev svg {
  width: 10px;
  height: 10px;
  stroke: var(--text-muted, #64748b);
  transition: stroke 0.3s;
  pointer-events: none;
}

.mstep.ms-open .mstep-chev {
  transform: rotate(180deg);
  background: var(--gold, #c8922a);
  border-color: var(--gold, #c8922a);
}

.mstep.ms-open .mstep-chev svg {
  stroke: #fff;
}

.mstep-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.32s ease, padding-bottom 0.36s ease;
  padding-bottom: 0;
}

.mstep.ms-open .mstep-panel {
  max-height: 200px;
  opacity: 1;
  padding-bottom: 16px;
}

.mstep-panel p {
  font-size: 0.825rem;
  color: var(--text-muted, #64748b);
  line-height: 1.75;
  margin: 0;
  padding-left: 44px;
  border-left: 3px solid var(--gold, #c8922a);
}

/* ── BODY MODAL OPEN ─────────────────────────────────────────────── */
body.modal-open {
  overflow: hidden !important;
  touch-action: none;
}

/* ── DARK MODE ───────────────────────────────────────────────────── */
.dark-mode .modal-container {
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(200, 146, 42, 0.14);
}

.dark-mode .mstep-num {
  background: var(--bg-secondary, #1e293b);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px var(--bg-card, #0f172a);
}

.dark-mode .mstep.ms-open .mstep-num,
.dark-mode .mstep:hover .mstep-num {
  background: linear-gradient(135deg, var(--navy, #1b4280) 0%, #2a5298 100%);
  border-color: var(--navy, #1b4280);
}

.dark-mode .mstep-icon {
  background: rgba(200, 146, 42, 0.09);
}

.dark-mode .mstep-icon svg {
  stroke: var(--gold, #c8922a);
}

.dark-mode .mstep.ms-open .mstep-icon,
.dark-mode .mstep:hover .mstep-icon {
  background: linear-gradient(135deg, var(--navy, #1b4280) 0%, #2a5298 100%);
}

.dark-mode .mstep.ms-open .mstep-icon svg,
.dark-mode .mstep:hover .mstep-icon svg {
  stroke: #fff;
}

.dark-mode .modal-meta-strip {
  background: rgba(255, 255, 255, 0.04);
}

.dark-mode .meta-val {
  color: var(--haqqimizda-title, #e8e4dc);
}

/* ── FEATURE CARD CURSOR ────────────────────────────────────────── */
.feature-card[data-modal] {
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE DÜZƏLİŞLƏR
   ════════════════════════════════════════════════════════════════ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  .modal-overlay {
    padding: 0.75rem;
  }

  .modal-container {
    max-width: 90vw;
    max-height: 88vh;
  }

  .modal-hero {
    height: 200px;
    min-height: 200px;
  }

  .modal-body {
    padding: 1.5rem;
  }
}

/* Mobil (480px - 767px) */
@media (max-width: 767px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    background: rgba(11, 31, 58, 0.85);
  }

  .modal-container {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    margin: 0;
  }

  .modal-overlay.active .modal-container {
    transform: translateY(0);
  }

  .modal-hero {
    height: 160px;
    min-height: 160px;
  }

  .modal-hero-overlay {
    padding: 1.25rem;
  }

  .modal-title {
    font-size: 1.15rem;
  }

  .modal-subtitle {
    font-size: 0.75rem;
  }

  .modal-body {
    padding: 1.25rem;
    gap: 1.25rem;
  }

  .modal-meta-strip {
    flex-wrap: wrap;
  }

  .meta-item {
    flex: 1 1 calc(50% - 1px);
    min-width: 0;
    padding: 0.75rem 0.4rem;
  }

  .meta-sep:nth-child(4),
  .meta-sep:nth-child(6) {
    display: none;
  }

  .mstep-num {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.65rem;
    margin-top: 10px;
  }

  .mstep-head {
    padding: 10px 0;
    gap: 8px;
  }

  .mstep-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .mstep-title {
    font-size: 0.82rem;
  }

  .mstep-panel p {
    padding-left: 36px;
    font-size: 0.78rem;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
  }
}

/* Kiçik Mobil (479px və aşağı) */
@media (max-width: 479px) {
  .modal-container {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }

  .modal-hero {
    height: 140px;
    min-height: 140px;
  }

  .modal-title {
    font-size: 1rem;
  }

  .modal-body {
    padding: 1rem;
    gap: 1rem;
  }

  .meta-item {
    flex: 1 1 100%;
    padding: 0.6rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
  }

  .meta-item:last-child {
    border-bottom: none;
  }

  .meta-sep {
    display: none !important;
  }

  .mstep-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.6rem;
  }

  .mstep-title {
    font-size: 0.78rem;
  }

  .modal-about p {
    font-size: 0.82rem;
  }

  .modal-section-label {
    font-size: 0.6rem;
  }
}


/* Landscape mode */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-overlay {
    align-items: flex-start;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .modal-container {
    max-height: 95vh;
  }

  .modal-hero {
    height: 120px;
    min-height: 120px;
  }

  .modal-hero-overlay {
    padding: 1rem;
  }
}



/* ── iOS SAFARI FIXES ───────────────────────────────────────────── */
@supports (-webkit-touch-callout: none) {
  .modal-overlay {
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }

  .modal-container {
    max-height: -webkit-fill-available;
  }
}