/* ==========================================================================
   CrownateStudio Property Intelligence — Application 02: Document X-Ray
   Styling Architecture (Mobile-First, WCAG 2.2 AA compliant)
   ========================================================================== */

:root {
  --xray-bg: #f8fafc;
  --xray-surface: #ffffff;
  --xray-surface-elevated: #f1f5f9;
  --xray-text-main: #0f172a;
  --xray-text-muted: #64748b;
  --xray-text-subtle: #94a3b8;
  --xray-border: #e2e8f0;
  --xray-border-strong: #cbd5e1;
  --xray-primary: #0b0b0b;
  --xray-primary-hover: #1e293b;
  --xray-accent-gold: #d97706;
  --xray-accent-navy: #1e3a8a;
  
  /* Status Colors */
  --xray-pass: #16a34a;
  --xray-pass-bg: #dcfce7;
  --xray-pass-border: #86efac;
  
  --xray-attention: #d97706;
  --xray-attention-bg: #fef3c7;
  --xray-attention-border: #fde68a;
  
  --xray-info: #0284c7;
  --xray-info-bg: #e0f2fe;
  --xray-info-border: #bae6fd;
  
  --xray-critical: #dc2626;
  --xray-critical-bg: #fee2e2;
  --xray-critical-border: #fca5a5;

  --xray-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --xray-shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --xray-shadow-elevated: 0 12px 32px -4px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.xray-page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 5rem;
}

/* --- Hero Banner --- */
.xray-hero-section {
  background: var(--xray-surface);
  border: 1px solid var(--xray-border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--xray-shadow-card);
  position: relative;
  overflow: hidden;
}

.xray-hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--xray-accent-gold), var(--xray-accent-navy));
}

.xray-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.xray-title {
  font-family: 'Manrope', -apple-system, sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--xray-text-main);
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.xray-subtitle {
  font-size: 1.125rem;
  color: var(--xray-text-muted);
  line-height: 1.6;
  max-width: 760px;
  margin-bottom: 1.5rem;
}

.xray-hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.xray-btn-primary {
  background: var(--xray-primary);
  color: #ffffff;
  border: 1px solid var(--xray-primary);
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.xray-btn-primary:hover {
  background: var(--xray-primary-hover);
  transform: translateY(-1px);
}

.xray-btn-outline {
  background: transparent;
  color: var(--xray-text-main);
  border: 1px solid var(--xray-border-strong);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.xray-btn-outline:hover {
  background: var(--xray-surface-elevated);
}

/* --- Statutory Warning Card --- */
.xray-boundary-notice {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--xray-accent-gold);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #334155;
}

.xray-boundary-notice strong {
  color: var(--xray-text-main);
}

/* --- Mode Switcher Tabs --- */
.xray-tabs-wrapper {
  background: var(--xray-surface);
  border: 1px solid var(--xray-border);
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--xray-shadow-sm);
}

.xray-tab-btn {
  flex: 1;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--xray-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.xray-tab-btn.active {
  background: var(--xray-surface-elevated);
  color: var(--xray-text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  font-weight: 700;
}

/* --- Upload Area --- */
.xray-upload-card {
  background: var(--xray-surface);
  border: 1px solid var(--xray-border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--xray-shadow-card);
  margin-bottom: 2rem;
}

.xray-dropzone {
  border: 2px dashed var(--xray-border-strong);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  background: #fdfdfd;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.xray-dropzone:hover, .xray-dropzone.dragover {
  border-color: var(--xray-accent-gold);
  background: #fffbeb;
}

.xray-dropzone-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--xray-accent-gold);
}

.xray-dropzone-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--xray-text-main);
  margin-bottom: 0.5rem;
}

.xray-dropzone-subtitle {
  font-size: 0.875rem;
  color: var(--xray-text-muted);
  margin-bottom: 1rem;
}

.xray-sample-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--xray-border);
}

.xray-sample-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}

.xray-sample-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* --- Existing Risk Check Documents Selector --- */
.xray-existing-selector {
  background: var(--xray-surface);
  border: 1px solid var(--xray-border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--xray-shadow-card);
  margin-bottom: 2rem;
}

.xray-input-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.xray-text-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--xray-border-strong);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--xray-text-main);
}

.xray-text-input:focus {
  outline: none;
  border-color: var(--xray-accent-navy);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.xray-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.xray-doc-item-card {
  border: 1px solid var(--xray-border);
  border-radius: 8px;
  padding: 1.25rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.xray-doc-item-card:hover {
  border-color: var(--xray-accent-gold);
  background: #ffffff;
  box-shadow: var(--xray-shadow-sm);
}

/* --- Progress / Scanning Laboratory Modal --- */
.xray-scanner-state {
  display: none;
  background: var(--xray-surface);
  border: 1px solid var(--xray-border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--xray-shadow-card);
  margin-bottom: 2rem;
}

.xray-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f1f5f9;
  border-top-color: var(--xray-accent-gold);
  border-radius: 50%;
  animation: xray-spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

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

.xray-stage-indicator {
  font-size: 0.9rem;
  color: var(--xray-text-muted);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* --- Analysis Results Section (10 Parts) --- */
.xray-results-container {
  display: none;
}

/* Header summary card */
.xray-result-header-card {
  background: var(--xray-surface);
  border: 1px solid var(--xray-border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--xray-shadow-card);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.xray-header-meta h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--xray-text-main);
  margin-bottom: 0.5rem;
}

.xray-meta-pill {
  display: inline-block;
  background: #e2e8f0;
  color: #334155;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.5rem;
}

.xray-completeness-score-box {
  background: #f8fafc;
  border: 2px solid var(--xray-border);
  border-radius: 12px;
  padding: 1.25rem 2rem;
  text-align: center;
  min-width: 200px;
}

.xray-completeness-number {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--xray-accent-gold);
  margin-bottom: 0.25rem;
}

.xray-completeness-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--xray-text-muted);
  letter-spacing: 0.05em;
}

/* Section Cards */
.xray-card {
  background: var(--xray-surface);
  border: 1px solid var(--xray-border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--xray-shadow-card);
  margin-bottom: 2rem;
}

.xray-card-title {
  font-family: 'Manrope', -apple-system, sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--xray-text-main);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.xray-card-title span.number {
  color: var(--xray-accent-gold);
  font-size: 1.1rem;
}

/* Structured Information Map Table */
.xray-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.xray-info-table th {
  text-align: left;
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--xray-border);
  color: var(--xray-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.xray-info-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--xray-border);
  vertical-align: top;
}

.xray-info-table tr:hover td {
  background: #fdfdfd;
}

.xray-page-tag {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

/* Attention Indicators Cards */
.xray-finding-card {
  border: 1px solid var(--xray-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  background: #ffffff;
}

.xray-finding-card.critical {
  border-left: 5px solid var(--xray-critical);
  background: #fffafa;
}

.xray-finding-card.warning {
  border-left: 5px solid var(--xray-attention);
  background: #fffdf5;
}

.xray-finding-card.info {
  border-left: 5px solid var(--xray-info);
  background: #f8fcff;
}

.xray-finding-card.pass {
  border-left: 5px solid var(--xray-pass);
  background: #f6fdf8;
}

.xray-finding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.xray-finding-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--xray-text-main);
}

.xray-finding-meaning {
  font-size: 0.875rem;
  color: #334155;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.xray-finding-action {
  font-size: 0.825rem;
  color: #1e3a8a;
  background: #eff6ff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  line-height: 1.45;
}

/* Questions Checklist */
.xray-question-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--xray-border);
  font-size: 0.925rem;
  color: var(--xray-text-main);
}

.xray-question-num {
  font-weight: 800;
  color: var(--xray-accent-gold);
  min-width: 24px;
}

/* Action Plan & CTAs */
.xray-action-box {
  background: #0f172a;
  color: #ffffff;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  margin-top: 2rem;
  text-align: center;
}

.xray-action-box h3 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.xray-action-box p {
  color: #94a3b8;
  max-width: 650px;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
}

.xray-action-btn-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.xray-btn-gold {
  background: var(--xray-accent-gold);
  color: #ffffff;
  border: 1px solid var(--xray-accent-gold);
  padding: 0.85rem 1.75rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.xray-btn-gold:hover {
  background: #b45309;
}

/* Modal */
.xray-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.xray-modal-card {
  background: #ffffff;
  border-radius: 12px;
  max-width: 550px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* Responsive */
@media (max-width: 768px) {
  .xray-title { font-size: 1.75rem; }
  .xray-hero-section { padding: 1.75rem 1.25rem; }
  .xray-result-header-card { flex-direction: column; }
  .xray-completeness-score-box { width: 100%; }
  .xray-tabs-wrapper { flex-direction: column; }
}
