/* ============================================
   FitYDown Instagram Downloader — style.css
   Inspired by Instagram gradient palette
   ============================================ */

/* ---- DESIGN TOKENS ---- */
:root {
  --ig-grad-start: #833ab4;
  --ig-grad-mid:   #fd1d1d;
  --ig-grad-end:   #fcb045;
  --accent:        #c13584;
  --accent-hover:  #9c2a6a;
  --bg:            #f9f9f9;
  --surface:       #ffffff;
  --surface2:      #f0f0f0;
  --text-primary:  #1a1a2e;
  --text-secondary:#555566;
  --text-muted:    #888899;
  --border:        #e0e0ec;
  --shadow:        0 4px 20px rgba(131, 58, 180, 0.10);
  --shadow-hover:  0 8px 30px rgba(131, 58, 180, 0.20);
  --radius:        14px;
  --radius-sm:     8px;
  --navbar-height: 64px;
  --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

html.dark {
  --bg:            #0d0d14;
  --surface:       #16161f;
  --surface2:      #1f1f2e;
  --text-primary:  #f0f0fa;
  --text-secondary:#b0b0cc;
  --text-muted:    #666688;
  --border:        #2a2a3a;
  --shadow:        0 4px 20px rgba(0,0,0,0.5);
  --shadow-hover:  0 8px 30px rgba(131, 58, 180, 0.35);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ---- UTILITY ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none !important; }

/* ---- NAVBAR ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  transition: background 0.3s;
}
.navbar-wrapper { display: flex; align-items: center; justify-content: space-between; height: var(--navbar-height); }
.navbar-header { display: flex; align-items: center; gap: 12px; }
.navbar-brand { display: flex; align-items: center; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo img { border-radius: 8px; }
.brand-name { font-size: 1.2rem; font-weight: 700; background: linear-gradient(135deg, var(--ig-grad-start), var(--ig-grad-end)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.nav { display: flex; align-items: center; gap: 6px; list-style: none; }
.nav a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; padding: 6px 12px; border-radius: var(--radius-sm); transition: background 0.2s, color 0.2s; }
.nav a:hover { background: var(--surface2); color: var(--accent); text-decoration: none; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; box-shadow: var(--shadow); min-width: 180px; list-style: none; z-index: 200; }
.dropdown:hover .dropdown-menu,
.dropdown-menu.open { display: block; }
.dropdown-menu li a { display: block; padding: 8px 12px; color: var(--text-secondary); border-radius: 6px; font-size: 0.88rem; }
.dropdown-menu li a:hover { background: var(--surface2); color: var(--accent); text-decoration: none; }
.caret { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; margin-left: 4px; vertical-align: middle; }

/* Dark mode toggle */
.toggle-switch { cursor: pointer; display: inline-flex; }
.darkmode-input { display: none; }
html.light .toggle-dark,
html.dark .toggle-light  { display: inline-flex; }
html.light .toggle-light,
html.dark .toggle-dark   { display: none; }
.toggle { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 20px; background: var(--surface2); border: 1px solid var(--border); transition: background 0.2s; }
.toggle:hover { background: var(--border); }
.toggle-icon svg { display: block; }

/* Mobile nav */
.navbar-toggle { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; cursor: pointer; display: none; flex-direction: column; gap: 4px; }
.icon-bar { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 2px; }
.nav-overlay { display: none; }
.navbar-collapse { display: flex; align-items: center; gap: 20px; }

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .navbar-toggle { display: flex; }
  .nav-right-mobile { display: flex; align-items: center; gap: 8px; }
  .navbar-collapse {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--surface);
    z-index: 300;
    padding: 80px 24px 24px;
    overflow-y: auto;
    gap: 0;
  }
  .navbar-collapse.open { display: flex; }
  .navbar-collapse .nav { flex-direction: column; align-items: flex-start; width: 100%; }
  .navbar-collapse .nav li { width: 100%; }
  .navbar-collapse .nav a { display: block; padding: 12px 0; font-size: 1.1rem; }
  .show-mobile { display: block; margin-bottom: 24px; }
  .navbar-collapse .navbar-right { display: none; }
}
@media (min-width: 769px) {
  .nav-right-mobile { display: none; }
  .show-mobile { display: none; }
}

/* ---- JUMBOTRON / HERO ---- */
.jumbotron {
  padding: 60px 0 40px;
  background: linear-gradient(160deg, rgba(131,58,180,0.06), rgba(252,176,69,0.06));
}

.full-width { width: 100%; }
.centered-content { display: flex; flex-direction: column; align-items: center; text-align: center; }

.title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--ig-grad-start), var(--ig-grad-mid), var(--ig-grad-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 8px;
}
.subtitle { font-size: 1.05rem; color: var(--text-secondary); font-weight: 400; }

/* ---- FORM / INPUT GROUP ---- */
.input-group {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 50px;
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(193,53,132,0.12);
}

.input-text {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 14px 20px;
  font-size: 0.95rem;
  color: var(--text-primary);
  min-width: 0;
}
.input-text::placeholder { color: var(--text-muted); }

.paste-button, .clear-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.paste-button:hover, .clear-button:hover { background: var(--surface2); }
.paste-button .icon, .clear-button .icon { width: 16px; height: 16px; }

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  background: linear-gradient(135deg, var(--ig-grad-start), var(--ig-grad-mid));
  border: none;
  border-radius: 0 48px 48px 0;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.1s;
  min-height: 52px;
}
.btn-download:hover { opacity: 0.92; }
.btn-download:active { transform: scale(0.98); }
.btn-download:disabled { opacity: 0.6; cursor: not-allowed; }
.download-label { display: flex; align-items: center; gap: 6px; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner-icon { width: 22px; height: 22px; animation: spin 0.8s linear infinite; }
.spinner-arc { stroke: #fff; }

/* Copyright tip */
.copyrighted-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
  max-width: 580px;
  text-align: center;
}

/* Error / Result areas */
.error-show {
  margin-top: 16px;
  color: #e53e3e;
  background: rgba(229,62,62,0.08);
  border: 1px solid rgba(229,62,62,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  max-width: 680px;
  width: 100%;
  text-align: center;
}

.media-loaded {
  width: 100%;
  max-width: 680px;
  margin-top: 20px;
}

/* Format selection panel */
.format-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.format-panel h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.format-panel p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }
.format-buttons { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.format-buttons .btn-download {
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  min-height: 44px;
  font-size: 0.9rem;
}
.btn-mp3 { background: linear-gradient(135deg, #11998e, #38ef7d); }
.download-status { margin-top: 16px; font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); min-height: 22px; }

/* Download Another */
.btn-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 50px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.2s, color 0.2s;
}
.btn-help:hover { background: var(--accent); color: #fff; }

/* ---- SECTIONS ---- */
section { padding: 60px 0; border-top: 1px solid var(--border); }
#features { background: var(--surface2); }

.section-header { margin-bottom: 28px; }
.section-header h2, .about-title, .features-title {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.flex-row { display: flex; gap: 40px; flex-wrap: wrap; }
.section { flex: 1; min-width: 280px; }

/* How To Steps */
.how-to-steps { display: flex; flex-direction: column; gap: 20px; }
.how-to-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: box-shadow 0.2s;
}
.how-to-step:hover { box-shadow: var(--shadow-hover); }
.step-number {
  flex-shrink: 0;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--ig-grad-start), var(--ig-grad-mid));
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
}
.step-content h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.step-content p { font-size: 0.9rem; color: var(--text-secondary); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-question a { color: var(--text-primary); font-size: 0.95rem; display: block; padding: 4px 0; }
.faq-question a:hover { color: var(--accent); text-decoration: none; }
.faq-answer { font-size: 0.9rem; color: var(--text-secondary); padding-top: 10px; line-height: 1.7; }

/* Features grid */
.features-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.box-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.box-item:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.box-item .title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--accent); }
.box-item .description { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

/* Supported types grid */
.supported-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.supported-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: box-shadow 0.2s;
}
.supported-item:hover { box-shadow: var(--shadow-hover); }
.supported-icon { font-size: 2rem; margin-bottom: 10px; display: block; }
.supported-item strong { display: block; font-size: 0.95rem; margin-bottom: 6px; color: var(--text-primary); }
.supported-item p { font-size: 0.8rem; color: var(--text-secondary); }

/* About */
#about .about-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 760px;
}

/* ---- FOOTER ---- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.breadcrumb-list a { color: var(--text-muted); }
.breadcrumb-list a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-muted); }

.footer-links { display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 32px; }
.footer-column { min-width: 120px; }
.footer-column .heading p { font-weight: 700; font-size: 0.9rem; margin-bottom: 12px; color: var(--text-primary); }
.list-item { display: flex; flex-direction: column; gap: 8px; }
.footer-link { font-size: 0.85rem; color: var(--text-muted); transition: color 0.2s; }
.footer-link:hover { color: var(--accent); text-decoration: none; }

.footer-info { border-top: 1px solid var(--border); padding-top: 20px; }
.footer-info p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .jumbotron { padding: 40px 0 30px; }
  .input-group { border-radius: var(--radius); flex-wrap: wrap; }
  .btn-download { border-radius: var(--radius-sm); width: 100%; justify-content: center; padding: 14px; }
  .paste-button, .clear-button { border-left: none; border-top: 1px solid var(--border); }
  .flex-row { flex-direction: column; }
  .features-content { grid-template-columns: 1fr; }
  .supported-grid { grid-template-columns: repeat(2, 1fr); }
}
