/* ==========================================
   ProPulse - Styles d'Optimisation & Affichage
   ========================================== */

/* Variables & Base Typography */
:root {
  --brand-primary: #4f46e5;
  --brand-secondary: #6366f1;
  --accent-emerald: #10b981;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessibility Focus States */
:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}

/* Custom Webkit Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.dark ::-webkit-scrollbar-track {
  background: #0f172a;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Smooth Scrolling & Sticky Nav Anchor Offset */
html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 5.5rem;
}

/* Optimized Range Sliders (Chrome / Safari / Edge / Firefox) */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 9999px;
  height: 8px;
  outline: none;
}

.dark input[type=range] {
  background: #334155;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #4f46e5;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  background: #4338ca;
}

input[type=range]::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border: none;
  border-radius: 50%;
  background: #4f46e5;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type=range]::-moz-range-thumb:hover {
  transform: scale(1.18);
  background: #4338ca;
}

/* Floating Back to Top Button */
#back-to-top-btn {
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

#back-to-top-btn.hidden-btn {
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  pointer-events: none;
}

#back-to-top-btn.visible-btn {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Toast Notifications */
#toast-notification {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* QR Code Display Box */
#qrcode-container img,
#qrcode-container canvas {
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Subtle card hover elevation */
.tool-card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tool-card-hover:hover {
  transform: translateY(-2px);
}

/* ==========================================
   EMBED MODE (WIDGET INTEGRATION FOR BLOGS)
   ========================================== */
body.embed-mode {
  background-color: transparent !important;
}

body.embed-mode header,
body.embed-mode footer,
body.embed-mode .ad-container,
body.embed-mode #ad-info-modal,
body.embed-mode #pro-checkout-modal,
body.embed-mode #sponsor-pack,
body.embed-mode #pricing,
body.embed-mode #partners-stack,
body.embed-mode #back-to-top-btn,
body.embed-mode #hero-section {
  display: none !important;
}

body.embed-mode main {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

body.embed-mode .embed-hide {
  display: none !important;
}

.embed-footer-badge {
  display: none;
}

body.embed-mode .embed-footer-badge {
  display: block !important;
}

/* ==========================================
   PRINT STYLESHEET (DEVIS EXPORT ONLY)
   ========================================== */
@media print {
  /* Hide all siblings of devis-modal and website chrome */
  body > *:not(#devis-modal),
  header,
  footer,
  nav,
  main,
  section,
  .ad-container,
  #ad-info-modal,
  #pro-pricing-modal,
  #close-devis-modal-btn,
  #print-devis-btn,
  #modal-upgrade-from-devis,
  #open-pro-modal-btn,
  #toggle-ad-mode-btn,
  #theme-toggle,
  #back-to-top-btn,
  #toast-notification {
    display: none !important;
  }

  /* Reset document flow and background for clean printing */
  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Unset fixed modal wrapper */
  #devis-modal {
    position: static !important;
    display: block !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Modal inner card reset */
  #devis-modal > div {
    position: static !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Hide modal header bar */
  #devis-modal > div > div:first-of-type {
    display: none !important;
  }

  /* Printable devis container */
  #printable-devis-content {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 24px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  /* Accurate print colors */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Ensure text and table contrast is sharp when printed */
  #printable-devis-content * {
    color: #0f172a !important;
  }

  #printable-devis-content .text-slate-500,
  #printable-devis-content .dark\:text-slate-400,
  #printable-devis-content .text-\[11px\],
  #printable-devis-content .text-\[10px\] {
    color: #475569 !important;
  }

  #printable-devis-content .text-emerald-600,
  #printable-devis-content .dark\:text-emerald-400 {
    color: #059669 !important;
  }

  #printable-devis-content table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  #printable-devis-content thead {
    background-color: #f1f5f9 !important;
  }

  #printable-devis-content thead th {
    color: #1e293b !important;
  }

  #printable-devis-content tbody td {
    border-color: #e2e8f0 !important;
  }

  @page {
    size: A4 portrait;
    margin: 1.5cm;
  }
}
