/* =============================================
   PDF MASTER PRO - Core Styles
   ============================================= */

/* Root Variables */
:root {
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --accent-500: #d946ef;
  --radius-card: 1.5rem;
  --shadow-soft: 0 4px 24px rgba(99,102,241,0.08);
  --shadow-hover: 0 12px 40px rgba(99,102,241,0.18);
  --transition-smooth: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* Dark mode variables */
.dark {
  --shadow-soft: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-hover: 0 12px 40px rgba(0,0,0,0.6);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; line-height: 1.6; }
img, video { max-width: 100%; height: auto; display: block; }

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--primary-500); color: white;
  padding: 0.75rem 1.25rem; border-radius: 0 0 0.75rem 0.75rem;
  font-weight: 600; text-decoration: none; z-index: 99999;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ===== GLASS CARDS ===== */
.glass-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: var(--shadow-soft);
  transition: var(--transition-smooth);
}
.dark .glass-card {
  background: rgba(17,24,39,0.7);
  border-color: rgba(255,255,255,0.08);
}
.glass-card:hover {
  box-shadow: var(--shadow-hover);
}

/* ===== HERO GRADIENT ===== */
.hero-gradient {
  background: linear-gradient(135deg,
    rgba(238,242,255,0.9) 0%,
    rgba(253,244,255,0.9) 50%,
    rgba(238,242,255,0.9) 100%
  );
}
.dark .hero-gradient {
  background: linear-gradient(135deg,
    rgba(17,24,39,1) 0%,
    rgba(30,27,75,0.95) 50%,
    rgba(17,24,39,1) 100%
  );
}

/* ===== BLOBS ===== */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 8s ease-in-out infinite;
}
.blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.3), transparent);
  top: -100px; left: -150px;
  animation-delay: 0s;
}
.blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(217,70,239,0.25), transparent);
  top: 50%; right: -100px;
  animation-delay: -3s;
}
.blob-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(59,130,246,0.2), transparent);
  bottom: -50px; left: 40%;
  animation-delay: -6s;
}
.blob-small { filter: blur(40px); opacity: 0.5; }
.blob-nl-1 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(99,102,241,0.4), transparent); top: -80px; left: -80px; }
.blob-nl-2 { width: 250px; height: 250px; background: radial-gradient(circle, rgba(217,70,239,0.3), transparent); bottom: -60px; right: -60px; animation-delay: -4s; }

/* ===== GRID PATTERN ===== */
.grid-pattern {
  background-image: radial-gradient(rgba(99,102,241,0.15) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  color: white; font-weight: 600; text-decoration: none;
  cursor: pointer; border: none; position: relative; overflow: hidden;
  transition: var(--transition-smooth);
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--primary-600), #a21caf);
  opacity: 0; transition: opacity 0.3s;
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:focus-visible { outline: 3px solid var(--primary-500); outline-offset: 3px; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(99,102,241,0.08); color: var(--primary-600);
  font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1.5px solid rgba(99,102,241,0.2); transition: var(--transition-smooth);
}
.dark .btn-ghost { color: #a5b4fc; border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.1); }
.btn-ghost:hover { background: rgba(99,102,241,0.15); border-color: var(--primary-500); transform: translateY(-2px); }
.btn-ghost:focus-visible { outline: 3px solid var(--primary-500); outline-offset: 3px; }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--primary-600);
  font-weight: 600; text-decoration: none; cursor: pointer;
  border: 2px solid var(--primary-500); transition: var(--transition-smooth);
}
.dark .btn-outline { color: #a5b4fc; }
.btn-outline:hover { background: var(--primary-500); color: white; }
.btn-outline:focus-visible { outline: 3px solid var(--primary-500); outline-offset: 3px; }

/* Button Ripple Effect */
.ripple { position: relative; overflow: hidden; }
.ripple-wave {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transform: scale(0); animation: ripple-anim 0.6s linear;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ===== NAVIGATION ===== */
.nav-link { transition: var(--transition-smooth); }
.nav-link:focus-visible { outline: 3px solid var(--primary-500); outline-offset: 2px; border-radius: 8px; }

/* ===== TOOL CARDS ===== */
.tool-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  transition: var(--transition-smooth);
  cursor: pointer; position: relative; overflow: hidden;
}
.dark .tool-card {
  background: rgba(17,24,39,0.7);
  border-color: rgba(255,255,255,0.08);
}
.tool-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(217,70,239,0.05));
  transition: opacity 0.3s;
}
.tool-card:hover::before { opacity: 1; }
.tool-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 60px rgba(99,102,241,0.2);
  border-color: rgba(99,102,241,0.3);
}
.dark .tool-card:hover { border-color: rgba(99,102,241,0.4); }
.tool-card:focus-within { outline: 3px solid var(--primary-500); outline-offset: 2px; }

.tool-icon-wrapper {
  width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem; position: relative;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.tool-card:hover .tool-icon-wrapper { transform: scale(1.1) rotate(-3deg); }

/* ===== CATEGORY TABS ===== */
.tab-btn {
  padding: 0.5rem 1.25rem; border-radius: 2rem; font-size: 0.875rem;
  font-weight: 500; border: 1.5px solid transparent;
  cursor: pointer; transition: var(--transition-smooth);
  background: rgba(255,255,255,0.7); color: #4b5563;
  border-color: #e5e7eb;
}
.dark .tab-btn { background: rgba(31,41,55,0.7); color: #9ca3af; border-color: #374151; }
.tab-btn:hover { background: rgba(99,102,241,0.08); color: var(--primary-600); border-color: var(--primary-500); }
.dark .tab-btn:hover { color: #a5b4fc; }
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  color: white; border-color: transparent;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}
.tab-btn:focus-visible { outline: 3px solid var(--primary-500); outline-offset: 2px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; padding: 0.2rem 0.6rem;
  border-radius: 2rem; font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.badge-popular {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: white;
}
.badge-category {
  background: rgba(99,102,241,0.1); color: var(--primary-600);
}
.dark .badge-category { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.badge-new { background: linear-gradient(135deg, #10b981, #059669); color: white; }

/* ===== STAT CARDS ===== */
.stat-card { transition: var(--transition-smooth); }
.stat-card:hover { transform: translateY(-4px); }

/* ===== FEATURE CARDS ===== */
.feature-card { transition: var(--transition-smooth); }
.hover-lift:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }

/* ===== BLOG CARDS ===== */
.blog-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-card);
  overflow: hidden; transition: var(--transition-smooth);
}
.dark .blog-card {
  background: rgba(17,24,39,0.7);
  border-color: rgba(255,255,255,0.08);
}
.blog-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }

.blog-img-placeholder {
  width: 100%; height: 200px;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; position: relative; overflow: hidden;
}

/* ===== FAQ ===== */
.faq-item {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 1rem; overflow: hidden; transition: var(--transition-smooth);
}
.dark .faq-item {
  background: rgba(17,24,39,0.7);
  border-color: rgba(255,255,255,0.08);
}
.faq-question {
  width: 100%; text-align: left; padding: 1.25rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; cursor: pointer; background: none; border: none;
  color: #111827; transition: var(--transition-smooth);
}
.dark .faq-question { color: #f9fafb; }
.faq-question:focus-visible { outline: 3px solid var(--primary-500); outline-offset: -3px; }
.faq-chevron { width: 20px; height: 20px; transition: transform 0.3s; flex-shrink: 0; color: var(--primary-500); }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1); }
.faq-item.open .faq-answer { max-height: 400px; }
.faq-answer-inner { padding: 0 1.5rem 1.25rem; color: #4b5563; line-height: 1.7; font-size: 0.9375rem; }
.dark .faq-answer-inner { color: #9ca3af; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem; border-radius: 1rem;
  background: white; border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  min-width: 300px; max-width: 420px;
  pointer-events: all; animation: slideInRight 0.35s cubic-bezier(0.34,1.56,0.64,1);
  font-size: 0.875rem; font-weight: 500;
}
.dark .toast { background: #1f2937; border-color: rgba(255,255,255,0.1); color: #f9fafb; }
.toast-success .toast-icon { color: #10b981; }
.toast-error .toast-icon { color: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon { color: var(--primary-500); }
.toast.hiding { animation: slideOutRight 0.3s ease forwards; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px) scale(0.9); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100px); } }

/* ===== MODAL ===== */
.modal-overlay {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease;
}
.modal-box {
  background: white; border-radius: 2rem;
  box-shadow: 0 40px 100px rgba(0,0,0,0.3);
  animation: modalPop 0.35s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh; overflow-y: auto;
}
.dark .modal-box {
  background: #111827;
  border: 1px solid rgba(255,255,255,0.08);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.85) translateY(40px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2.5px dashed #d1d5db; border-radius: 1.5rem;
  padding: 3rem 2rem; text-align: center; cursor: pointer;
  transition: var(--transition-smooth); position: relative;
  background: rgba(249,250,251,0.5);
}
.dark .upload-zone {
  border-color: #374151;
  background: rgba(17,24,39,0.5);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary-500);
  background: rgba(99,102,241,0.04);
  transform: scale(1.01);
}
.upload-zone.drag-over { background: rgba(99,102,241,0.08); }
.upload-icon { width: 64px; height: 64px; margin: 0 auto 1rem; color: var(--primary-500); opacity: 0.8; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;
}
.dark .progress-bar { background: #374151; }
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
  transition: width 0.3s ease;
  position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

/* ===== SKELETONS ===== */
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.dark .skeleton {
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
}
.skeleton-card {
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.8);
}
.dark .skeleton-card {
  background: rgba(17,24,39,0.7);
  border-color: rgba(255,255,255,0.08);
}

/* ===== SOCIAL LINKS ===== */
.social-link {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 0.75rem;
  background: rgba(255,255,255,0.08); color: #9ca3af;
  transition: var(--transition-smooth);
}
.social-link:hover {
  background: var(--primary-500); color: white;
  transform: translateY(-3px);
}
.social-link:focus-visible { outline: 3px solid var(--primary-500); outline-offset: 2px; }

/* ===== FOOTER LINKS ===== */
.footer-link {
  color: #6b7280; text-decoration: none;
  transition: var(--transition-smooth);
}
.footer-link:hover { color: white; transform: translateX(4px); display: inline-block; }
.footer-link:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; border-radius: 4px; }

/* ===== NEWSLETTER ===== */
.newsletter-gradient {
  background: linear-gradient(135deg, rgba(238,242,255,0.9), rgba(253,244,255,0.9));
}
.dark .newsletter-gradient {
  background: linear-gradient(135deg, rgba(30,27,75,0.5), rgba(59,7,100,0.3));
}

/* ===== AD CONTAINERS ===== */
.ad-container { width: 100%; overflow: hidden; }
.ad-slot { min-height: 90px; border-radius: 1rem; }
.ad-728x90 { max-width: 728px; }

/* ===== SEARCH RESULTS ===== */
.search-result-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; cursor: pointer; transition: background 0.15s;
}
.search-result-item:hover { background: rgba(99,102,241,0.06); }
.search-highlight { color: var(--primary-600); font-weight: 600; }
.dark .search-highlight { color: #a5b4fc; }

/* ===== PROCESSING ANIMATION ===== */
.processing-spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid rgba(99,102,241,0.2);
  border-top-color: var(--primary-500);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SUCCESS STATE ===== */
.success-checkmark {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; animation: scaleIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

/* ===== FILE PREVIEW ===== */
.file-chip {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.875rem; border-radius: 0.75rem;
  background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.2);
  font-size: 0.8125rem; transition: var(--transition-smooth);
}
.dark .file-chip { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.3); color: #d1d5db; }
.file-chip:hover { background: rgba(99,102,241,0.15); }
.file-chip-remove {
  cursor: pointer; color: #9ca3af; padding: 2px; border-radius: 4px;
  transition: color 0.2s;
}
.file-chip-remove:hover { color: #ef4444; }

/* ===== READING PROGRESS ===== */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
  transform-origin: left; transform: scaleX(0); transition: transform 0.1s;
}

/* ===== SCROLL ANIMATIONS ===== */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1; transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ===== FOCUS VISIBLE DEFAULTS ===== */
:focus-visible {
  outline: 3px solid var(--primary-500);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-thumb { background: #374151; }
.dark ::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .modal-box { border-radius: 1.5rem 1.5rem 0 0; }
  .tool-card:hover { transform: translateY(-3px) scale(1); }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .blob { animation: none; }
}

/* ===== PRINT ===== */
@media print {
  nav, footer, .ad-container, #sticky-ad, #exit-popup { display: none !important; }
  body { background: white; color: black; }
}
