#ig-app {
  --ig-bg-deep: #1f130c;
  --ig-bg-card: #2c1810;
  --ig-bg-card-2: #3a2013;
  --ig-gold: #cba27f;
  --ig-gold-dark: #ab8462;
  --ig-cream: #FAF5E5;
  --ig-white: #ffffff;
  --ig-border: rgba(203, 162, 127, 0.35);
  max-width: 1100px;
  margin: 0 auto;
  font-family: 'Open Sans', sans-serif;
  color: var(--ig-cream);
}

/* ---------- Login screen ---------- */
.ig-login-screen {
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}
.ig-login-screen[hidden] { display: none; }
.ig-login-card {
  background: linear-gradient(180deg, var(--ig-bg-card) 0%, var(--ig-bg-deep) 100%);
  border: 1px solid var(--ig-border);
  border-radius: 18px;
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.ig-login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(203, 162, 127, 0.12);
  color: var(--ig-gold);
  margin-bottom: 20px;
}
.ig-login-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--ig-white);
  margin: 0 0 10px;
}
.ig-login-subtitle {
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(250, 245, 229, 0.75);
  margin: 0 0 28px;
}

.ig-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.ig-field { display: flex; flex-direction: column; gap: 6px; }
.ig-field label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ig-gold);
}
.ig-field input {
  padding: 13px 16px;
  border: 1px solid var(--ig-border);
  border-radius: 999px;
  font-size: 15px;
  background: rgba(255,255,255,0.04);
  color: var(--ig-white);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.ig-field input::placeholder { color: rgba(250,245,229,0.35); }
.ig-field input:focus {
  border-color: var(--ig-gold);
  background: rgba(255,255,255,0.07);
}

#ig-submit {
  margin-top: 6px;
  position: relative;
  padding: 14px 20px;
  border: none;
  border-radius: 999px;
  background: var(--ig-gold);
  color: #2c1810;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
#ig-submit:hover { background: #d9b491; transform: translateY(-1px); }
#ig-submit:disabled { opacity: 0.7; cursor: wait; transform: none; }
.ig-btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(44,24,16,0.35);
  border-top-color: #2c1810;
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: -2px;
  animation: ig-spin 0.7s linear infinite;
}
@keyframes ig-spin { to { transform: rotate(360deg); } }

.ig-error {
  color: #f3b0a3;
  background: rgba(180, 60, 40, 0.15);
  border: 1px solid rgba(220, 100, 80, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-all;
  text-align: left;
}

/* ---------- Gallery ---------- */
#ig-gallery-wrap {
  background: var(--ig-bg-card);
  border: 1px solid var(--ig-border);
  border-radius: 18px;
  padding: 32px;
}
.ig-gallery-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ig-border);
  padding-bottom: 20px;
}
.ig-eyebrow {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ig-gold);
  margin-bottom: 6px;
}
.ig-gallery-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ig-white);
  margin: 0;
}
.ig-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ig-btn-outline, .ig-btn-ghost {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.ig-btn-outline {
  background: transparent;
  border: 1.5px solid var(--ig-gold);
  color: var(--ig-gold);
}
.ig-btn-outline:hover { background: var(--ig-gold); color: #2c1810; }
.ig-btn-outline:disabled { opacity: 0.6; cursor: wait; }
.ig-btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  color: rgba(250,245,229,0.75);
}
.ig-btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--ig-white); }

.ig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.ig-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--ig-bg-card-2);
  border: 1px solid var(--ig-border);
  cursor: pointer;
}
.ig-cell img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.ig-cell:hover img { transform: scale(1.06); }
.ig-cell::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.55) 100%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.ig-cell:hover::after { opacity: 1; }
.ig-cell.is-video::before {
  content: "▶";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  z-index: 1;
  pointer-events: none;
}
.ig-dl-btn {
  position: absolute; bottom: 8px; right: 8px;
  width: 32px; height: 32px;
  background: rgba(44, 24, 16, 0.75);
  backdrop-filter: blur(2px);
  color: var(--ig-gold);
  text-decoration: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s, background 0.2s;
  z-index: 2;
}
.ig-cell:hover .ig-dl-btn { opacity: 1; transform: translateY(0); }
.ig-dl-btn:hover { background: var(--ig-gold); color: #2c1810; }

.ig-cell-check {
  position: absolute; top: 8px; left: 8px;
  width: 26px; height: 26px;
  z-index: 2;
}
.ig-cell-check input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; margin: 0;
}
.ig-cell-check .ig-check-box {
  position: absolute; inset: 0;
  border-radius: 7px;
  border: 2px solid rgba(255,255,255,0.75);
  background: rgba(44,24,16,0.35);
  backdrop-filter: blur(1px);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  font-size: 15px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}
.ig-cell:hover .ig-check-box,
.ig-cell-check input:checked + .ig-check-box {
  opacity: 1;
}
.ig-cell-check input:checked + .ig-check-box {
  background: var(--ig-gold);
  border-color: var(--ig-gold);
  color: #2c1810;
}
.ig-cell-check input:checked + .ig-check-box::after { content: "✓"; }
.ig-cell.is-selected { outline: 2px solid var(--ig-gold); outline-offset: -2px; }

/* ---------- Toolbar (filtre + sélection) ---------- */
.ig-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ig-filter-group {
  display: inline-flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ig-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.ig-filter-btn {
  border: none;
  background: transparent;
  color: rgba(250,245,229,0.7);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.ig-filter-btn:hover { color: var(--ig-white); }
.ig-filter-btn.is-active { background: var(--ig-gold); color: #2c1810; }

.ig-selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: rgba(250,245,229,0.7);
}
#ig-download-selection-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#ig-download-selection-btn:disabled:hover { background: transparent; color: var(--ig-gold); }

/* ---------- Lightbox ---------- */
.ig-lightbox {
  position: fixed; inset: 0;
  background: rgba(15, 8, 5, 0.94);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}
.ig-lightbox[hidden] { display: none; }
.ig-lightbox-content {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ig-lightbox-content img,
.ig-lightbox-content video {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.ig-lightbox-loading {
  color: var(--ig-gold);
  font-size: 14px;
}
.ig-lightbox-close {
  position: absolute; top: 20px; right: 24px;
  background: none; border: none;
  color: var(--ig-cream);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s;
}
.ig-lightbox-close:hover { opacity: 1; }
.ig-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--ig-border);
  color: var(--ig-cream);
  width: 48px; height: 48px;
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.ig-lightbox-nav:hover { background: rgba(255,255,255,0.18); }
.ig-lightbox-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.ig-lightbox-prev { left: 16px; }
.ig-lightbox-next { right: 16px; }
.ig-lightbox-download {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ig-gold);
  color: #2c1810;
  text-decoration: none;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}
.ig-lightbox-download:hover { background: #d9b491; }

/* ---------- Pagination ---------- */
.ig-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.ig-page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--ig-border);
  background: transparent;
  color: rgba(250,245,229,0.75);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.ig-page-btn:hover:not(:disabled) { border-color: var(--ig-gold); color: var(--ig-white); }
.ig-page-btn.is-active {
  background: var(--ig-gold);
  border-color: var(--ig-gold);
  color: #2c1810;
}
.ig-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ig-page-ellipsis { color: rgba(250,245,229,0.4); padding: 0 4px; font-size: 14px; }

@media (max-width: 560px) {
  .ig-login-card { padding: 36px 24px; }
  #ig-gallery-wrap { padding: 22px; }
  .ig-gallery-header { align-items: flex-start; }
  .ig-toolbar { flex-direction: column; align-items: stretch; }
  .ig-selection-bar { justify-content: space-between; }
  .ig-lightbox-nav { width: 40px; height: 40px; font-size: 20px; }
}