@import './variables.css';

/* ─────────────────────────────────────────────────────────────────────────────
   Pages — layout and styles specific to each page/view
───────────────────────────────────────────────────────────────────────────── */

/* ══ Page Container (shared) ══════════════════════════════════════════════ */

.page {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeSlideIn var(--transition-slow);
}

.page--active { display: flex; }

.page__body {
  padding: var(--space-7) var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page__eyebrow {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.page__heading {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.25;
  margin-bottom: var(--space-2);
}

.page__subheading {
  font-size: var(--font-size-sm) + 1px;
  color: var(--color-text-secondary);
  line-height: 1.65;
  margin-bottom: var(--space-7);
}

.page__hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: var(--space-1);
}

/* ══ Page 1 — Job Detail ══════════════════════════════════════════════════ */

/* Hero banner */
.job-hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-mid) 100%);
  padding: var(--space-7) var(--space-5) var(--space-8);
  color: var(--color-white);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.job-hero__bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.job-hero__bubble--1 { width: 180px; height: 180px; top: -50px;  right: -40px; }
.job-hero__bubble--2 { width: 120px; height: 120px; bottom: -40px; left: -20px; }

.job-hero__company {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.job-hero__logo {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--color-white);
  flex-shrink: 0;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.job-hero__logo img { width: 100%; height: 100%; object-fit: contain; }

.job-hero__company-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  opacity: 0.88;
}

.job-hero__title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.job-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  position: relative;
  z-index: 1;
}

/* Job body */
.job-body { padding: var(--space-5); flex: 1; }

.job-body__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.job-body__section { margin-bottom: var(--space-5); }

.job-body__section-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2) + 2px;
}

.job-desc {
  font-size: var(--font-size-sm) + 1px;
  line-height: 1.75;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

.job-desc--expanded { -webkit-line-clamp: unset; }

/* ── Rich HTML inside job description ── */
.job-desc p  { margin-bottom: 10px; }
.job-desc p:last-child { margin-bottom: 0; }
.job-desc b,
.job-desc strong { font-weight: 700; color: var(--color-text-primary); }
.job-desc br { line-height: 1.8; }
.job-desc ul,
.job-desc ol { padding-left: 18px; margin-bottom: 10px; }
.job-desc li { margin-bottom: 4px; }
.job-desc a  { color: var(--color-accent); text-decoration: underline; word-break: break-all; }

.job-desc__toggle {
  display: inline-block;
  margin-top: var(--space-1) + 2px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-accent);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* Skeleton */
.job-skeleton { flex: 1; }
.job-skeleton__hero { height: 220px; }
.job-skeleton__body { padding: var(--space-5); }

/* ══ Page 2 — Mobile Input ════════════════════════════════════════════════ */

/* Nothing extra — uses generic .page__body + form components */

/* ══ Page 3 — OTP Verify ══════════════════════════════════════════════════ */

.otp-mobile-chip {
  background: var(--color-primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-7);
}

.otp-mobile-chip__number {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-primary);
}

.otp-mobile-chip__change {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-accent);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity var(--transition-fast);
}

.otp-mobile-chip__change:hover { opacity: 1; }

.otp-timer {
  margin-top: var(--space-4);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.otp-timer__count { color: var(--color-primary-mid); font-weight: 700; }

.otp-timer__resend {
  display: none;
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-family);
}

.otp-timer__resend--visible { display: inline; }

/* ══ Locality Search (Register page) ═════════════════════════════════════ */

.locality-search {
  position: relative;
}

.locality-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-white);
  border: 2px solid var(--color-primary-mid);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  list-style: none;
  margin: 0;
  padding: 0;
  box-shadow: var(--shadow-md);
}

.locality-results--visible { display: block; }

.locality-results__item {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
  line-height: 1.4;
}

.locality-results__item:last-child { border-bottom: none; }

.locality-results__item:hover,
.locality-results__item--active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.locality-results__city {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: 400;
}

.locality-results__empty {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
}

/* ══ Page 4 — Job Application Form ═══════════════════════════════════════ */

.form-question {
  margin-bottom: var(--space-7);
}

.form-question__label {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.45;
  margin-bottom: var(--space-3);
}

.form-question__required {
  color: var(--color-error);
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.choice-chip {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  background: var(--color-white);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  line-height: 1.5;
}

.choice-chip:hover {
  border-color: var(--color-primary-mid);
  color: var(--color-primary);
}

.choice-chip--selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* Multi-select chips (language skills) use the same selected style */
.choice-chip--multi-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* Number / date inputs in screening form */
input[type="number"].input-field,
input[type="date"].input-field {
  -moz-appearance: textfield;
  letter-spacing: normal;
}
input[type="number"].input-field::-webkit-inner-spin-button,
input[type="number"].input-field::-webkit-outer-spin-button {
  opacity: 1;
}

/* ══ Page 5 — Success ═════════════════════════════════════════════════════ */

.result-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  text-align: center;
}

.result-page__icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.result-page__icon--success { background: var(--color-success-light); }
.result-page__icon--error   { background: var(--color-error-light); }
.result-page__icon--info    { background: var(--color-primary-light); }

.result-page__title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2) + 2px;
  line-height: 1.2;
}

.result-page__subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: 1.65;
  max-width: 300px;
}

.result-page__card {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-7);
  width: 100%;
  text-align: left;
}

.result-page__card-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-text-primary);
}

.result-page__card-sub {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
