/* ==========================================================================
   Pinterest Video Downloader - Modern, Clean & Professional Stylesheet
   ========================================================================== */

:root {
  --pinterest-red: #E60023;
  --pinterest-red-hover: #b8001b;
  --pinterest-red-light: #fff0f2;
  --pinterest-dark: #111111;
  --pinterest-gray-bg: #F7F7F7;
  --pinterest-border: #E2E2E2;
  --text-primary: #111111;
  --text-secondary: #5F5F5F;
  --text-muted: #8E8E8E;
  --white: #FFFFFF;
  --success-color: #00875A;
  --error-color: #DE350B;
  --error-bg: #FFEBE6;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--white);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header (Displays only official Pinterest logo)
   ========================================================================== */

.site-header {
  width: 100%;
  height: 64px;
  background-color: var(--white);
  border-bottom: 1px solid var(--pinterest-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 50;
}

.header-logo-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.header-logo-container:hover {
  transform: scale(1.05);
}

.header-logo {
  width: 38px;
  height: 38px;
  display: block;
}

/* ==========================================================================
   Hero Section (#E60023 Pinterest Red)
   ========================================================================== */

.hero-section {
  background-color: var(--pinterest-red);
  color: var(--white);
  padding: 56px 20px 64px;
  text-align: center;
  position: relative;
}

.hero-content {
  max-width: 760px;
  margin: 0 auto;
}

.main-heading {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 14px;
}

.hero-subtitle {
  font-size: 1.125rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 36px;
  letter-spacing: -0.01em;
}

/* Input Form */
.downloader-form {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}

.input-group-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--white);
  border-radius: var(--radius-full);
  padding: 6px 8px 6px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.input-group-wrapper:focus-within {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.26);
  transform: translateY(-1px);
}

.input-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.url-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--text-primary);
  background: transparent;
  min-width: 0;
}

.url-input::placeholder {
  color: #8E8E8E;
  font-weight: 400;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.btn-action-icon {
  background: #f0f0f0;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-action-icon:hover {
  background: #e2e2e2;
  color: var(--text-primary);
}

.btn-clear {
  display: none;
  padding: 8px;
  background: transparent;
}

.btn-clear:hover {
  background: #f0f0f0;
}

.btn-download-hero {
  background-color: var(--pinterest-dark);
  color: var(--white);
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 26px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-download-hero:hover {
  background-color: #2b2b2b;
  transform: translateY(-1px);
}

.btn-download-hero:active {
  transform: translateY(0);
}

.hero-hints {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
}

.sample-links-wrapper {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-link-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
}

.sample-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sample-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   Content Section Below Hero (Pure White Background)
   ========================================================================== */

.content-section {
  background-color: var(--white);
  padding: 48px 20px 80px;
  min-height: 480px;
}

.content-container {
  max-width: 960px;
  margin: 0 auto;
}

/* Loading State */
.loading-box {
  display: none;
  text-align: center;
  padding: 48px 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--pinterest-border);
  border-top-color: var(--pinterest-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.loading-subtext {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Error State */
.error-box {
  display: none;
  background-color: var(--error-bg);
  border: 1px solid #FFBDAD;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
  align-items: flex-start;
  gap: 16px;
}

.error-box.visible {
  display: flex;
}

.error-icon {
  color: var(--error-color);
  flex-shrink: 0;
  margin-top: 2px;
}

.error-content h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--error-color);
  margin-bottom: 4px;
}

.error-content p {
  font-size: 0.92rem;
  color: #333333;
  line-height: 1.45;
}

/* Result Card */
.result-card {
  display: none;
  background-color: var(--white);
  border: 1px solid var(--pinterest-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 48px;
}

.result-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0;
}

.result-video-pane {
  background-color: #0c0c0c;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 400px;
}

.video-player {
  width: 100%;
  max-height: 520px;
  display: block;
  background-color: #000;
  outline: none;
}

.result-details-pane {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.video-header-info {
  margin-bottom: 24px;
}

.video-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 12px;
  word-break: break-word;
}

.video-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--pinterest-gray-bg);
  color: var(--text-secondary);
}

.badge-primary {
  background: var(--pinterest-red-light);
  color: var(--pinterest-red);
}

.video-author {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.author-icon {
  color: var(--text-muted);
}

/* Quality options */
.download-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.formats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.format-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--pinterest-border);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.format-item:hover {
  border-color: #c0c0c0;
  background-color: #fafafa;
}

.format-item.best-format {
  border-color: #ffd0d6;
  background-color: #fffbfc;
}

.format-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quality-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.resolution-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.filesize-tag {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--pinterest-gray-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.format-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-download-format {
  background-color: var(--pinterest-red);
  color: var(--white);
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-download-format:hover {
  background-color: var(--pinterest-red-hover);
  transform: translateY(-1px);
}

.btn-secondary-link {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--pinterest-border);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-secondary-link:hover {
  background: var(--pinterest-gray-bg);
  color: var(--text-primary);
}

/* Secondary Controls */
.video-secondary-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--pinterest-border);
  flex-wrap: wrap;
}

.copy-link-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.copy-link-btn:hover {
  background: var(--pinterest-gray-bg);
  color: var(--text-primary);
}

/* Instructions Section (Clean 3-Step Guide) */
.how-it-works-section {
  padding: 32px 0 0;
  border-top: 1px solid #ECECEC;
  margin-top: 40px;
}

.section-headline {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  color: var(--text-primary);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.step-card {
  background: var(--white);
  border: 1px solid var(--pinterest-border);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.step-card:hover {
  border-color: #d0d0d0;
  box-shadow: var(--shadow-sm);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--pinterest-red-light);
  color: var(--pinterest-red);
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--pinterest-dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--pinterest-border);
  background-color: var(--white);
  padding: 24px 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 840px) {
  .result-layout {
    grid-template-columns: 1fr;
  }

  .result-video-pane {
    min-height: 260px;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .main-heading {
    font-size: 2.1rem;
  }
}

@media (max-width: 600px) {
  .hero-section {
    padding: 36px 16px 44px;
  }

  .main-heading {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 24px;
  }

  .input-group-wrapper {
    flex-direction: column;
    padding: 12px;
    border-radius: var(--radius-md);
    gap: 10px;
  }

  .url-input {
    width: 100%;
    padding: 6px 0;
  }

  .input-actions {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }

  .btn-download-hero {
    width: 100%;
    padding: 12px 20px;
  }

  .result-details-pane {
    padding: 24px 18px;
  }

  .format-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .format-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
