/* PsychoMetrics 360 - Obsidian Dark Theme */
:root {
  --primary: #080c14;
  --secondary: #020617;
  --surface: #0f172a;
  --surface-alt: #172033;
  --surface-input: #080c14;
  --background: #080c14;
  --border: #1e293b;
  --border-light: #334155;
  --border-focus: #ef4444;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --text-main: #f8fafc;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --card-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.7), 0 8px 12px -6px rgba(0, 0, 0, 0.5);
  --modal-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.9);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
.app-header {
  background: #080c14;
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1e1b4b 0%, #dc2626 100%);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.25rem;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #f8fafc;
}

.brand-text p {
  font-size: 0.72rem;
  color: #ef4444;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.meta-pill {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.75rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.meta-pill-secondary {
  background: #111827;
  color: #94a3b8;
  border-color: #1e293b;
}

/* Main Container */
.main-wrapper {
  flex: 1;
  max-width: 920px;
  width: 100%;
  margin: 2.25rem auto;
  padding: 0 1.5rem;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  padding: 2.5rem;
  margin-bottom: 2rem;
  transition: all 0.25s ease;
}

/* Intro Screen */
.intro-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.badge-intro {
  display: inline-block;
  background: rgba(220, 38, 38, 0.12);
  color: #f87171;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.intro-hero h2 {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

.intro-hero p {
  font-size: 1.05rem;
  color: var(--text-body);
  max-width: 740px;
  margin: 0 auto;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 2.25rem 0;
}

.feature-box {
  background: #090e17;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.feature-box:hover {
  border-color: #334155;
}

.feature-box .icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.feature-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.35rem;
}

.feature-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group {
  margin: 1.5rem 0;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  background: var(--surface-input);
  color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

/* Assessment View */
.progress-section {
  margin-bottom: 2rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #1e293b;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b91c1c, #ef4444);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.dilemma-container {
  animation: fadeIn 0.35s ease-in-out;
}

.dilemma-category-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  color: #f87171;
  background: rgba(220, 38, 38, 0.15);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.dilemma-prompt {
  font-size: 1.28rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.55;
  margin-bottom: 2rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border: 2px solid #1e293b;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: #0b1120;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.option-card:hover {
  border-color: #334155;
  background: #111a2e;
  transform: translateY(-1px);
}

.option-card.selected {
  border-color: #ef4444;
  background: rgba(220, 38, 38, 0.12);
  box-shadow: 0 0 16px rgba(220, 38, 38, 0.25);
}

.option-radio {
  margin-top: 0.25rem;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: #080c14;
}

.option-card.selected .option-radio {
  border-color: #ef4444;
  background: #dc2626;
}

.option-radio::after {
  content: "";
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.option-card.selected .option-radio::after {
  opacity: 1;
}

.option-text {
  font-size: 1rem;
  color: #e2e8f0;
  line-height: 1.55;
}

.option-card.selected .option-text {
  color: #ffffff;
}

.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.actions-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: #dc2626;
  color: white;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: #b91c1c;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #1e293b;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
}

.btn-outline:hover {
  background: #1e293b;
  color: white;
}

.btn-secondary {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}

.btn-secondary:hover {
  background: #334155;
}

.btn-lg {
  padding: 0.95rem 2.25rem;
  font-size: 1.05rem;
}

/* Results View */
.results-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.report-watermark {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.report-tag {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ef4444;
  text-transform: uppercase;
}

.profile-title-card {
  background: linear-gradient(135deg, #090e17 0%, #1e293b 100%);
  color: white;
  padding: 2rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  border: 1px solid #334155;
  border-left: 6px solid #dc2626;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.profile-title-card.poser-exposed {
  background: linear-gradient(135deg, #2a1205 0%, #78350f 100%);
  border-left: 6px solid #f59e0b;
}

.profile-title-card .eyebrow {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fca5a5;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.profile-title-card h2 {
  font-size: 1.85rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.profile-title-card .archetype {
  font-size: 1.05rem;
  color: #cbd5e1;
}

.poser-alert-box {
  background: rgba(220, 38, 38, 0.15);
  border: 2px solid #ef4444;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  color: #fca5a5;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.summary-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #cbd5e1;
  margin-bottom: 2rem;
  background: #090e17;
  border: 1px solid var(--border);
  border-left: 4px solid #dc2626;
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.competencies-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .competencies-grid {
    grid-template-columns: 1fr;
  }
}

.competency-item {
  margin-bottom: 1.25rem;
}

.competency-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #e2e8f0;
}

.competency-bar-bg {
  width: 100%;
  height: 10px;
  background: #1e293b;
  border-radius: 9999px;
  overflow: hidden;
}

.competency-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b91c1c, #ef4444);
  border-radius: 9999px;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.radar-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #090e17;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.strengths-weaknesses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .strengths-weaknesses {
    grid-template-columns: 1fr;
  }
}

.feedback-col {
  background: #090e17;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.feedback-col h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feedback-list {
  list-style: none;
}

.feedback-list li {
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
  position: relative;
  padding-left: 1.25rem;
}

.feedback-list li::before {
  content: "•";
  color: #ef4444;
  font-weight: bold;
  font-size: 1.25rem;
  position: absolute;
  left: 0;
  top: -2px;
}

/* Secret Evaluator Button in Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  background: #080c14;
  font-size: 0.8rem;
  color: var(--text-light);
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.secret-trigger {
  color: #64748b;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-family: inherit;
  transition: color 0.2s;
}

.secret-trigger:hover {
  color: #94a3b8;
}

/* =========================================================
   FORENSIC & CLINICAL INSPECTOR MODAL (SECRET CONSOLE)
   ========================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: #080c14;
  color: #f1f5f9;
  border-radius: var(--radius-lg);
  border: 1px solid #1e293b;
  box-shadow: var(--modal-shadow);
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.75rem;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header .btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-header .btn-close:hover {
  color: white;
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.forensic-alert-box {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: #fca5a5;
  font-size: 0.9rem;
}

.forensic-alert-box strong {
  color: #fee2e2;
}

/* ANTI-CHEATING MATRIX STYLING */
.anti-cheating-section {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

.anti-cheating-section h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.anti-cheating-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.anti-cheating-card {
  background: #080c14;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.anti-cheating-card.triggered {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.anti-cheating-card .ac-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.anti-cheating-card .ac-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
}

.anti-cheating-card.triggered .ac-val {
  color: #f87171;
}

.anti-cheating-card .ac-status {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.anti-cheating-card.triggered .ac-status {
  color: #fca5a5;
  font-weight: 700;
}

/* Forensic Overview Grid */
.forensic-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.forensic-stat-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.forensic-stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.forensic-stat-card .value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #f8fafc;
}

.forensic-stat-card .sub {
  font-size: 0.75rem;
  color: #64748b;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #059669;
}

.badge-info {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid #0284c7;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid #d97706;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid #dc2626;
}

/* Dimensions in Modal */
.dimensions-section {
  margin-bottom: 1.75rem;
}

.dimension-row {
  margin-bottom: 1rem;
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: #cbd5e1;
}

.dimension-bar-bg {
  width: 100%;
  height: 8px;
  background: #1e293b;
  border-radius: 9999px;
  overflow: hidden;
}

.dimension-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: #38bdf8;
}

.dimension-bar-fill.danger {
  background: #ef4444;
}

.dimension-bar-fill.warning {
  background: #f59e0b;
}

/* Telemetry Section */
.telemetry-section {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

.telemetry-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.75rem;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  font-size: 0.85rem;
}

.telemetry-grid .item .t-label {
  color: #94a3b8;
  font-size: 0.75rem;
}

.telemetry-grid .item .t-value {
  color: #f8fafc;
  font-weight: 600;
  font-size: 1rem;
}

/* Audit table */
.audit-table-wrapper {
  overflow-x: auto;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.audit-table th {
  background: #0f172a;
  padding: 0.65rem 0.85rem;
  color: #94a3b8;
  border-bottom: 1px solid #1e293b;
  font-weight: 600;
}

.audit-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #0f172a;
  color: #cbd5e1;
}

.audit-table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.modal-footer {
  padding: 1rem 1.75rem;
  background: #0f172a;
  border-top: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Animation utilities */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* Print Styles */
@media print {
  .app-header, .app-footer, .actions-row, .modal-overlay {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: white !important;
  }
  .profile-title-card {
    background: #0f172a !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Enlaces de la web personal */
.app-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.app-footer a:hover {
  color: #e2e8f0;
}
.header-meta a.meta-pill:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

/* La cabecera original no cabía en un móvil: se parte en dos filas. */
@media (max-width: 720px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  .header-container {
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .brand {
    min-width: 0;
  }
  .brand-text h1 {
    font-size: 1rem;
  }
  .brand-text p {
    font-size: 0.62rem;
    letter-spacing: 0.5px;
  }
  .header-meta {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.75rem;
  }
  .meta-pill {
    padding: 0.25rem 0.55rem;
    font-size: 0.66rem;
  }
}
