/* ===============================
   Theme Tokens (Dark)
   =============================== */
:root {
  --bg-color: #0f1a32;
  --card-bg: #142247;
  --text-color: #e7e9ee;
  --primary-color: #e0f780;      /* focus/accent */
  --border-color: rgba(255, 255, 255, 0.65); /* default field border (white) */
  --input-bg: #12204a;
  --shadow-1: 0 10px 30px rgba(0,0,0,.5);
  --muted: #9aa7bd;
}

/* ===============================
   Base + Layout
   =============================== */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  padding: 20px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  background: var(--bg-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.form-container {
  width: 100%;
  max-width: 760px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: var(--shadow-1);
}

/* ===============================
   Header
   =============================== */
header { text-align: center; margin-bottom: 24px; }
.logo { width: 150px; height: auto; margin-bottom: 8px; }
h1 { margin: 0 0 6px; font-size: 1.75rem; font-weight: 700; }

#status {
  text-align: center;
  margin: 6px 0 0;
  color: var(--primary-color);
  min-height: 1.2em;
  font-weight: 600;
}

/* ===============================
   Sections & Labels
   =============================== */
.form-section { margin-bottom: 20px; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.required::after {
  content: " *";
  color: var(--primary-color);
}

/* ===============================
   Inputs (NO auto-red borders)
   =============================== */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 12px;
  background: var(--input-bg);
  color: var(--text-color);
  border: 1.5px solid var(--border-color);   /* default white border */
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

/* Placeholder + focus */
input::placeholder,
textarea::placeholder { color: rgba(231,233,238,.55); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-color);        /* accent only on focus */
  outline: none;
  box-shadow: 0 0 0 2px rgba(224,247,128,.25);
}

/* Remove “always-on invalid red” – keep validation for submit messages only */
input:invalid[required],
select:invalid[required],
textarea:invalid[required] {
  border-color: var(--border-color);
  box-shadow: none;
}

textarea { resize: vertical; min-height: 100px; }

/* ===============================
   Checkbox Group
   =============================== */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}
.checkbox-group input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary-color);
}

/* Helper text */
.example-text,
.ai-note {
  margin: 6px 0 10px;
  font-size: .88rem;
  color: var(--muted);
}

/* ===============================
   AI JD controls
   =============================== */
.ai-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.ai-input-group input[type="text"] { flex: 1; }

.ai-actions-group {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* Back-compat with older layout bits */
.jd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .75rem;
}
.jd-label { flex: 1; }
.jd-actions { flex-shrink: 0; margin-left: .5rem; }

/* ===============================
   Buttons
   =============================== */
button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  padding: 11px 16px;
  transition: transform .06s ease, background-color .2s ease, opacity .2s ease;
}

.primary-button {
  background: var(--primary-color);
  color: #0c1226;
}
.primary-button:hover:not(:disabled) { background: #cfe86d; }
.primary-button:active:not(:disabled) { transform: translateY(1px); }

.secondary-button {
  background: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}
.secondary-button:hover:not(:disabled) { background: #21386f; }
.secondary-button:active:not(:disabled) { transform: translateY(1px); }

.primary-button:disabled,
.secondary-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Submit full-width */
#submitFormBtn {
  width: 100%;
  background: var(--primary-color);
  color: #0c1226;
  font-size: 1.05rem;
  margin-top: 12px;
}
#submitFormBtn:hover:not(:disabled) { background: #cfe86d; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===============================
   Responsive
   =============================== */
@media (max-width: 640px) {
  body { padding: 14px; }
  .form-container { padding: 22px 18px; }
  h1 { font-size: 1.45rem; }
  .ai-input-group { flex-direction: column; }
  .jd-row { flex-direction: column; align-items: flex-start; }
}
