/**
 * NX Instagram Feed Slider - Frontend Styles
 *
 * @package NX_Instagram_Feed_Slider
 * @version 1.0.0
 */

/* ─── Variables ─────────────────────────────────────────────────── */
:root {
  --nx-ig-grid-width: 1490px;
  --nx-ig-gap: 16px;
  --nx-ig-ratio: 1/1;
  --nx-ig-nav-size: 44px;
  --nx-ig-radius: 12px;
  --nx-ig-transition: 0.3s ease;
}

/* ─── Wrapper ────────────────────────────────────────────────────── */
.nx-ig-feed-wrapper {
  width: 100%;
  position: relative;
}

.nx-ig-slider-outer {
  width: 100%;
  overflow: hidden;
  position: relative;
  margin: 0px auto;
  max-width: 1800px;
}

/* Left-align container so overflow bleeds to the right
.nx-ig-container {
  width: 100%;
  max-width: var(--nx-ig-grid-width);
  margin-left: auto;
  margin-right: 0;
  padding-left: max(16px, calc((100vw - var(--nx-ig-grid-width)) / 2));
  position: relative;
  box-sizing: border-box;
} */

/* Container anchors the slider at grid-width; content overflows right */
.nx-ig-container {
  width: 100%;
  /* max-width: var(--nx-ig-grid-width);
  margin-left: auto;
  margin-right: 0; 
  padding-left: max(16px, calc((100vw - var(--nx-ig-grid-width)) / 2)); */
  position: relative;
  box-sizing: border-box;
  margin: 0px auto;
}

/* ─── Swiper overrides ───────────────────────────────────────────── */
.nx-ig-swiper {
  overflow: visible !important;
  width: 100%;
}

.nx-ig-swiper-wrapper {
  align-items: stretch;
}

/* ─── Slide ──────────────────────────────────────────────────────── */
.nx-ig-slide {
  height: auto;
}

.nx-ig-slide-item {
  position: relative;
  border-radius: var(--nx-ig-radius);
  overflow: hidden;
  background: #f0f0f0;
  display: block;
  width: 100%;
}

/* ─── Link wrapper ───────────────────────────────────────────────── */
.nx-ig-slide-link {
  display: block;
  text-decoration: none;
  color: inherit;
  outline-offset: 3px;
}

.nx-ig-slide-link:focus-visible {
  outline: 2px solid #e1306c;
  border-radius: var(--nx-ig-radius);
}

/* ─── Media container ────────────────────────────────────────────── */
.nx-ig-slide-media {
  position: relative;
  width: 100%;
  aspect-ratio: var(--nx-ig-ratio, 1/1);
  overflow: hidden;
}

/* ─── Image ──────────────────────────────────────────────────────── */
.nx-ig-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--nx-ig-radius);
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.nx-ig-slide-item:hover .nx-ig-slide-img,
.nx-ig-slide-link:hover .nx-ig-slide-img {
  transform: scale(1.07);
}

/* ─── Hover overlay ──────────────────────────────────────────────── */
.nx-ig-slide-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.nx-ig-slide-link:hover .nx-ig-slide-overlay,
.nx-ig-slide-item:hover .nx-ig-slide-overlay {
  opacity: 1;
}

/* ─── Overlay inner: icon + label stacked ────────────────────────── */
.nx-ig-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translateY(6px);
  transition: transform 0.28s ease;
}

.nx-ig-slide-link:hover .nx-ig-overlay-inner,
.nx-ig-slide-item:hover .nx-ig-overlay-inner {
  transform: translateY(0);
}

/* Instagram icon square */
.nx-ig-overlay-icon {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
  transition: transform 0.22s ease;
}

.nx-ig-overlay-icon svg {
  width: 32px;
  height: 32px;
  display: block;
  margin: 0px auto;
}

.nx-ig-slide-link:hover .nx-ig-overlay-icon,
.nx-ig-slide-item:hover .nx-ig-overlay-icon {
  transform: scale(1.1);
}

/* "View post" label */
.nx-ig-overlay-label {
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  line-height: 26px;
  text-decoration: underline;
}

/* ─── Media-type corner badges ───────────────────────────────────── */
.nx-ig-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2;
}

/* ─── Navigation buttons ─────────────────────────────────────────── */
.nx-ig-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--nx-ig-nav-size);
  height: var(--nx-ig-nav-size);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1a2e;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.15),
    0 1px 4px rgba(0, 0, 0, 0.08);
  transition:
    background var(--nx-ig-transition),
    color var(--nx-ig-transition),
    transform 0.2s ease,
    box-shadow var(--nx-ig-transition);
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nx-ig-nav-btn:hover {
  background: #e1306c;
  color: #fff;
  box-shadow: 0 6px 24px rgba(225, 48, 108, 0.4);
  transform: translateY(-50%) scale(1.08);
}

.nx-ig-nav-btn:active {
  transform: translateY(-50%) scale(0.96);
}

.nx-ig-nav-prev {
  left: 8px;
}
.nx-ig-nav-next {
  right: 8px;
}

.nx-ig-nav-btn.swiper-button-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ─── Pagination dots ────────────────────────────────────────────── */
.nx-ig-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-bottom: 4px;
}

.nx-ig-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  opacity: 1;
  cursor: pointer;
  transition:
    background var(--nx-ig-transition),
    transform var(--nx-ig-transition);
}

.nx-ig-pagination .swiper-pagination-bullet-active {
  background: #e1306c;
  transform: scale(1.25);
}

/* ─── Error / empty states ───────────────────────────────────────── */
.nx-ig-not-connected,
.nx-ig-error,
.nx-ig-empty {
  padding: 24px;
  border-radius: 10px;
  background: #fff8f8;
  border: 1px solid #ffe0e6;
  font-size: 14px;
  color: #c0392b;
  text-align: center;
}

.nx-ig-not-connected a {
  color: #e1306c;
  font-weight: 600;
  text-decoration: none;
}

.nx-ig-not-connected a:hover {
  text-decoration: underline;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media only screen and (max-width: 1553px) {
  .nx-ig-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (max-width: 767px) {
  .nx-ig-container {
    padding-left: 6vw;
    padding-right: 6vw;
  }
  .nx-ig-nav-btn {
    --nx-ig-nav-size: 36px;
  }
  .nx-ig-overlay-icon {
    width: 38px;
    height: 38px;
  }
  .nx-ig-overlay-label {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .nx-ig-nav-prev {
    left: 4px;
  }
  .nx-ig-nav-next {
    right: 4px;
  }
}

/* ─── Fade-in on Swiper init ─────────────────────────────────────── */
.nx-ig-swiper:not(.swiper-initialized) .nx-ig-slide {
  opacity: 0;
}

.nx-ig-swiper.swiper-initialized .nx-ig-slide {
  opacity: 1;
  transition: opacity 0.4s ease;
}

/* ─── "View More" Placeholder Slide ─────────────────────────────── */
.nx-ig-placeholder-item {
  background: transparent;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.nx-ig-slide-placeholder .nx-ig-slide-media {
  display: flex;
}

.nx-ig-placeholder-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: #fff;
  padding: 20px 12px;
  box-sizing: border-box;
}

.nx-ig-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

/* Instagram icon */
.nx-ig-placeholder-icon {
  width: 32px;
  height: 32px;
  transition: transform 0.3s ease;
}

.nx-ig-placeholder-icon svg {
  width: 32px;
  height: 32px;
  display: block;
}

.nx-ig-placeholder-link:hover .nx-ig-placeholder-icon {
  transform: scale(1.12) rotate(3deg);
}

/* "View more posts" text */
.nx-ig-placeholder-text {
  font-size: 14px;
  font-weight: 400;
  color: #191919;
  margin: 0;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-decoration: underline;
}

.nx-ig-placeholder-link:hover .nx-ig-placeholder-text {
  text-decoration: none;
}

/* Pill button */
.nx-ig-placeholder-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  color: #fff;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: none;
  white-space: nowrap;
}

/* Dim the placeholder slightly during slider init to match other slides */
.nx-ig-swiper:not(.swiper-initialized) .nx-ig-slide-placeholder {
  opacity: 0;
}
.nx-ig-swiper.swiper-initialized .nx-ig-slide-placeholder {
  opacity: 1;
  transition: opacity 0.4s ease 0.1s;
}

/* Responsive scale-down for icon on tiny 1-column mobile */
@media (max-width: 480px) {
  .nx-ig-placeholder-icon,
  .nx-ig-placeholder-icon svg {
    width: 32px;
    height: 32px;
  }
}

/* ─── Horizontal progress indicator ─────────────────────────────── */
.nx-ig-progress-track {
  position: relative;
  width: 100%;
  height: 2px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  margin-top: 20px;
  overflow: hidden;
  cursor: pointer; /* signals interactivity */
  user-select: none; /* no text-highlight during drag */
  -webkit-user-select: none;
  /* Extend the hit-target vertically without affecting layout */
  padding-top: 0px;
  padding-bottom: 0px;
  margin-top: 10px; /* compensate for the extra padding */
  box-sizing: content-box;
}

.nx-ig-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0; /* set by JS */
  background: #191919;
  border-radius: 2px;
  transform: translateX(0); /* set by JS */
  transition:
    transform 0.22s ease,
    width 0.22s ease;
  will-change: transform;
}

/* Slightly ligher on dark backgrounds */
@media (prefers-color-scheme: dark) {
  .nx-ig-progress-track {
    background: rgba(255, 255, 255, 0.15);
  }
  .nx-ig-progress-fill {
    background: #e0e0e0;
  }
}
