/* ═══════════════════════════════════════════════
   InstaGrab — style.css
   ═══════════════════════════════════════════════ */
:root {
  --bg:       #080808;
  --surface:  #111111;
  --surface2: #181818;
  --border:   #222222;
  --border2:  #2a2a2a;
  --accent:   #E1306C;
  --accent2:  #F77737;
  --accent3:  #FCAF45;
  --purple:   #833AB4;
  --text:     #f0f0f0;
  --text2:    #aaaaaa;
  --muted:    #555555;
  --gradient: linear-gradient(135deg, #E1306C 0%, #F77737 40%, #FCAF45 70%, #833AB4 100%);
  --radius:   16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Background ── */
.bg-mesh {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 700px 500px at 5%  15%,  rgba(225,48,108,.07)  0%, transparent 65%),
    radial-gradient(ellipse 600px 600px at 95% 85%,  rgba(131,58,180,.07)  0%, transparent 65%),
    radial-gradient(ellipse 500px 400px at 50% 50%,  rgba(247,119,55,.04)  0%, transparent 65%);
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 48px;
  position: relative;
  z-index: 1;
}

/* ── Header ── */
header {
  padding: 52px 0 0;
  text-align: center;
  animation: fadeDown .65s ease both;
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.logo-icon {
  width: 48px; height: 48px;
  background: var(--gradient);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(225,48,108,.3);
}

.logo-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.6rem;
  letter-spacing: 3px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.tagline {
  color: var(--text2);
  font-size: .9rem;
  font-weight: 300;
  margin-bottom: 18px;
}

.badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  animation: fadeUp .65s .08s ease both;
}

.badge {
  font-size: .7rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.badge-photo { color:#FCAF45; border-color:rgba(252,175,69,.35); background:rgba(252,175,69,.07); }
.badge-video { color:#E1306C; border-color:rgba(225,48,108,.35); background:rgba(225,48,108,.07); }
.badge-story { color:#833AB4; border-color:rgba(131,58,180,.35); background:rgba(131,58,180,.07); }
.badge-reel  { color:#F77737; border-color:rgba(247,119,55,.35);  background:rgba(247,119,55,.07); }

/* ── Notice ── */
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(252,175,69,.06);
  border: 1px solid rgba(252,175,69,.2);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: .8rem;
  color: rgba(252,175,69,.9);
  line-height: 1.6;
  margin-bottom: 20px;
  animation: fadeUp .65s .12s ease both;
}
.notice-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ── Main Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: fadeUp .65s .16s ease both;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--gradient);
  opacity: .7;
}

.input-label {
  display: block;
  font-size: .73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
}

.input-row { display: flex; gap: 10px; }

.url-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.url-input:focus {
  border-color: rgba(225,48,108,.55);
  box-shadow: 0 0 0 3px rgba(225,48,108,.09);
}
.url-input::placeholder { color: var(--muted); }

.btn-fetch {
  background: var(--gradient);
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  display: flex; align-items: center; gap: 7px;
  box-shadow: 0 4px 16px rgba(225,48,108,.3);
}
.btn-fetch:hover { opacity: .88; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(225,48,108,.4); }
.btn-fetch:active { transform: translateY(0); }
.btn-fetch:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.input-hints {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: center;
}
.hint-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.hint-tag {
  font-size: .7rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--text2);
  font-family: monospace;
}

/* ── Alert ── */
.alert {
  display: none;
  background: rgba(225,48,108,.1);
  border: 1px solid rgba(225,48,108,.3);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: .83rem;
  color: rgba(225,48,108,.95);
  margin-top: 14px;
  line-height: 1.5;
}
.alert.show { display: block; animation: fadeUp .3s ease both; }

/* ── Progress ── */
.progress-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 100px;
  margin-top: 14px;
  overflow: hidden;
  display: none;
}
.progress-wrap.show { display: block; }
.progress-bar {
  height: 100%;
  background: var(--gradient);
  border-radius: 100px;
  width: 0%;
  transition: width .35s ease;
}

/* ── Loader ── */
.loader {
  display: none;
  text-align: center;
  padding: 56px 0;
  animation: fadeUp .3s ease both;
}
.loader.show { display: block; }
.spinner-ring {
  width: 44px; height: 44px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-right-color: var(--accent2);
  border-radius: 50%;
  animation: spin .85s linear infinite;
  margin: 0 auto 18px;
}
.loader-text { color: var(--text2); font-size: .88rem; font-weight: 500; margin-bottom: 4px; }
.loader-sub  { color: var(--muted); font-size: .76rem; }

/* ── Result Area ── */
.result-area { animation: fadeUp .4s ease both; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 16px;
}

.result-header {
  padding: 18px 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.result-type-badge {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(225,48,108,.12);
  color: var(--accent);
  border: 1px solid rgba(225,48,108,.25);
}
.result-user {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
}
.result-user span { color: var(--muted); font-weight: 400; }

/* Preview */
.preview-wrap {
  margin: 14px 20px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface2);
  max-height: 360px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.preview-wrap img,
.preview-wrap video {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
}
.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
  font-size: 3rem;
  cursor: pointer;
  transition: background .2s;
}
.video-play-overlay:hover { background: rgba(0,0,0,.2); }

/* Info */
.result-info { padding: 0 20px 20px; }
.result-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.meta-item {
  font-size: .78rem;
  color: var(--muted);
  display: flex; align-items: center; gap: 4px;
}

.caption-text {
  font-size: .83rem;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 18px;
  max-height: 60px;
  overflow: hidden;
  position: relative;
}

/* Download buttons */
.dl-section-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.dl-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.dl-option-btn {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
  text-align: left;
  display: flex; flex-direction: column; gap: 3px;
}
.dl-option-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(225,48,108,.04); }
.dl-opt-label { font-weight: 600; display: flex; align-items: center; gap: 5px; }
.dl-opt-sub   { color: var(--muted); font-size: .72rem; }

.btn-download-main {
  width: 100%;
  background: var(--gradient);
  border: none;
  border-radius: 12px;
  padding: 15px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 20px rgba(225,48,108,.3);
  letter-spacing: .3px;
}
.btn-download-main:hover { opacity: .88; transform: translateY(-1px); }
.btn-download-main:active { transform: translateY(0); }

/* Multi grid */
.multi-toolbar {
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.multi-count { font-size: .82rem; color: var(--text2); }
.select-all-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 5px 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .78rem;
  cursor: pointer;
  transition: all .2s;
}
.select-all-btn:hover { border-color: var(--accent); color: var(--accent); }

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
}
@media (max-width: 500px) { .media-grid { grid-template-columns: repeat(2, 1fr); } }

.media-thumb {
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface2);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; display: block; }
.media-thumb:hover img { transform: scale(1.05); }
.media-thumb .thumb-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
  font-size: 1.6rem;
}
.media-thumb:hover .thumb-overlay { opacity: 1; }
.media-thumb.selected .thumb-overlay { opacity: 1; background: rgba(225,48,108,.5); }
.media-thumb .check-badge {
  display: none;
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  font-size: .7rem; color: #fff; font-weight: 700;
  align-items: center; justify-content: center; z-index: 2;
}
.media-thumb.selected .check-badge { display: flex; }
.video-thumb-tag {
  position: absolute; bottom: 6px; left: 6px;
  font-size: .6rem; font-weight: 700;
  background: rgba(0,0,0,.7);
  color: #fff; padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .5px;
}

.multi-dl-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ── How it works ── */
.how-section { margin-bottom: 24px; animation: fadeUp .65s .22s ease both; }
.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transition: border-color .2s;
}
.step:hover { border-color: var(--border2); }
.step-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.6rem;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1; margin-bottom: 6px; opacity: .45;
}
.step-icon { font-size: 1.4rem; margin-bottom: 6px; }
.step-title { font-size: .85rem; font-weight: 600; margin-bottom: 5px; }
.step-desc  { font-size: .76rem; color: var(--muted); line-height: 1.6; }

/* ── Features ── */
.features-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 40px;
  animation: fadeUp .65s .28s ease both;
}
@media (max-width: 580px) { .features-section { grid-template-columns: repeat(2, 1fr); } }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
  transition: border-color .2s;
}
.feature-card:hover { border-color: var(--border2); }
.feat-icon  { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.feat-title { font-size: .82rem; font-weight: 600; margin-bottom: 4px; }
.feat-desc  { font-size: .73rem; color: var(--muted); line-height: 1.5; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 24px 0 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.7;
  animation: fadeUp .65s .32s ease both;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 12px 22px;
  font-size: .85rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 9px;
  z-index: 999;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Animations ── */
@keyframes fadeDown {
  from { opacity:0; transform:translateY(-18px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes fadeUp {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive tweaks ── */
@media (max-width: 600px) {
  .input-row { flex-direction: column; }
  .btn-fetch  { width: 100%; justify-content: center; }
  .logo-text  { font-size: 2rem; }
  .card       { padding: 20px; }
}
