/* Diagnostic Cyber Express - Styles */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #141b2d;
  --bg-card: #1a2235;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --accent: #00d4ff;
  --accent-hover: #00b8e6;
  --critical: #ff4757;
  --high: #ff8c42;
  --important: #ffd93d;
  --moderate: #4ade80;
  --indicative: #6b7280;
  --border: rgba(255, 255, 255, 0.1);
  --success: #4ade80;
  --error: #ff4757;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

/* Scanner Card */
.scanner-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border);
}

/* Input Section */
.input-section {
  margin-bottom: 24px;
}

.input-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.input-section input {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  transition: border-color 0.3s;
}

.input-section input:focus {
  outline: none;
  border-color: var(--accent);
}

.input-section input::placeholder {
  color: var(--text-secondary);
}

.help-text {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.error-text {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--error);
  min-height: 20px;
}

/* Consent Section */
.consent-section {
  margin-bottom: 24px;
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  position: relative;
  padding-left: 35px;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 2px;
  left: 0;
  height: 22px;
  width: 22px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--accent);
}

.checkbox-container input:checked ~ .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid var(--bg-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

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

.consent-text ul {
  margin: 8px 0 0 20px;
}

.consent-text li {
  margin-bottom: 4px;
}

/* Accordion - avec scrollbar visible */
.accordion {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  padding: 16px;
  background: var(--bg-secondary);
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: rgba(0, 212, 255, 0.1);
}

.accordion-icon {
  font-size: 1.5rem;
  font-weight: 300;
  transition: transform 0.3s;
}

.accordion.open .accordion-icon {
  transform: rotate(45deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion.open .accordion-content {
  max-height: 300px;
  overflow-y: auto;
}

/* Scrollbar styling for accordion */
.accordion-content::-webkit-scrollbar {
  width: 8px;
}

.accordion-content::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.accordion-content::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.accordion-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

.legal-content {
  padding: 20px;
  background: var(--bg-primary);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legal-content h4 {
  color: var(--text-primary);
  margin: 16px 0 8px;
}

.legal-content h4:first-child {
  margin-top: 0;
}

.legal-content p {
  margin-bottom: 12px;
}

.legal-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-primary);
}

/* Scan Button */
.scan-button {
  width: 100%;
  padding: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.scan-button:disabled {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.scan-button:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

/* Button hint (message d'erreur sous le bouton) */
.button-hint {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--important);
  min-height: 20px;
}

.btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Results Section */
.results-section {
  margin-top: 40px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border);
  animation: fadeIn 0.5s ease;
}

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

/* Results Header with Disclaimer button */
.results-header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 8px;
}

.results-header h2 {
  text-align: center;
  color: var(--accent);
  margin: 0;
}

.disclaimer-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

.disclaimer-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.scanned-domain {
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-secondary);
}

/* Table titles */
.table-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}

.detail-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.category-email { border-left: 4px solid #3b82f6; }
.category-web { border-left: 4px solid #8b5cf6; }
.category-dns { border-left: 4px solid #f59e0b; }

/* Summary Table */
.summary-table-container {
  overflow-x: auto;
  margin-bottom: 16px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--bg-card);
}

.summary-table th,
.summary-table td {
  padding: 10px 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.summary-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-secondary);
}

.summary-table th:first-child,
.summary-table td:first-child {
  text-align: left;
  font-weight: 500;
  width: 100px;
}

/* Column colors */
.summary-table .col-ok { color: var(--moderate); }
.summary-table .col-ko { color: var(--critical); }
.summary-table .col-incertain { color: var(--important); }
.summary-table .col-total { color: var(--text-primary); }

/* Row colors for impact levels */
.summary-table .row-critical td:first-child { color: var(--critical); font-weight: 600; }
.summary-table .row-high td:first-child { color: var(--high); font-weight: 600; }
.summary-table .row-important td:first-child { color: var(--important); font-weight: 600; }
.summary-table .row-moderate td:first-child { color: var(--moderate); font-weight: 600; }
.summary-table .row-indicative td:first-child { color: var(--indicative); font-weight: 600; }

.summary-table .row-total {
  background: var(--bg-secondary);
  font-weight: 700;
}

.summary-table .row-total td:first-child {
  font-weight: 700;
  color: var(--text-primary);
}

/* Cell highlighting for non-zero values */
.summary-table td.has-ok { color: var(--moderate); font-weight: 600; }
.summary-table td.has-ko { color: var(--critical); font-weight: 600; }
.summary-table td.has-incertain { color: var(--important); font-weight: 600; }

/* CTA Section */
.cta-section {
  text-align: center;
  padding: 24px;
  background: rgba(0, 212, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 24px;
}

.cta-section p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.cta-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px auto;
  width: 60%;
}

.cta-button {
  display: inline-block;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: var(--bg-primary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

/* New Scan Button */
.new-scan-button {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.new-scan-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Modal Popup */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content h3 {
  padding: 20px 24px;
  background: var(--bg-secondary);
  color: var(--accent);
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 70px);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.modal-body h4 {
  color: var(--text-primary);
  margin: 16px 0 8px;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.modal-close:hover {
  color: var(--accent);
}

/* Modal CTA */
.modal-cta {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.modal-cta p {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

/* Scrollbar styling for modal */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* Responsive - Tablet */
@media (max-width: 768px) {
  .container {
    padding: 30px 16px;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .scanner-card,
  .results-section {
    padding: 24px;
  }

  .summary-table th,
  .summary-table td {
    padding: 8px 6px;
    font-size: 0.85rem;
  }

  .summary-table th:first-child,
  .summary-table td:first-child {
    width: 80px;
  }

  .disclaimer-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .modal-content {
    max-width: 90%;
  }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
  .container {
    padding: 20px 12px;
  }

  header h1 {
    font-size: 1.4rem;
    letter-spacing: 0;
  }

  .scanner-card,
  .results-section {
    padding: 16px;
    border-radius: 12px;
  }

  .input-section input {
    padding: 12px;
    font-size: 1rem;
  }

  .checkbox-container {
    padding-left: 30px;
  }

  .checkmark {
    width: 20px;
    height: 20px;
  }

  .checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
  }

  .consent-text {
    font-size: 0.8rem;
  }

  .consent-text ul {
    margin-left: 15px;
  }

  .accordion-header {
    padding: 12px;
    font-size: 0.85rem;
    gap: 8px;
  }

  .accordion-header span:first-child {
    flex: 1;
    text-align: left;
    min-width: 0;
    word-wrap: break-word;
  }

  .accordion-icon {
    flex-shrink: 0;
    margin-left: 8px;
  }

  .accordion-icon {
    font-size: 1.2rem;
  }

  .scan-button {
    padding: 14px;
    font-size: 1rem;
  }

  .button-hint {
    font-size: 0.8rem;
  }

  .results-header h2 {
    font-size: 1.2rem;
  }

  .disclaimer-btn {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .table-title {
    font-size: 0.9rem;
    padding: 6px 10px;
  }

  .detail-title {
    font-size: 1rem;
    margin: 24px 0 12px;
  }

  .summary-table {
    font-size: 0.75rem;
  }

  .summary-table th,
  .summary-table td {
    padding: 6px 4px;
  }

  .summary-table th:first-child,
  .summary-table td:first-child {
    width: 70px;
  }

  .cta-section {
    padding: 16px;
  }

  .cta-section p {
    font-size: 0.9rem;
  }

  .cta-button {
    padding: 12px 24px;
    font-size: 0.9rem;
  }

  .new-scan-button {
    padding: 12px;
    font-size: 0.9rem;
  }

  footer {
    margin-top: 30px;
    padding-top: 15px;
    font-size: 0.8rem;
  }

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

  .modal-content h3 {
    padding: 16px 20px;
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 16px;
    font-size: 0.85rem;
    max-height: calc(90vh - 60px);
  }

  .modal-close {
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
  }
}
