/* ============================================================
   Instagram Post Extractor — Design System
   v0.1.0 (Beta) — FastDL helper workflow
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Colors */
  --clr-bg: #06060a;
  --clr-surface: rgba(255, 255, 255, 0.04);
  --clr-surface-hover: rgba(255, 255, 255, 0.08);
  --clr-border: rgba(255, 255, 255, 0.08);
  --clr-border-focus: rgba(255, 255, 255, 0.18);
  --clr-text: #f0f0f5;
  --clr-text-muted: #8a8a9a;
  --clr-text-dim: #55556a;
  --clr-accent: #bc1888;
  --clr-success: #34d399;
  --clr-error: #f87171;
  --clr-info: #60a5fa;

  /* Gradients */
  --grad-ig: linear-gradient(135deg, #feda75 0%, #fa7e1e 18%, #d62976 40%, #962fbf 62%, #4f5bd5 100%);
  --grad-accent: linear-gradient(135deg, #d62976, #962fbf, #4f5bd5);
  --grad-glow: radial-gradient(circle, rgba(214, 41, 118, 0.15) 0%, transparent 70%);

  /* Typography */
  --ff-main: 'Outfit', system-ui, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.75rem;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 50%;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--clr-border);
  --shadow-glow: 0 0 40px rgba(188, 24, 136, 0.12);

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 150ms var(--ease-out);
  --t-normal: 250ms var(--ease-out);
  --t-slow: 400ms var(--ease-out);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ff-main);
  font-size: var(--fs-base);
  color: var(--clr-text);
  background-color: var(--clr-bg);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

textarea {
  font-family: inherit;
}

/* --- Animated Background --- */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-glow);
  opacity: 0.6;
}

.orb {
  position: absolute;
  border-radius: var(--r-full);
  filter: blur(100px);
  opacity: 0.35;
  will-change: transform;
}

.orb--pink {
  width: 450px;
  height: 450px;
  background: #d62976;
  top: -10%;
  left: -5%;
  animation: drift 22s ease-in-out infinite alternate;
}

.orb--blue {
  width: 550px;
  height: 550px;
  background: #4f5bd5;
  bottom: -15%;
  right: -8%;
  animation: drift 26s ease-in-out infinite alternate-reverse;
}

.orb--gold {
  width: 350px;
  height: 350px;
  background: #fa7e1e;
  top: 45%;
  left: 45%;
  animation: drift 18s ease-in-out infinite alternate;
  animation-delay: -6s;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(30px, -20px) scale(1.08);
  }

  100% {
    transform: translate(-20px, 40px) scale(0.95);
  }
}

/* --- Layout --- */
#app {
  width: 100%;
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6);
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Glass Mixin --- */
.glass {
  background: var(--clr-surface);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}

/* --- Header --- */
.header {
  text-align: center;
  margin-bottom: var(--sp-12);
  padding-top: var(--sp-8);
}

.header__logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.header__logo i {
  width: 44px;
  height: 44px;
  color: var(--clr-accent);
  filter: drop-shadow(0 0 8px rgba(188, 24, 136, 0.4));
}

.header__logo h1 {
  font-size: var(--fs-3xl);
  font-weight: 800;
  background: var(--grad-ig);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.header__subtitle {
  color: var(--clr-text-muted);
  font-size: var(--fs-lg);
  font-weight: 300;
  max-width: 520px;
  margin: 0 auto var(--sp-3);
}

.header__version {
  display: inline-block;
  font-size: var(--fs-xs);
  color: var(--clr-text-dim);
  background: var(--clr-surface);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--clr-border);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* --- Input Section --- */
.input-section {
  padding: var(--sp-3);
  margin-bottom: var(--sp-8);
  position: relative;
}

.input-group {
  display: flex;
  gap: var(--sp-2);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--r-lg);
  padding: var(--sp-2);
}

.input-group__field {
  flex: 1;
  background: transparent;
  border: none;
  padding: var(--sp-4) var(--sp-5);
  color: var(--clr-text);
  font-size: var(--fs-base);
  outline: none;
  min-width: 0;
}

.input-group__field::placeholder {
  color: var(--clr-text-dim);
  font-weight: 300;
}

.input-group__btn {
  background: var(--grad-ig);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-8);
  color: white;
  font-weight: 600;
  font-size: var(--fs-base);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: transform var(--t-fast), opacity var(--t-fast), box-shadow var(--t-normal);
  white-space: nowrap;
}

.input-group__btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 8px 24px rgba(214, 41, 118, 0.3);
}

.input-group__btn:active {
  transform: scale(0.98);
}

.input-group__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.input-group__btn i {
  width: 18px;
  height: 18px;
}

/* --- Inline Messages --- */
.inline-msg {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  animation: slideUp 0.3s var(--ease-out);
  transition: opacity 0.5s;
}

.inline-msg--info {
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.2);
  color: var(--clr-info);
}

.inline-msg--error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--clr-error);
}

.inline-msg--success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--clr-success);
}

/* --- FastDL Helper --- */
.fastdl-helper {
  padding: var(--sp-6);
  margin-bottom: var(--sp-8);
  animation: slideUp 0.4s var(--ease-out);
}

.fastdl-helper__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.fastdl-helper__header i {
  width: 22px;
  height: 22px;
  color: var(--clr-info);
}

.fastdl-helper__header h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--clr-text);
}

.fastdl-helper__desc {
  color: var(--clr-text-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

.fastdl-helper__steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--grad-accent);
  color: white;
  font-weight: 700;
  font-size: var(--fs-xs);
  flex-shrink: 0;
}

.btn-fastdl {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-md);
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.25);
  color: var(--clr-info);
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: all var(--t-fast);
  margin-bottom: var(--sp-5);
}

.btn-fastdl:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.4);
  transform: translateY(-1px);
}

.btn-fastdl i {
  width: 16px;
  height: 16px;
}

.fastdl-helper__input {
  display: flex;
  gap: var(--sp-2);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--r-lg);
  padding: var(--sp-2);
}

/* --- Result Section --- */
.result-section {
  animation: slideUp 0.5s var(--ease-out);
  flex: 1;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--sp-8);
}

/* --- Image Card --- */
.image-card {
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.image-wrapper {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  color: var(--clr-text-dim);
}

.placeholder i {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.placeholder span {
  font-size: var(--fs-sm);
  font-weight: 300;
}

/* --- Carousel Thumbnails --- */
.carousel-thumbs {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  scrollbar-width: thin;
  scrollbar-color: var(--clr-accent) transparent;
}

.carousel-thumbs::-webkit-scrollbar {
  height: 4px;
}

.carousel-thumbs::-webkit-scrollbar-thumb {
  background: var(--clr-accent);
  border-radius: 10px;
}

.carousel-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: all var(--t-fast);
  background: rgba(0, 0, 0, 0.3);
}

.carousel-thumb:hover {
  transform: scale(1.08);
  border-color: rgba(214, 41, 118, 0.4);
}

.carousel-thumb.active {
  border-color: var(--clr-accent);
  box-shadow: 0 0 12px rgba(214, 41, 118, 0.4);
}

.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  transition: opacity var(--t-fast);
}

.carousel-thumb.active img,
.carousel-thumb:hover img {
  opacity: 1;
}

/* --- Data Card --- */
.data-card {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--sp-1);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--r-md);
  padding: var(--sp-1);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--clr-text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  transition: all var(--t-normal);
  position: relative;
}

.tab-btn:hover {
  color: var(--clr-text);
}

.tab-btn.active {
  color: white;
  background: var(--clr-surface-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Tab Content */
.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.tab-content textarea {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  color: var(--clr-text);
  font-size: var(--fs-sm);
  line-height: 1.7;
  resize: none;
  outline: none;
  min-height: 220px;
  transition: border-color var(--t-fast);
}

.tab-content textarea:focus {
  border-color: var(--clr-border-focus);
}

/* Status Message */
.status-msg {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--clr-text-muted);
  font-size: var(--fs-sm);
}

.status-msg i {
  width: 16px;
  height: 16px;
}

.status-msg .error {
  color: var(--clr-error);
}

/* Buttons */
.btn-row {
  display: flex;
  gap: var(--sp-3);
}

.btn-row button {
  flex: 1;
}

.btn-copy,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: all var(--t-fast);
}

.btn-copy {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text);
}

.btn-copy:hover {
  background: var(--clr-surface-hover);
  border-color: var(--clr-border-focus);
}

.btn-copy i,
.btn-secondary i {
  width: 16px;
  height: 16px;
}

.btn-secondary {
  background: var(--grad-accent);
  border: none;
  color: white;
}

.btn-secondary:hover {
  box-shadow: 0 4px 16px rgba(150, 47, 191, 0.3);
  transform: translateY(-1px);
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Loader --- */
.loader {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--clr-accent);
  border-radius: var(--r-full);
  animation: spin 0.8s linear infinite;
}

.loader-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--clr-accent);
  border-radius: var(--r-full);
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: var(--sp-8) 0 var(--sp-6);
  margin-top: auto;
  color: var(--clr-text-dim);
  font-size: var(--fs-xs);
}

.footer p {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.footer a {
  color: var(--clr-text-muted);
  text-decoration: none;
  transition: color var(--t-fast);
}

.footer a:hover {
  color: var(--clr-text);
}

.footer img {
  display: inline-block;
  vertical-align: middle;
  height: 20px;
}

/* --- Utilities --- */
.hidden {
  display: none !important;
}

/* --- Animations --- */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .container {
    padding: var(--sp-4) var(--sp-3);
  }

  .header {
    margin-bottom: var(--sp-8);
    padding-top: var(--sp-4);
  }

  .header__logo h1 {
    font-size: var(--fs-2xl);
  }

  .header__logo i {
    width: 32px;
    height: 32px;
  }

  .header__subtitle {
    font-size: var(--fs-base);
  }

  .input-group {
    flex-direction: column;
  }

  .input-group__btn {
    justify-content: center;
    padding: var(--sp-4);
  }

  .result-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }

  .data-card {
    padding: var(--sp-4);
  }

  .fastdl-helper__input {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .header__logo h1 {
    font-size: var(--fs-xl);
  }

  .btn-row {
    flex-direction: column;
  }
}