/*
  Detective Hub Registration
  File: assets/css/base.css
  Purpose: shared theme, layout helpers, form components, buttons, modal and loader
*/

/* =========================================================
   1) Theme tokens
   ========================================================= */
:root {
  --bg: #020711;
  --bg-2: #071224;
  --panel: rgba(16, 20, 31, 0.84);
  --panel-strong: rgba(14, 18, 28, 0.94);
  --field: #151821;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: #f8f8ff;
  --muted: #a8b1c8;
  --blood: #a20d19;
  --blood-bright: #e3001b;
  --blue: #123b8a;
  --cyan: #8fbaff;
  --gold: #d3a84a;
  --green: #94f0b3;
  --warning: #ffcf7a;
  --error: #ff8a96;
  --shadow: rgba(0, 0, 0, 0.75);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --ease: 220ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(22, 67, 142, 0.42), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(155, 16, 29, 0.22), transparent 26%),
    radial-gradient(circle at 72% 84%, rgba(7, 54, 88, 0.38), transparent 30%),
    linear-gradient(135deg, #02040b 0%, #071224 54%, #06080d 100%);
  overflow-x: hidden;
}

/* Subtle grid/noise style for detective-board atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 0.75), transparent 75%);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

/* =========================================================
   2) Background accents and shell
   ========================================================= */
.blood-smear {
  position: fixed;
  right: -60px;
  top: 90px;
  width: 260px;
  height: 340px;
  pointer-events: none;
  opacity: 0.32;
  filter: blur(0.2px);
  background:
    radial-gradient(circle at 38% 25%, #8c0b17 0 18px, transparent 19px),
    radial-gradient(circle at 55% 44%, #d71624 0 12px, transparent 13px),
    radial-gradient(circle at 32% 59%, #a00f1a 0 10px, transparent 11px),
    linear-gradient(160deg, transparent 0 20%, #750811 21% 40%, transparent 41%);
  transform: rotate(-17deg);
}

.shell {
  width: min(1180px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 60px;
  position: relative;
  z-index: 1;
}

.shell-wide {
  width: min(1260px, calc(100vw - 32px));
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

/* Brand logo circle */
.mark {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 96px;
  background: linear-gradient(145deg, rgba(227, 0, 27, 0.86), rgba(9, 36, 86, 0.96));
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.42),
    inset 0 0 18px rgba(255, 255, 255, 0.16);
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: 0.5px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panel,
.form-card,
.case-card,
.ep-showcase,
.staff-bar,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 18px 18px 44px rgba(0, 0, 0, 0.44), -1px -1px 8px rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
}

/* =========================================================
   3) Shared text and status components
   ========================================================= */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 2.2px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 14px;
}

.kicker::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--blood-bright);
  box-shadow: 0 0 14px rgba(227, 0, 27, 0.85);
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(227, 0, 27, 0.32);
  border-radius: 999px;
  padding: 10px 14px;
  color: #ffd6d9;
  background: rgba(227, 0, 27, 0.1);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.help-text {
  color: var(--muted);
  line-height: 1.55;
}

.inline-error {
  display: none;
  color: var(--error);
  font-weight: 800;
  font-size: 13px;
  margin-top: 8px;
}

.inline-error.is-visible {
  display: block;
}

.notice {
  border: 1px solid rgba(143, 186, 255, 0.24);
  background: rgba(143, 186, 255, 0.08);
  color: #d8e6ff;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

/* =========================================================
   4) Form controls
   ========================================================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 24px;
}

.floatbox {
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
  color: white;
}

.floatbox.wide {
  grid-column: 1 / -1;
}

.label {
  font-size: clamp(16px, 1.4vw, 19px);
  padding-left: 12px;
  position: absolute;
  top: 14px;
  transition: 0.28s ease;
  pointer-events: none;
  color: #c9d0e2;
}

.input,
.select {
  width: 100%;
  height: 58px;
  border: none;
  outline: none;
  padding: 15px 16px 7px;
  border-radius: 12px;
  color: #fff;
  font-size: clamp(16px, 1.4vw, 19px);
  background-color: var(--field);
  box-shadow: 5px 5px 14px rgba(0, 0, 0, 0.82), -1px -1px 7px rgba(255, 255, 255, 0.09);
  appearance: none;
  transition: var(--ease);
}

.select {
  background-image:
    linear-gradient(45deg, transparent 50%, #ffffff 50%),
    linear-gradient(135deg, #ffffff 50%, transparent 50%);
  background-position: calc(100% - 21px) 26px, calc(100% - 14px) 26px;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
}

.input:focus,
.select:focus {
  box-shadow:
    5px 5px 14px rgba(0, 0, 0, 1),
    -1px -1px 8px rgba(255, 255, 255, 0.18),
    inset 4px 4px 12px rgba(0, 0, 0, 0.72),
    inset -1px -1px 8px rgba(255, 255, 255, 0.12);
}

.input:focus ~ .label,
.input:not(:placeholder-shown) ~ .label,
.input[type="date"] ~ .label,
.select:focus ~ .label,
.select:valid ~ .label {
  transform: translate(8px, -31px) scale(0.78);
  color: #fff;
  letter-spacing: 0.9px;
  text-shadow: 0 0 10px rgba(143, 186, 255, 0.45);
}

.input.invalid,
.select.invalid {
  box-shadow:
    5px 5px 14px rgba(0, 0, 0, 0.96),
    -1px -1px 8px rgba(255, 255, 255, 0.14),
    0 0 0 2px rgba(227, 0, 27, 0.58);
}


/* Field guidance and validation messages under inputs */
.field-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-error {
  display: none;
  margin-top: 7px;
  color: var(--error);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.field-error.is-visible {
  display: block;
}

.input.invalid ~ .field-hint,
.select.invalid ~ .field-hint {
  color: rgba(255, 216, 220, 0.72);
}

/* =========================================================
   5) Buttons
   ========================================================= */
.primary {
  min-width: 180px;
  min-height: 50px;
  border: none;
  outline: none;
  padding: 0 18px;
  border-radius: 14px;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  background: linear-gradient(135deg, #151922, #222734);
  box-shadow: 5px 5px 16px rgba(0, 0, 0, 0.82), -1px -1px 8px rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: var(--ease);
}

.primary:hover {
  transform: translateY(-2px);
}

.primary:disabled,
.blood-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.blood-button {
  position: relative;
  min-width: 250px;
  height: 58px;
  border: none;
  outline: none;
  padding: 0 24px;
  border-radius: 15px;
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0.8px;
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.12), transparent 9%),
    linear-gradient(135deg, #151922 0%, #202433 42%, #29070c 100%);
  box-shadow:
    5px 5px 16px rgba(0, 0, 0, 0.84),
    -1px -1px 8px rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  cursor: pointer;
  transition: var(--ease);
  overflow: hidden;
  isolation: isolate;
}

.blood-button::before {
  content: "";
  position: absolute;
  inset: -30px -20px auto auto;
  width: 185px;
  height: 96px;
  pointer-events: none;
  z-index: -1;
  opacity: 0.95;
  background:
    radial-gradient(circle at 24px 25px, #e3001b 0 9px, transparent 10px),
    radial-gradient(circle at 58px 41px, #8e0712 0 13px, transparent 14px),
    radial-gradient(circle at 92px 22px, #bf1020 0 8px, transparent 9px),
    radial-gradient(circle at 126px 50px, #e3001b 0 11px, transparent 12px),
    radial-gradient(circle at 153px 27px, #7d0610 0 6px, transparent 7px),
    linear-gradient(155deg, transparent 0 24%, rgba(158, 9, 20, 0.92) 25% 48%, transparent 49%);
  transform: rotate(-10deg);
  filter: drop-shadow(0 0 14px rgba(227, 0, 27, 0.35));
}

.blood-button::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -12px;
  width: 90px;
  height: 46px;
  opacity: 0.78;
  background:
    radial-gradient(circle at 18px 19px, #7d0610 0 7px, transparent 8px),
    radial-gradient(circle at 42px 12px, #cc1220 0 5px, transparent 6px),
    radial-gradient(circle at 67px 25px, #9b0b17 0 9px, transparent 10px);
}

.blood-button:hover {
  transform: translateY(-2px);
  box-shadow:
    5px 5px 18px rgba(0, 0, 0, 1),
    -1px -1px 10px rgba(255, 255, 255, 0.16),
    inset 3px 3px 10px rgba(0, 0, 0, 0.65),
    inset -1px -1px 8px rgba(255, 255, 255, 0.1),
    0 0 26px rgba(227, 0, 27, 0.12);
}

/* =========================================================
   6) Modal and loader
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  z-index: 110;
  backdrop-filter: blur(7px);
}

.modal.is-visible {
  display: grid;
}

.modal-card {
  width: min(540px, 100%);
  padding: 28px;
  animation: modalIn 240ms ease both;
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.modal-card p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(14, 49, 104, 0.22), transparent 26%),
    radial-gradient(circle at 50% 58%, rgba(144, 5, 18, 0.16), transparent 24%),
    rgba(0, 0, 0, 0.9);
  z-index: 120;
  backdrop-filter: blur(8px);
}

.loading-overlay.is-visible {
  display: grid;
}

.detective-loader {
  position: relative;
  width: 320px;
  height: 360px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 28px 44px rgba(0, 0, 0, 0.78));
}

.magnifier-wrap {
  position: absolute;
  top: 36px;
  left: 50%;
  width: 220px;
  height: 220px;
  transform: translateX(-50%);
  animation: magnifierFloat 3.2s ease-in-out infinite;
}

.lens-glass {
  position: absolute;
  top: 18px;
  left: 20px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 31% 24%, rgba(255, 255, 255, 0.34), transparent 16%),
    radial-gradient(circle at 70% 73%, rgba(0, 0, 0, 0.24), transparent 35%),
    linear-gradient(135deg, rgba(143, 186, 255, 0.26), rgba(255, 255, 255, 0.07));
  box-shadow:
    inset 10px 12px 28px rgba(255, 255, 255, 0.1),
    inset -14px -18px 28px rgba(0, 0, 0, 0.32),
    0 0 36px rgba(143, 186, 255, 0.12);
  backdrop-filter: blur(3px);
  z-index: 2;
}

.lens-rim {
  position: absolute;
  top: 8px;
  left: 10px;
  width: 152px;
  height: 152px;
  border-radius: 50%;
  border: 12px solid rgba(232, 238, 255, 0.94);
  background: transparent;
  box-shadow:
    0 0 0 3px rgba(143, 186, 255, 0.14),
    0 18px 34px rgba(0, 0, 0, 0.38),
    inset 0 0 18px rgba(255, 255, 255, 0.1);
  z-index: 4;
}

.lens-rim::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 3px solid rgba(17, 29, 47, 0.95);
  opacity: 0.86;
}

.lens-shine {
  position: absolute;
  top: 35px;
  left: 56px;
  width: 24px;
  height: 68px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.03));
  transform: rotate(31deg);
  opacity: 0.64;
  z-index: 5;
  animation: lensGlint 3.2s ease-in-out infinite;
}

.magnifier-handle {
  position: absolute;
  top: 136px;
  left: 135px;
  width: 96px;
  height: 20px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 45%),
    linear-gradient(135deg, #7b0711 0%, #3f050b 46%, #180206 100%);
  transform: rotate(43deg);
  transform-origin: left center;
  box-shadow:
    inset 2px 2px 7px rgba(255, 255, 255, 0.08),
    inset -5px -5px 12px rgba(0, 0, 0, 0.5),
    0 10px 18px rgba(0, 0, 0, 0.38);
  z-index: 1;
}

.blood-contact {
  position: absolute;
  top: 134px;
  left: 74px;
  width: 30px;
  height: 20px;
  border-radius: 50% 50% 45% 55%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 120, 132, 0.48), transparent 18%),
    linear-gradient(145deg, #f0182d, #960713 62%, #480006);
  box-shadow:
    inset -7px -7px 10px rgba(35, 0, 4, 0.5),
    0 0 18px rgba(227, 0, 27, 0.26);
  z-index: 6;
  animation: bloodContactPulse 2.9s ease-in-out infinite;
}

.blood-contact::before,
.blood-contact::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: linear-gradient(180deg, #d40c1d, #690008 76%, transparent);
  transform-origin: top center;
  opacity: 0.78;
}

.blood-contact::before {
  top: 13px;
  left: 10px;
  width: 8px;
  height: 36px;
  animation: slowBloodStretch 2.9s ease-in-out infinite;
}

.blood-contact::after {
  top: 12px;
  left: 21px;
  width: 5px;
  height: 24px;
  animation: slowBloodStretch 2.9s ease-in-out infinite 0.8s;
}

.drip {
  position: absolute;
  border-radius: 55% 55% 67% 67% / 45% 45% 78% 78%;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 139, 148, 0.58), transparent 18%),
    linear-gradient(160deg, #f0182d, #940713 62%, #470006);
  box-shadow:
    inset -6px -8px 12px rgba(35, 0, 4, 0.48),
    0 0 18px rgba(227, 0, 27, 0.25);
  z-index: 7;
  opacity: 0;
}

.drip-main {
  top: 164px;
  left: 84px;
  width: 24px;
  height: 34px;
  animation: magnifierBloodDrop 2.9s cubic-bezier(.45, .02, .34, 1) infinite;
}

.drip-small {
  top: 157px;
  left: 111px;
  width: 14px;
  height: 21px;
  animation: magnifierBloodDropSmall 2.9s cubic-bezier(.45, .02, .34, 1) infinite 1.05s;
}

.blood-puddle {
  position: absolute;
  top: 274px;
  left: 50%;
  width: 112px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 38% 45%, rgba(238, 24, 39, 0.82), transparent 24%),
    radial-gradient(ellipse at center, rgba(169, 8, 20, 0.84), rgba(74, 0, 8, 0.82) 60%, transparent 74%);
  filter: blur(0.25px);
  opacity: 0.52;
  animation: magnifierPuddle 2.9s ease-in-out infinite;
}

.loader-ripple {
  position: absolute;
  top: 266px;
  left: 50%;
  width: 66px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1px solid rgba(227, 0, 27, 0.35);
  opacity: 0;
  animation: redRipple 2.9s ease-out infinite;
}

.blood-loading-text {
  position: absolute;
  left: 50%;
  top: 316px;
  width: 100%;
  transform: translateX(-50%);
  text-align: center;
  color: #ffd8dc;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(227, 0, 27, 0.3);
  animation: textFlicker 2.4s ease-in-out infinite;
}

@keyframes magnifierFloat {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  48% { transform: translateX(-50%) translateY(8px) rotate(1.5deg); }
}

@keyframes lensGlint {
  0%, 100% { opacity: 0.48; transform: rotate(31deg) translateY(0); }
  42% { opacity: 0.82; transform: rotate(31deg) translateY(7px); }
  68% { opacity: 0.58; }
}

@keyframes bloodContactPulse {
  0%, 100% { transform: scale(0.96); filter: saturate(0.94); }
  45% { transform: scale(1.08, 1.02); filter: saturate(1.15); }
}

@keyframes slowBloodStretch {
  0%, 18% { transform: scaleY(0.32); opacity: 0.32; }
  42% { transform: scaleY(0.98); opacity: 0.92; }
  64% { transform: scaleY(0.68); opacity: 0.66; }
  100% { transform: scaleY(0.28); opacity: 0.3; }
}

@keyframes magnifierBloodDrop {
  0%, 22% { opacity: 0; transform: translateY(-8px) scale(0.55); }
  30% { opacity: 1; transform: translateY(0) scale(0.82); }
  56% { opacity: 1; transform: translateY(74px) scale(1); }
  72% { opacity: 0.9; transform: translateY(101px) scale(0.95, 0.4); }
  100% { opacity: 0; transform: translateY(112px) scale(1.35, 0.16); }
}

@keyframes magnifierBloodDropSmall {
  0%, 45% { opacity: 0; transform: translateY(-5px) scale(0.42); }
  56% { opacity: 0.96; transform: translateY(11px) scale(0.72); }
  80% { opacity: 0.78; transform: translateY(86px) scale(0.9, 0.45); }
  100% { opacity: 0; transform: translateY(99px) scale(1.14, 0.16); }
}

@keyframes magnifierPuddle {
  0%, 24% { opacity: 0.36; transform: translateX(-50%) scale(0.72, 0.62); }
  57% { opacity: 0.92; transform: translateX(-50%) scale(1.05, 0.9); }
  100% { opacity: 0.54; transform: translateX(-50%) scale(1.18, 0.68); }
}

@keyframes redRipple {
  0%, 58% { opacity: 0; transform: translateX(-50%) scale(0.45, 0.45); }
  70% { opacity: 0.55; transform: translateX(-50%) scale(0.82, 0.65); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.45, 0.9); }
}

@keyframes textFlicker {
  0%, 100% { opacity: 0.72; }
  44% { opacity: 1; }
  56% { opacity: 0.58; }
  72% { opacity: 0.96; }
}

/* Reduced motion is respected for accessibility */
@media (prefers-reduced-motion: reduce) {
  .magnifier-wrap,
  .lens-shine,
  .blood-contact,
  .blood-contact::before,
  .blood-contact::after,
  .drip,
  .blood-puddle,
  .loader-ripple,
  .blood-loading-text {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .brand {
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .blood-button {
    width: 100%;
  }
}

/* Actual PNG logo inside the circle */
.mark img {
  width: 82%;
  height: 82%;
  max-width: 82%;
  max-height: 82%;
  object-fit: contain;
  display: block;
}

/* Keep native dropdown menus readable on dark theme */
.select option {
  color: #ffffff;
  background-color: var(--field);
}
