/* =========================================================
   STYLE GLOBAL — Projet "Explique-moi ce fichier tableur"
   ========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f6f7f9;
  color: #1f2937;
  line-height: 1.5;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

section {
  background: #ffffff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

h2 {
  margin-top: 0;
  font-size: 1.4rem;
  padding-bottom: 6px;
}

h3 {
  font-size: 1.1rem;
  margin-top: 18px;
}

p {
  margin: 10px 0;
}

ul {
  padding-left: 20px;
}

li {
  margin-bottom: 6px;
}

#statusBar {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid #e5e7eb;
}

.status-idle {
  background: #eef2ff;
}

.status-loading {
  background: #fff7ed;
}

.status-done {
  background: #ecfdf5;
}

.status-error {
  background: #fef2f2;
  color: #991b1b;
}

.status-locked {
  background: #fef3c7;
}

.compatibility-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.compatibility-table th,
.compatibility-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.9rem;
}

.compatibility-table th {
  background: #f3f4f6;
  font-weight: 600;
}

.locked {
  pointer-events: none;
}

.locked .locked-text {
  display: block;
}

.locked > h2 {
  opacity: 0.5;
}

.locked > div {
  display: none;
}

.locked::after {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #92400e;
}

#compatibility.locked {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#compatibility.locked::after {
  display: none !important;
}

footer {
  text-align: center;
  font-size: 0.8rem;
  color: #6b7280;
  padding: 20px;
}

.premium-unlocked .locked {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}

.premium-badge {
  margin-top: 8px;
  font-size: 0.9em;
  color: #0a7d3b;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-background {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: #ffffff;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  margin: 0;
  border-radius: 8px;
  padding: 24px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #374151;
}

.modal-close:hover {
  color: #000000;
}

#languageSwitch {
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

#lang-select {
  font-size: 0.9rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
}

.locked-text {
  font-style: italic;
  color: #6b7280;
  margin-top: 8px;
}

.compat-block {
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.compat-block.success {
  background: #ecfdf5;
  color: #065f46;
}

.compat-block.warning {
  background: #fff7ed;
  color: #92400e;
}

.compat-block.error {
  background: #fef2f2;
  color: #991b1b;
}

.compat-block.danger {
  background: #fef2f2;
  color: #991b1b;
}

.pdf-btn {
  margin-top: 12px;
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 6px;
  border: none;
  background: #1e40af;
  color: #ffffff;
  cursor: pointer;
}

.pdf-btn:hover {
  background: #1d4ed8;
}

#part5 {
  background: #ffffff;
  border-left: none;
}

#part5 h2 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

#part5-content {
  font-size: 1rem;
  line-height: 1.6;
}

#part5-content .reflex-block {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 6px;
}

#part5-content .reflex-consult {
  background: #ecfeff;
  border-left: 4px solid #0ea5e9;
}

#part5-content .reflex-update {
  background: #fff7ed;
  border-left: 4px solid #f97316;
}

#part5-content .reflex-error {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}

#part5-content .cell {
  font-weight: 600;
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

section:empty {
  display: none;
}

#part5:empty,
#part2-paid:empty,
#functional:empty,
#technical:empty,
#automation:empty {
  display: block;
}

#compatibility {
  border: none !important;
  padding: 0 !important;
  margin-top: 0 !important;
}

#compatibility h2 {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

/* ══════════════════════════════════════════════════════════════
   WIDGET PAIEMENT FIXE (INTÉGRÉ)
   ══════════════════════════════════════════════════════════════ */

.payment-widget {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 380px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.payment-widget.collapsed {
  width: 280px;
  height: auto;
}

.payment-widget.collapsed .payment-widget-body {
  display: none;
}

.payment-widget-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
  color: white;
  font-weight: bold;
}

.payment-widget-toggle:hover {
  background: rgba(255, 255, 255, 1);
}

.payment-widget-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  padding: 24px 20px 20px 20px;
  border-radius: 16px 16px 0 0;
  cursor: pointer;
  user-select: none;
}

.payment-widget.collapsed .payment-widget-header {
  border-radius: 16px;
  padding: 18px 45px 18px 20px;
}

.payment-widget-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px 0;
}

.payment-widget-header p {
  font-size: 13px;
  margin: 0;
  opacity: 0.95;
}

.payment-widget.collapsed .payment-widget-header p {
  display: none;
}

.payment-widget-body {
  padding: 24px 20px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.payment-features {
  margin-bottom: 20px;
}

.payment-feature-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  color: #374151;
}

.payment-feature-item::before {
  content: "✓";
  background: #10b981;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 11px;
  font-weight: bold;
  flex-shrink: 0;
}

.payment-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #e5e7eb, transparent);
  margin: 20px 0;
}

.payment-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.payment-code-section {
  margin-bottom: 20px;
}

.payment-code-input-group {
  display: flex;
  gap: 8px;
}

.payment-code-input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.payment-code-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.payment-code-btn {
  padding: 10px 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  font-size: 14px;
}

.payment-code-btn:hover {
  background: #2563eb;
}

.payment-code-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.payment-code-message {
  margin-top: 8px;
  font-size: 12px;
  min-height: 16px;
}

.payment-code-message.success {
  color: #059669;
}

.payment-code-message.error {
  color: #dc2626;
}

.payment-or-separator {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
}

.payment-or-separator::before,
.payment-or-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.payment-or-separator span {
  padding: 0 12px;
}

.payment-card-section {
  margin-bottom: 20px;
}

.payment-card-element {
  padding: 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  transition: border-color 0.2s;
}

.payment-card-element.StripeElement--focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.payment-card-errors {
  color: #dc2626;
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
}

.payment-price-section {
  background: #f9fafb;
  padding: 14px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.payment-price-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 4px;
}

.payment-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #059669;
  background: #d1fae5;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.payment-price-amount {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.payment-submit-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.payment-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.payment-submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.payment-stripe-badge {
  text-align: center;
  margin-top: 12px;
  font-size: 11px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLETTES (max 768px)
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  main {
    padding: 12px;
  }

  section {
    padding: 14px;
    margin-bottom: 14px;
  }

  h2 {
    font-size: 1.2rem;
  }

  h3 {
    font-size: 1rem;
  }

  .payment-widget {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
    overflow-y: auto;
  }

.payment-widget.collapsed {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    bottom: 20px;
    right: 20px;
    left: auto;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }

  .payment-widget.collapsed .payment-widget-header {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .payment-widget.collapsed .payment-widget-header h2 {
    font-size: 24px;
    margin: 0;
  }

  .payment-widget.collapsed .payment-widget-header h2 span {
    display: none;
  }

  .payment-widget.collapsed .payment-widget-toggle {
    display: none;
  }

  .payment-widget-body {
    max-height: 50vh;
    padding: 16px;
  }

  .modal-content {
    width: 95%;
    max-height: 85vh;
    padding: 16px;
  }

  footer p {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }

  footer p span {
    display: none;
  }

  .compatibility-table {
    display: block;
    overflow-x: auto;
  }
}
/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — SMARTPHONES (max 480px)
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {

  main {
    padding: 8px;
  }

  section {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
  }

  h2 {
    font-size: 1.05rem;
  }

  h3 {
    font-size: 0.95rem;
  }

  body {
    font-size: 0.9rem;
  }

  #statusBar {
    font-size: 0.85rem;
    padding: 8px 10px;
  }

  #languageSwitch {
    padding: 8px 10px;
  }

  #lang-select {
    font-size: 0.85rem;
  }

  .payment-widget-header h2 {
    font-size: 15px;
  }

  .payment-price-amount {
    font-size: 20px;
  }

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

  .payment-code-btn {
    width: 100%;
  }

  .payment-submit-btn {
    font-size: 14px;
    padding: 12px;
  }

  .modal-content {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 12px;
  }

  .modal-close {
    top: 8px;
    right: 8px;
    font-size: 1.4rem;
  }

  .pdf-btn {
    width: 100%;
    text-align: center;
  }

  .compat-block {
    font-size: 0.85rem;
    padding: 10px;
  }

  #part5-content .reflex-block {
    padding: 10px;
  }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — GRANDS ÉCRANS (min 1200px)
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 1200px) {

  main {
    max-width: 1200px;
    padding: 32px;
  }

  section {
    padding: 28px;
  }

  h2 {
    font-size: 1.5rem;
  }

  .payment-widget {
    right: 40px;
    width: 400px;
  }
}