/* ============================================================
   Twitter GIF Downloader - Advanced Stylesheet
   White theme default with dark mode support
   Fully responsive for mobile, tablet, and desktop
============================================================ */

/* ========== CSS Variables ========== */
:root {
  --header-h: 80px;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --border-color: rgba(100, 116, 139, 0.25);
}

.dark {
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --bg-primary: #0b1120;
  --bg-secondary: #1e293b;
  --border-color: rgba(71, 85, 105, 0.5);
}

/* ========== Base Styles ========== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== Spinner ========== */
.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== Inputs & Buttons ========== */
.input {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  font-size: 1rem;
  width: 100%;
  transition: all 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dark .input {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.input::placeholder {
  color: #64748b;
}

.dark .input::placeholder {
  color: #94a3b8;
}

.btn-primary {
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 700;
  background: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  padding: 0.6rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.05);
  border-color: var(--primary-color);
}

.dark .btn-ghost:hover {
  background: rgba(148, 163, 184, 0.1);
}

/* ========== Navigation Links ========== */
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  padding: 0.5rem 0;
}

.nav-link:hover {
  color: var(--primary-color);
}

.mobile-link {
  display: block;
  padding: 0.65rem 0.5rem;
  border-radius: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.mobile-link:hover {
  background: rgba(15, 23, 42, 0.05);
}

.dark .mobile-link:hover {
  background: rgba(148, 163, 184, 0.1);
}

.footer-link {
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--primary-color);
}

.dark .footer-link {
  color: #cbd5e1;
}

.dark .footer-link:hover {
  color: #fff;
}

/* ========== Alerts ========== */
.alert-error {
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.35);
  color: #991b1b;
  padding: 1rem;
  border-radius: 0.75rem;
}

.dark .alert-error {
  background: rgba(185, 28, 28, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

/* ========== Prose Styles ========== */
.prose {
  color: var(--text-secondary);
  max-width: 65ch;
}

.prose h1 {
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.prose h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
}

.prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 0.5rem;
}

.prose p,
.prose li {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.prose a {
  color: var(--primary-color);
  text-decoration: underline;
}

.prose a:hover {
  color: var(--primary-hover);
}

.prose strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ========== Feature Cards ========== */
.feature-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.1);
}

.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 800;
  margin: 0.25rem 0 0.5rem;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
  margin-bottom: 0;
}

.feature-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  margin-bottom: 0.5rem;
}

.dark .feature-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
  border-color: var(--border-color);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.dark .feature-card p {
  color: var(--text-secondary);
}

.dark .feature-chip {
  background: #1e293b;
  color: #93c5fd;
  border-color: #334155;
}

/* ========== Fancy Sections ========== */
.fancy-section {
  position: relative;
  padding: 4rem 0 5rem;
  background:
    radial-gradient(1000px 400px at 10% 0%, rgba(59, 130, 246, 0.08), transparent 60%),
    radial-gradient(900px 400px at 90% 20%, rgba(14, 165, 233, 0.06), transparent 60%),
    linear-gradient(180deg, rgba(241, 245, 249, 0.4), rgba(241, 245, 249, 0));
}

.dark .fancy-section {
  background:
    radial-gradient(1000px 400px at 10% 0%, rgba(59, 130, 246, 0.15), transparent 60%),
    radial-gradient(900px 400px at 90% 20%, rgba(14, 165, 233, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.4), rgba(2, 6, 23, 0));
}

.fancy-section.alt {
  background:
    radial-gradient(1000px 400px at 12% 8%, rgba(234, 179, 8, 0.07), transparent 60%),
    radial-gradient(900px 400px at 92% 24%, rgba(99, 102, 241, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
}

.dark .fancy-section.alt {
  background:
    radial-gradient(1000px 400px at 12% 8%, rgba(250, 204, 21, 0.12), transparent 60%),
    radial-gradient(900px 400px at 92% 24%, rgba(99, 102, 241, 0.15), transparent 60%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.5), rgba(15, 23, 42, 0));
}

.section-head {
  text-align: center;
  max-width: 56rem;
  margin: 0 auto;
}

.section-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.dark .section-badge {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #334155;
}

.section-title {
  margin-top: 0.75rem;
  font-size: clamp(1.6rem, 2.4vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-lead {
  margin-top: 0.75rem;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* ========== Format Tiles & Device Cards ========== */
.format-tile,
.device-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.format-tile:hover,
.device-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.1);
}

.dark .format-tile,
.dark .device-card {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--border-color);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.format-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.format-head h3 {
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 0.16rem rgba(34, 197, 94, 0.18);
}

.device-card h3 {
  font-weight: 800;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.device-card ol {
  list-style: decimal;
  padding-left: 1.25rem;
  color: var(--text-secondary);
}

.device-card ol li {
  margin-bottom: 0.5rem;
}

/* ========== Scroll Anchors ========== */
#results,
#video-preview,
#download-links,
#features,
#formats,
#devices,
#troubleshooting,
#legal,
#quick-faq,
#faq,
.scroll-anchor {
  scroll-margin-top: calc(var(--header-h) + 12px);
}

/* ========== Responsive Design ========== */
@media (max-width: 640px) {
  .prose h1 {
    font-size: 1.75rem;
    line-height: 2rem;
  }
  
  .prose h2 {
    font-size: 1.5rem;
  }
  
  .section-title {
    font-size: 1.75rem;
  }
  
  .feature-card,
  .format-tile,
  .device-card {
    padding: 1rem;
  }
}

/* ========== Print Styles ========== */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* ========== Accessibility ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ========== Admin Modal Styles ========== */
.admin-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.admin-modal-content {
  background-color: #1e293b;
  margin: 5% auto;
  padding: 2rem;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  width: 90%;
  max-width: 600px;
  color: #f1f5f9;
}

.admin-modal-close {
  color: #94a3b8;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.admin-modal-close:hover,
.admin-modal-close:focus {
  color: #fff;
}

/* ========== Blog Card Styles ========== */
.blog-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.blog-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

.feature-box {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.06);
}

.dark .feature-box {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--border-color);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}
