/* ===================================================
   PsychoMetric Pro – Main Stylesheet
   =================================================== */

:root {
  --primary:   #4f46e5;
  --primary-d: #3730a3;
  --success:   #10b981;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-400:  #9ca3af;
  --gray-600:  #4b5563;
  --gray-800:  #1f2937;
  --radius:    10px;
  --shadow:    0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.13);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--gray-800);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.narrow    { max-width: 680px; }

.portal-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 20px;
}

.test-bg {
  min-height: 100vh;
  background: var(--gray-50);
  padding-bottom: 60px;
}

.admin-bg {
  min-height: 100vh;
  background: var(--gray-100);
  display: flex;
  flex-direction: column;
}

/* ── Card ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

/* ── Portal Header ── */
.portal-header {
  text-align: center;
  color: #fff;
  margin-bottom: 28px;
}
.portal-header h1 { font-size: 2rem; font-weight: 700; }
.logo-icon { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.subtitle { opacity: .85; font-size: 1rem; }
.footer-note { text-align: center; color: rgba(255,255,255,.7); margin-top: 16px; font-size: 13px; }
.footer-note a { color: #fff; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 5px; }
input, select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color .2s;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.req { color: var(--danger); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: none; transition: all .2s; text-decoration: none;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); text-decoration: none; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; text-decoration: none; }
.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-block    { width: 100%; margin-top: 8px; }
.btn-lg       { padding: 14px 32px; font-size: 16px; }
.btn-sm       { padding: 6px 12px; font-size: 13px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-personality { background: #ede9fe; color: #5b21b6; }
.badge-cognitive   { background: #dbeafe; color: #1e3a8a; }
.badge-emotional   { background: #fce7f3; color: #9d174d; }
.badge-aptitude    { background: #d1fae5; color: #065f46; }
.badge-leadership  { background: #fef3c7; color: #92400e; }
.badge-count { background: var(--primary); color:#fff; border-radius:20px; padding:2px 10px; font-size:14px; }

/* ── Status Badges ── */
.status-badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-completed   { background: #d1fae5; color: #065f46; }
.status-in_progress { background: #fef3c7; color: #92400e; }
.status-pending     { background: #f3f4f6; color: #374151; }
.status-expired     { background: #fee2e2; color: #991b1b; }

/* ── Test-Info Box ── */
.test-info-box { background: var(--gray-50); border-left: 4px solid var(--primary); padding: 12px 16px; border-radius: 4px; margin: 12px 0 16px; }
.test-info-box p { margin: 4px 0 0; font-size: 14px; color: var(--gray-600); }
.hidden { display: none !important; }

/* ── Test Header ── */
.test-header.sticky { position: sticky; top: 0; z-index: 100; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.07); }
.test-header-inner  { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; flex-wrap: wrap; gap: 8px; }
.test-meta { display: flex; gap: 16px; align-items: center; font-size: 14px; color: var(--gray-600); }
.timer { font-weight: 700; color: var(--primary); }
.timer.timer-warning { color: var(--warning); }
.timer.timer-danger  { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.progress-bar-outer { height: 4px; background: var(--gray-100); }
.progress-bar-inner { height: 4px; background: var(--primary); transition: width .3s; }

/* ── Test Container ── */
.test-container { max-width: 760px; margin: 0 auto; padding-top: 32px; }

/* ── Question Cards ── */
.question-card {
  background: #fff; border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow); margin-bottom: 20px;
  border-left: 4px solid var(--gray-200); transition: border-color .25s;
}
.question-card.answered { border-left-color: var(--success); }
.q-number  { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--gray-400); margin-bottom: 8px; }
.q-dim     { background: #ede9fe; color: #5b21b6; padding: 1px 8px; border-radius: 10px; margin-left: 8px; }
.q-text    { font-size: 17px; font-weight: 500; color: var(--gray-800); margin-bottom: 20px; }

/* ── Options ── */
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1.5px solid var(--gray-200); border-radius: 8px; cursor: pointer; transition: all .15s;
}
.option-item:hover { border-color: var(--primary); background: #f5f3ff; }
.option-item input[type=radio] { accent-color: var(--primary); width:18px; height:18px; flex-shrink:0; }
.option-text { font-size: 15px; }

/* ── Likert Scale ── */
.likert-scale { display: flex; align-items: center; gap: 12px; }
.likert-label { font-size: 12px; color: var(--gray-400); white-space: nowrap; }
.likert-options { display: flex; gap: 8px; flex: 1; justify-content: center; }
.likert-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; padding: 8px; border-radius: 8px; transition: background .15s;
}
.likert-item:hover { background: #f5f3ff; }
.likert-item input { display: none; }
.likert-item input:checked + .likert-dot { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(1.15); }
.likert-dot {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; transition: all .2s;
}
.likert-opt-label { font-size: 10px; color: var(--gray-400); text-align: center; max-width: 60px; }

/* ── Submit ── */
.submit-section { text-align: center; padding: 32px 0 60px; }
.unanswered-warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

/* ── Result Page ── */
.result-card { overflow: hidden; }
.result-hero { padding: 32px; text-align: center; color: #fff; }
.result-pass { background: linear-gradient(135deg, #10b981, #059669); }
.result-fail { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.result-icon { font-size: 3rem; margin-bottom: 8px; }
.result-hero h2 { font-size: 1.8rem; }
.score-display { display: flex; justify-content: center; padding: 32px 0; }
.score-circle  { position: relative; width: 140px; height: 140px; }
.score-circle svg { width: 100%; height: 100%; }
.score-inner   { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num     { font-size: 1.8rem; font-weight: 800; }
.score-tag     { font-size: 11px; font-weight: 600; color: var(--gray-400); }
.result-meta   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 0 24px; border-bottom: 1px solid var(--gray-100); }
.meta-item     { display: flex; flex-direction: column; gap: 4px; }
.meta-label    { font-size: 12px; color: var(--gray-400); font-weight: 600; text-transform: uppercase; }
.result-footer { text-align: center; padding-top: 24px; }
.dimensions-section { padding: 24px 0; border-top: 1px solid var(--gray-100); }
.dimensions-section h3 { margin-bottom: 16px; }
.dimension-row  { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dim-label      { width: 130px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.dim-bar-outer  { flex: 1; height: 10px; background: var(--gray-100); border-radius: 5px; overflow: hidden; }
.dim-bar-inner  { height: 100%; border-radius: 5px; transition: width .6s ease; }
.dim-pct        { width: 44px; text-align: right; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.dim-tag        { width: 120px; font-size: 12px; font-weight: 600; flex-shrink: 0; }

/* ── Admin Nav ── */
.admin-nav {
  display: flex; align-items: center; gap: 16px; background: var(--gray-800);
  padding: 0 24px; min-height: 58px; flex-wrap: wrap;
}
.nav-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 16px; }
.logo-icon-sm { font-size: 1.3rem; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { color: rgba(255,255,255,.7); padding: 8px 14px; border-radius: 6px; font-size: 14px; font-weight: 500; transition: all .15s; }
.nav-links a:hover, .nav-links a.active { color: #fff; background: rgba(255,255,255,.12); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.7); font-size: 14px; }

/* ── Admin Content ── */
.admin-content { padding: 28px 32px; flex: 1; }
.page-header   { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.back-link { font-size: 13px; color: var(--gray-400); display: block; margin-bottom: 4px; }
.back-link:hover { color: var(--primary); }

/* ── KPI Grid ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card  { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); text-align: center; }
.kpi-icon  { font-size: 2rem; margin-bottom: 8px; }
.kpi-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.kpi-label { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ── Two Column ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── Data Table ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--gray-400); border-bottom: 2px solid var(--gray-100); background: var(--gray-50); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); font-size: 14px; vertical-align: middle; }
.data-table tr:hover td { background: #f9f5ff; }

.score-pill { color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }

/* ── Dist bars ── */
.dist-row      { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dist-label    { width: 160px; font-size: 13px; flex-shrink: 0; }
.dist-bar-outer{ flex: 1; height: 14px; background: var(--gray-100); border-radius: 7px; overflow: hidden; }
.dist-bar-inner{ height: 100%; border-radius: 7px; transition: width .6s ease; }
.dist-cnt      { width: 28px; text-align: right; font-size: 13px; font-weight: 700; }

/* ── Info List ── */
.info-list { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; align-items: baseline; }
.info-list dt { font-size: 12px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; }
.info-list dd { font-size: 14px; }

/* ── Score overview (admin detail) ── */
.score-overview { text-align: center; padding: 20px 0 8px; }
.big-score { font-size: 3.5rem; font-weight: 900; line-height: 1; }
.score-label-tag { font-size: 1rem; font-weight: 700; margin-top: 4px; margin-bottom: 16px; }

/* ── Dimension cards (admin detail) ── */
.dimensions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.dim-card { background: var(--gray-50); border-radius: var(--radius); padding: 18px 16px; text-align: center; }
.dim-card-name  { font-size: 13px; font-weight: 700; color: var(--gray-600); margin-bottom: 8px; }
.dim-card-score { font-size: 2rem; font-weight: 900; }
.dim-card-label { font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.dim-card-raw   { font-size: 11px; color: var(--gray-400); margin-top: 8px; }

/* ── Quick actions ── */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-btn { background: var(--gray-50); border: 1.5px solid var(--gray-200); border-radius: 8px; padding: 14px; text-align: center; font-weight: 600; font-size: 14px; color: var(--gray-800); transition: all .15s; }
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: #f5f3ff; text-decoration: none; }

/* ── Search Form ── */
.search-form { display: flex; gap: 8px; }
.search-form input { padding: 8px 14px; font-size: 14px; }

/* ── Misc ── */
.muted { color: var(--gray-400); font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .kpi-grid  { grid-template-columns: 1fr 1fr; }
  .two-col   { grid-template-columns: 1fr; }
  .likert-scale { flex-direction: column; }
  .result-meta { grid-template-columns: 1fr; }
  .admin-nav { flex-wrap: wrap; padding: 10px; }
  .nav-links { gap: 2px; }
  .admin-content { padding: 16px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dimension-row { flex-wrap: wrap; }
}
