/* assets/css/base.css */

/* =========================
   ROOT / THEME
========================= */

:root {
  color-scheme: dark;

  --bg-deep: #050510;
  --bg-card: rgba(14, 13, 30, 0.92);
  --bg-card-soft: rgba(18, 17, 38, 0.76);

  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.1);
  --line-hover: rgba(143, 92, 255, 0.32);

  --text: #ede8ff;
  --text-soft: #d8d1f0;
  --text-dim: #9e95c7;

  --purple: #9060ff;
  --purple-deep: #5a32b8;
  --purple-soft: #b08cff;

  --blue: #5cb8ff;
  --green: #6eeaa7;
  --red: #ff6b8a;
  --yellow: #ffd166;

  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 28px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.46), 0 0 54px rgba(143, 92, 255, 0.045);
  --shadow-card-strong: 0 16px 44px rgba(0, 0, 0, 0.5), 0 0 70px rgba(143, 92, 255, 0.08);
  --shadow-glow: 0 0 26px rgba(143, 92, 255, 0.16);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --focus: rgba(176, 140, 255, 0.78);
}

/* =========================
   RESET SAFE
========================= */

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

* {
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  min-height: 100%;
  font-family: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 80% 10%, rgba(143, 92, 255, 0.11), transparent 68%),
    radial-gradient(ellipse 50% 40% at 15% 85%, rgba(92, 184, 255, 0.06), transparent 66%),
    radial-gradient(ellipse 45% 45% at 50% 50%, rgba(215, 140, 255, 0.035), transparent 70%);
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

::selection {
  background: rgba(143, 92, 255, 0.35);
  color: #fff;
}

/* =========================
   UTILITIES
========================= */

.hidden {
  display: none !important;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.accent-purple {
  color: var(--purple-soft);
}

.accent-blue {
  color: var(--blue);
}

.accent-green {
  color: var(--green);
}

.accent-red {
  color: var(--red);
}

/* =========================
   BUTTONS
========================= */

.btn,
.code-btn,
.ghost-btn,
.mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition:
    transform 0.18s var(--ease),
    background 0.18s var(--ease),
    color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    opacity 0.18s var(--ease);
}

.btn,
.code-btn {
  padding: 13px 18px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  box-shadow: 0 6px 18px rgba(143, 92, 255, 0.18);
}

.btn:hover,
.code-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(143, 92, 255, 0.22);
}

.btn:active,
.code-btn:active,
.ghost-btn:active,
.mini:active {
  transform: translateY(0);
}

.btn.secondary {
  color: #f2edff;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(143, 92, 255, 0.24);
  box-shadow: none;
}

.ghost-btn {
  padding: 10px 16px;
  color: #fff;
  background: rgba(143, 92, 255, 0.08);
  border-color: rgba(143, 92, 255, 0.2);
  font-weight: 700;
}

.ghost-btn:hover {
  background: rgba(143, 92, 255, 0.13);
  border-color: rgba(143, 92, 255, 0.34);
}

.mini {
  padding: 8px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

.mini:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.08);
}

.mini.danger {
  color: var(--red);
  background: rgba(255, 107, 138, 0.1);
  border-color: rgba(255, 107, 138, 0.12);
}

.mini.danger:hover {
  background: rgba(255, 107, 138, 0.15);
  border-color: rgba(255, 107, 138, 0.24);
}

.btn:focus-visible,
.code-btn:focus-visible,
.ghost-btn:focus-visible,
.mini:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* =========================
   FORMS
========================= */

.input,
.textarea,
.select {
  width: 100%;
  min-width: 0;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #fff;
  outline: none;
  transition:
    border-color 0.18s var(--ease),
    background 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(176, 140, 255, 0.48);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(143, 92, 255, 0.1);
}

.input::placeholder,
.textarea::placeholder {
  color: rgba(158, 149, 199, 0.72);
}

.textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  appearance: auto;
}

.select option {
  background: #12112a;
  color: #fff;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: #c8c0e4;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-hint {
  margin: -2px 0 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* =========================
   PANELS / CARDS
========================= */

.card-panel {
  min-width: 0;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.reader {
  display: none;
  margin-top: 16px;
}

.reader.active {
  display: block;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.section-header,
.page-header,
.reader-top,
.staff-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* =========================
   SEARCH
========================= */

.search-bar {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.search-bar input {
  width: 100%;
  padding: 12px 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #fff;
  outline: none;
  transition:
    border-color 0.18s var(--ease),
    background 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.search-bar input:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.search-bar input:focus {
  border-color: rgba(176, 140, 255, 0.48);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(143, 92, 255, 0.1);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
}

.search-clear.visible {
  display: inline-flex;
}

.search-clear:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* =========================
   TOAST
========================= */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  box-shadow: var(--shadow-card-strong);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.22s var(--ease),
    transform 0.22s var(--ease);
  overflow-wrap: anywhere;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   MODALS / OVERLAYS
========================= */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 5, 16, 0.72);
}

.overlay.open {
  display: flex;
}

.modal {
  width: min(420px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(18, 16, 40, 0.98), rgba(8, 8, 18, 0.99));
  box-shadow: var(--shadow-card-strong);
}

.modal h3 {
  margin-bottom: 8px;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1.2;
}

.modal p {
  margin-bottom: 16px;
  color: var(--text-dim);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.candidature-editor-modal {
  width: min(680px, 100%);
}

/* =========================
   SCROLLBARS
========================= */

* {
  scrollbar-color: rgba(176, 140, 255, 0.36) rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
  background: rgba(176, 140, 255, 0.28);
  border-radius: 999px;
  border: 2px solid rgba(5, 5, 16, 0.65);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(176, 140, 255, 0.42);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 960px) {
  .section-header,
  .page-header,
  .reader-top,
  .staff-top,
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  .ghost-btn,
  .code-btn {
    width: 100%;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .card-panel {
    padding: 22px;
  }

  .search-bar {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn,
  .modal-actions .ghost-btn,
  .modal-actions .code-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .card-panel {
    padding: 18px;
    border-radius: var(--radius-md);
  }

  .modal {
    padding: 22px;
    border-radius: var(--radius-md);
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}

/* =========================
   REDUCED MOTION / ACCESSIBILITY
========================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
