:root {
  --brand-primary: #9c1e3d;
  --brand-primary-dark: #70142b;
  --brand-primary-soft: #bd3f5f;
  --brand-accent: #d8ba6b;
  --brand-secondary: #b2654f;
  --brand-bg: #fdf5f6;
  --brand-bg-soft: #fff5f0;
  --brand-card: #fffafa;
  --brand-input: #fceced;
  --brand-highlight: #f5d9df;
  --brand-border: #e8c7ce;
  --brand-text: #2b2b2b;
  --brand-muted: #75646a;
  --brand-shadow: 0 14px 32px rgba(112, 20, 43, .10);
  --brand-shadow-strong: 0 22px 48px rgba(112, 20, 43, .16);
}

body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(156, 30, 61, .08), transparent 34%),
    linear-gradient(225deg, rgba(216, 186, 107, .16), transparent 38%),
    repeating-linear-gradient(135deg, rgba(156, 30, 61, .035) 0 1px, transparent 1px 18px),
    var(--brand-bg);
  color: var(--brand-text);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a { color: var(--brand-primary); }
a:hover { color: var(--brand-primary-dark); }

::selection {
  background: var(--brand-primary);
  color: #fff;
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes softPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(156, 30, 61, .24);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(156, 30, 61, 0);
  }
}

@keyframes sheen {
  from { transform: translateX(-120%) skewX(-18deg); }
  to { transform: translateX(180%) skewX(-18deg); }
}

.motion-in {
  animation: fadeUp .62s cubic-bezier(.2, .7, .2, 1) both;
}

.motion-in-slow {
  animation: fadeUp .82s cubic-bezier(.2, .7, .2, 1) both;
}

.motion-delay-1 { animation-delay: .08s; }
.motion-delay-2 { animation-delay: .16s; }
.motion-delay-3 { animation-delay: .24s; }
.motion-delay-4 { animation-delay: .32s; }
.motion-delay-5 { animation-delay: .4s; }
.motion-delay-6 { animation-delay: .48s; }

.brand-logo {
  max-width: 180px;
  max-height: 86px;
  object-fit: contain;
}

.brand-logo-sm {
  max-width: 150px;
  max-height: 70px;
  object-fit: contain;
}

.brand-shell { max-width: 1080px; }

.brand-topbar {
  background: rgba(255, 250, 250, .92);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
  padding: 1rem;
  backdrop-filter: blur(12px);
  animation: fadeUp .55s cubic-bezier(.2, .7, .2, 1) both;
  position: relative;
  overflow: hidden;
}

.brand-topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent), var(--brand-secondary));
}

.card,
.brand-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
  transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease;
}

.card:hover,
.brand-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--brand-shadow-strong);
  border-color: rgba(216, 186, 107, .82);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--brand-border);
}

.form-control,
.form-select {
  background-color: var(--brand-input);
  border-color: var(--brand-accent);
  color: var(--brand-text);
  border-radius: 6px;
}

.form-control:focus,
.form-select:focus {
  background-color: #fff;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 .2rem rgba(156, 30, 61, .16);
}

.form-check-input:checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.btn {
  border-radius: 6px;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary::after,
.btn-dark::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .32), transparent);
  transform: translateX(-120%) skewX(-18deg);
}

.btn-primary:hover::after,
.btn-dark:hover::after {
  animation: sheen .75s ease;
}

.btn-primary,
.btn-dark {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.btn-primary:hover,
.btn-dark:hover {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  border-color: var(--brand-primary-dark);
  color: #fff;
  box-shadow: 0 8px 18px rgba(112, 20, 43, .18);
}

.btn-outline-dark,
.btn-outline-secondary {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-outline-dark:hover,
.btn-outline-secondary:hover {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.btn-outline-danger {
  border-color: var(--brand-primary-dark);
  color: var(--brand-primary-dark);
}

.btn-outline-danger:hover,
.btn-danger {
  background-color: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  color: #fff;
}

.btn-ghost-light {
  border: 1px solid rgba(255, 255, 255, .45);
  color: #fff;
  background: transparent;
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .7);
  color: #fff;
}

.badge.text-bg-light,
.badge-soft {
  background-color: var(--brand-highlight) !important;
  color: var(--brand-primary-dark) !important;
  border: 1px solid var(--brand-border);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(245, 217, 223, .42);
}

.table thead th,
thead th {
  background: var(--brand-primary) !important;
  color: #fff !important;
  border-color: var(--brand-primary);
}

.table tbody td {
  background: rgba(255, 250, 250, .75);
  border-color: var(--brand-border);
}

.pagination .page-link {
  color: var(--brand-primary);
  border-color: var(--brand-border);
}

.pagination .active .page-link {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.progress { background-color: var(--brand-highlight); }
.progress-bar {
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  transition: width .8s cubic-bezier(.2, .7, .2, 1);
}

.public-hero {
  background: linear-gradient(135deg, rgba(156, 30, 61, .94), rgba(112, 20, 43, .98));
  border-radius: 8px;
  color: #fff;
  padding: 2rem;
  box-shadow: var(--brand-shadow);
  position: relative;
  overflow: hidden;
}

.public-hero::after {
  content: "";
  position: absolute;
  inset: auto -15% -55% 20%;
  height: 82%;
  background: linear-gradient(90deg, transparent, rgba(216, 186, 107, .22), transparent);
  transform: rotate(-8deg);
}

.public-hero .text-muted {
  color: rgba(255, 255, 255, .78) !important;
}

.hero-orbit {
  position: absolute;
  top: -10%;
  right: -6%;
  width: min(60%, 460px);
  height: auto;
  opacity: .9;
  pointer-events: none;
  animation: orbitSpin 60s linear infinite;
  transform-origin: 320px 90px;
}

@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.riasec-preview {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.riasec-chip {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(216, 186, 107, .55);
  color: #fff;
  font-weight: 700;
  font-size: .82rem;
}

.stat-tile {
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
  transition: transform .24s ease, box-shadow .24s ease;
}

.stat-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--brand-shadow-strong);
}

.stat-tile i {
  display: block;
  font-size: 1.15rem;
}

.stat-tile-1,
.stat-tile-2 {
  background: var(--brand-highlight);
}

.stat-tile-1 i,
.stat-tile-1 .h4,
.stat-tile-2 i,
.stat-tile-2 .h4 {
  color: var(--brand-primary-dark);
}

.stat-tile-1 .small,
.stat-tile-2 .small {
  color: var(--brand-primary-dark);
  opacity: .72;
}

.stat-tile-2 {
  background: #fff;
  border: 1px solid var(--brand-border);
}

.stat-tile-3 {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .3);
}

.stat-tile-3 i,
.stat-tile-3 .h4,
.stat-tile-3 .small {
  color: #fff;
}

.stat-tile-3 .small {
  opacity: .82;
}

.area-marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.area-marquee-track {
  display: flex;
  gap: .6rem;
  width: max-content;
  animation: marqueeScroll 38s linear infinite;
}

.area-marquee:hover .area-marquee-track {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.area-chip {
  flex-shrink: 0;
  padding: .5rem 1rem;
  border-radius: 999px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  color: var(--brand-primary-dark);
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .hero-orbit {
    display: none;
  }
}

.brand-footer {
  border-top: 1px solid var(--brand-border);
  background: rgba(255, 250, 250, .6);
}

.footer-links li + li {
  margin-top: .4rem;
}

.footer-links a {
  color: var(--brand-text);
}

.footer-links a:hover {
  color: var(--brand-primary);
}

.dimension-strip {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: .5rem;
}

.dimension-card {
  scroll-snap-align: start;
  flex: 0 0 220px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
  padding: 1.1rem;
  transition: transform .22s ease, box-shadow .22s ease;
}

.dimension-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--brand-shadow-strong);
}

.dimension-card-letter {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-highlight);
  color: var(--brand-primary-dark);
  font-weight: 700;
  margin-bottom: .6rem;
}

.preview-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
}

.preview-row + .preview-row {
  margin-top: .85rem;
}

.preview-badge {
  position: absolute;
  top: -.7rem;
  right: 1.25rem;
}

.question-card,
.result-card {
  background: #fffafa;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
}

.question-item,
.recommendation-card,
.area-score-row,
.stat-card {
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background-color .22s ease;
}

.question-item:hover,
.recommendation-card:hover,
.area-score-row:hover,
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(216, 186, 107, .9) !important;
  box-shadow: 0 12px 28px rgba(112, 20, 43, .10);
}

.btn-check:checked + .btn-outline-dark {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  border-color: var(--brand-primary);
  color: #fff;
  animation: softPulse .75s ease;
}

.btn-option-scale {
  min-width: 44px;
}

.chip-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.chip-toggle {
  border-radius: 999px !important;
  font-size: .82rem;
  padding: .3rem .75rem;
}

.district-picker {
  max-height: 190px;
  overflow-y: auto;
  padding: .5rem;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: var(--brand-input);
}

.area-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.area-color-green { background: #2e7d46; }
.area-color-blue { background: #2f6fb3; }
.area-color-red { background: #b3402f; }

.counter-tile {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: .75rem 1rem;
  text-align: center;
}

.counter-tile-over {
  border-color: #b3402f;
  background: rgba(179, 64, 47, .08);
}

.advanced-toggle summary {
  cursor: pointer;
  list-style: none;
  color: var(--brand-primary);
  font-weight: 600;
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.advanced-toggle summary::-webkit-details-marker {
  display: none;
}

.advanced-toggle summary::marker {
  content: "";
}

.advanced-toggle summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--brand-primary);
  font-size: .8rem;
  line-height: 1;
}

.advanced-toggle[open] summary::before {
  content: "\2212";
}

.advanced-toggle summary:hover {
  color: var(--brand-primary-dark);
}

.preference-row {
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}

.preference-row:hover {
  background-color: var(--brand-highlight);
  border-color: rgba(216, 186, 107, .82) !important;
}

.preference-row .form-check-input {
  width: 1.15em;
  height: 1.15em;
}

.section-kicker {
  color: var(--brand-primary);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.area-rank-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-highlight);
  color: var(--brand-primary-dark);
  font-weight: 700;
  font-size: .82rem;
}

.icon-chip {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-highlight);
  color: var(--brand-primary-dark);
  border: 1px solid var(--brand-border);
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .38rem .7rem;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-primary-dark);
  border: 1px solid rgba(216, 186, 107, .72);
  box-shadow: 0 6px 14px rgba(112, 20, 43, .08);
}

.admin-shell { min-height: 100vh; }

.admin-sidebar {
  min-height: 100vh;
  background: #fffafa;
  border-right: 1px solid var(--brand-border);
  box-shadow: 8px 0 24px rgba(112, 20, 43, .06);
  animation: slideInLeft .55s cubic-bezier(.2, .7, .2, 1) both;
}

.admin-sidebar-logo {
  min-height: 100px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--brand-border);
  margin: -1rem -1rem 1rem;
  padding: 1rem;
  background: #fff;
}

.admin-sidebar .nav-link {
  color: var(--brand-text);
  border-radius: 6px;
  padding: .65rem .8rem;
  position: relative;
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.admin-sidebar .nav-link.active,
.admin-sidebar .nav-link:hover {
  background: var(--brand-highlight);
  color: var(--brand-primary-dark);
  font-weight: 600;
  transform: translateX(3px);
}

.admin-sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: .35rem;
  top: .55rem;
  bottom: .55rem;
  width: 3px;
  border-radius: 999px;
  background: var(--brand-primary);
}

.admin-content {
  min-height: 100vh;
  background: var(--brand-bg);
}

.admin-page-header {
  background: rgba(255, 250, 250, .86);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
  padding: 1rem 1.25rem;
  backdrop-filter: blur(12px);
  animation: fadeUp .5s cubic-bezier(.2, .7, .2, 1) both;
}

.auth-card {
  border-radius: 8px;
  box-shadow: var(--brand-shadow);
  animation: fadeUp .6s cubic-bezier(.2, .7, .2, 1) both;
}

.admin-content > .card,
.admin-content .card,
.admin-content .table-responsive {
  animation: fadeUp .58s cubic-bezier(.2, .7, .2, 1) both;
}

.step-flow {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.step-flow-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex: 1;
}

.step-flow-number {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-highlight);
  color: var(--brand-primary-dark);
  border: 1px solid var(--brand-border);
  font-size: 1.05rem;
}

.step-flow-connector {
  flex: 0 0 3rem;
  align-self: center;
  height: 1px;
  margin-top: -1.5rem;
  background: linear-gradient(90deg, var(--brand-accent), var(--brand-border));
}

@media (max-width: 767.98px) {
  .step-flow {
    flex-direction: column;
    gap: 1.25rem;
  }

  .step-flow-connector {
    display: none;
  }
}

.accordion-item {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
}

.accordion-button {
  background: var(--brand-card);
  color: var(--brand-text);
  font-weight: 600;
}

.accordion-button:not(.collapsed) {
  background: var(--brand-highlight);
  color: var(--brand-primary-dark);
  box-shadow: none;
}

.accordion-button:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 .2rem rgba(156, 30, 61, .16);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 991.98px) {
  .admin-sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--brand-border);
  }

  .admin-sidebar-logo {
    min-height: 72px;
  }
}
