/* instagram.css - Instagram Reels and Posts Gallery */

.instagram-selector-section {
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  padding: 24px 0 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(11,31,58,0.06);
}
.ig-selector-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: block;
}
.ig-account-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}
.ig-account-tabs li { flex: 0 0 auto; }
.ig-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 11px;
  border: 1.5px solid var(--border-color);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.ig-account-btn:hover {
  background: var(--light-blue);
  color: var(--primary);
  border-color: rgba(218,99,16,0.25);
}
.ig-account-btn.active {
  background: var(--white);
  color: var(--primary);
  border-color: rgba(218,99,16,0.4);
  border-bottom: 2px solid var(--white);
  font-weight: 700;
  margin-bottom: -1px;
  position: relative;
}
.ig-icon { width: 18px; height: 18px; flex-shrink: 0; }
.ig-mobile-selector-wrap { display: none; }
.ig-mobile-select {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--white);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235C6B82' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.ig-mobile-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(218,99,16,0.12);
}
.ig-content-panel { display: none; }
.ig-content-panel.active { display: block; }
.ig-account-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  padding: 22px 28px;
  background: linear-gradient(135deg, rgba(218,99,16,0.06) 0%, rgba(49,171,250,0.04) 100%);
  border-radius: 16px;
  border: 1px solid rgba(218,99,16,0.14);
}
.ig-account-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg,#f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(220,39,67,0.3);
}
.ig-account-avatar svg { width: 30px; height: 30px; fill: white; }
.ig-account-info h2 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.ig-account-info p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
}
.ig-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.18s;
}
.ig-profile-link:hover { color: var(--primary-hover); text-decoration: underline; }

.ig-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ig-section-title .count {
  background: var(--light-blue);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 50px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   REELS THUMBNAIL GRID
   ───────────────────────────────────────────────────────────────────────────── */
.ig-reels-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-bottom: 40px;
}

.ig-reel-card,
a.ig-reel-card,
a.ig-reel-card:link,
a.ig-reel-card:visited,
a.ig-reel-card:hover,
a.ig-reel-card:focus,
a.ig-reel-card:active {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  background: #0b1726;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(11, 31, 58, 0.08);
  border: 1px solid rgba(218, 99, 16, 0.2);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.35s ease;
  user-select: none;
  outline: none;
  text-decoration: none !important;
  color: #ffffff !important;
}
.ig-reel-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
.ig-reel-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 36px rgba(218, 99, 16, 0.28), 0 6px 14px rgba(0, 0, 0, 0.2);
  border-color: rgba(218, 99, 16, 0.65);
}

.ig-reel-card__media {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.ig-reel-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.ig-reel-card:hover .ig-reel-card__img {
  transform: scale(1.06);
}

.ig-reel-card__fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0e1e33 0%, #1a365d 100%);
}
.ig-reel-card__fallback-logo {
  width: 72px;
  height: auto;
  opacity: 0.85;
}

.ig-reel-card__gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.1) 0%,
    transparent 35%,
    rgba(0, 0, 0, 0.55) 62%,
    rgba(0, 0, 0, 0.94) 88%,
    #000000 100%
  );
  transition: background 0.3s ease;
}
.ig-reel-card:hover .ig-reel-card__gradient {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.15) 0%,
    transparent 30%,
    rgba(0, 0, 0, 0.68) 58%,
    rgba(0, 0, 0, 0.98) 88%,
    #000000 100%
  );
}

/* Hide play button, Reel badge/sticker, and CTA */
.ig-reel-card__badge,
.ig-reel-card__play,
.ig-reel-card__cta {
  display: none !important;
}

.ig-reel-card__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 14px 16px;
  z-index: 2;
  color: #ffffff !important;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ig-reel-card__info * {
  color: #ffffff !important;
  text-decoration: none !important;
}
.ig-reel-card__title,
.ig-reel-card h3 {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #ffffff !important;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 1px 2px rgba(0, 0, 0, 0.95);
}
.ig-reel-card__desc,
.ig-reel-card p {
  font-size: 11.5px;
  color: #f1f5f9 !important;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

/* ─────────────────────────────────────────────────────────────────────────────
   REEL PLAYER MODAL (LIGHTBOX / INSTAGRAM PLAYER)
   ───────────────────────────────────────────────────────────────────────────── */
.ig-reel-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.ig-reel-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ig-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 20, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

.ig-modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100000;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.ig-modal-nav:hover {
  background: linear-gradient(135deg, #da6310, #ff7a18);
  border-color: #ffffff;
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 12px 30px rgba(218, 99, 16, 0.5);
}
.ig-modal-nav--prev { left: 24px; }
.ig-modal-nav--next { right: 24px; }

.ig-modal-card {
  position: relative;
  z-index: 100001;
  width: 100%;
  max-width: 440px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #0d1522;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(218, 99, 16, 0.2);
  transform: scale(0.94);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.ig-reel-modal.is-open .ig-modal-card {
  transform: scale(1);
}

.ig-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(13, 21, 34, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.ig-modal-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ig-modal-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,#f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(220, 39, 67, 0.3);
}
.ig-modal-avatar svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}
.ig-modal-account-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ig-modal-account-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ig-modal-counter {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.ig-modal-external-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-decoration: none;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.ig-modal-external-btn:hover {
  background: rgba(218, 99, 16, 0.25);
  border-color: rgba(218, 99, 16, 0.6);
  color: #ff9843;
}
.ig-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, border-color 0.18s;
  flex-shrink: 0;
}
.ig-modal-close:hover {
  background: #da6310;
  border-color: #da6310;
  transform: rotate(90deg);
}

.ig-modal-body {
  position: relative;
  width: 100%;
  height: 600px;
  max-height: calc(84vh - 120px);
  background: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ig-modal-poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(12px) brightness(0.65);
  transform: scale(1.1);
  z-index: 1;
}
.ig-modal-spinner {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
.ig-spinner-circle {
  width: 42px;
  height: 42px;
  border: 3.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #da6310;
  border-radius: 50%;
  animation: igSpin 0.8s linear infinite;
}
@keyframes igSpin {
  to { transform: rotate(360deg); }
}

.ig-modal-iframe {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: transparent;
}

.ig-modal-footer {
  padding: 12px 16px;
  background: rgba(13, 21, 34, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ig-modal-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: #ffffff;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ig-modal-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ig-modal-mobile-nav {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.ig-modal-mobile-nav button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.18s;
}
.ig-modal-mobile-nav button:hover {
  background: rgba(218, 99, 16, 0.3);
  border-color: #da6310;
}

/* Empty State */
.ig-empty-state { text-align: center; padding: 60px 24px; }
.ig-empty-state__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, rgba(218,99,16,0.08) 0%, rgba(49,171,250,0.06) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ig-empty-state__icon svg { width: 32px; height: 32px; fill: var(--text-secondary); opacity: 0.45; }
.ig-empty-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.ig-empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 440px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1199px) {
  .ig-reels-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

@media (max-width: 991px) {
  .ig-account-tabs { display: none; }
  .ig-mobile-selector-wrap { display: block; margin-bottom: 16px; }
  .instagram-selector-section { position: relative; padding: 20px 0; }
  .ig-modal-nav--prev { left: 10px; }
  .ig-modal-nav--next { right: 10px; }
}

@media (max-width: 767px) {
  .ig-reels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .ig-reel-card {
    border-radius: 12px;
  }
  .ig-reel-card__info {
    padding: 10px;
  }
  .ig-reel-card__title,
  .ig-reel-card h3 {
    font-size: 12px;
    -webkit-line-clamp: 2;
    color: #ffffff !important;
  }
  .ig-reel-card__desc,
  .ig-reel-card p {
    font-size: 10.5px;
    color: #f1f5f9 !important;
  }
  .ig-modal-nav { display: none !important; }
  .ig-modal-card {
    max-width: 100%;
    max-height: 96vh;
    border-radius: 16px;
  }
  .ig-modal-body {
    height: 520px;
    max-height: calc(88vh - 120px);
  }
}

@media (max-width: 576px) {
  .ig-account-header { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px; }
  .ig-account-info h2 { font-size: 19px; }
  .ig-modal-external-btn span { display: none; }
}
