/*
 * Bullhorn Jobs Plugin - Stylesheet
 * Scoped under .bh-jobs-root and .bh-modal-overlay to avoid theme conflicts.
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=JetBrains+Mono:wght@300&display=swap");

/* CSS Custom Properties */
:root {
  --bh-primary: #ef4500;
  --bh-primary-hover: #d63c00;
  --bh-primary-dim: rgba(239, 69, 0, 0.15);
  --bh-bg: #080808;
  --bh-surface: #0e0e0e;
  --bh-surface-2: #161616;
  --bh-border: rgba(255, 255, 255, 0.07);
  --bh-border-hover: rgba(239, 69, 0, 0.35);
  --bh-text: #f0f0f0;
  --bh-muted: #8b8b8b;
  --bh-muted-2: #555;
  --bh-font-ui: "Inter", sans-serif;
  --bh-font-meta: "JetBrains Mono", monospace;
  --bh-title-font-size: 18px;
  --bh-title-font-weight: 700;
  --bh-title-line-height: 1.4;
  --bh-description-font-size: 14px;
  --bh-description-font-weight: 400;
  --bh-description-line-height: 1.7;
  --bh-meta-font-size: 11px;
  --bh-meta-font-weight: 300;
  --bh-meta-line-height: 1.4;
  --bh-meta-letter-spacing: 0.1em;
  --bh-ui-font-size: 14px;
  --bh-ui-font-weight: 400;
  --bh-ui-line-height: 1.5;
  --bh-radius: 0;
  --bh-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --bh-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
}

/* Shared Typography */
.bh-jobs-root,
.bh-modal-overlay,
.bh-toast-container {
  font-family: var(--bh-font-ui);
  font-size: var(--bh-ui-font-size);
  font-weight: var(--bh-ui-font-weight);
  line-height: var(--bh-ui-line-height);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bh-jobs-root *,
.bh-jobs-root *::before,
.bh-jobs-root *::after,
.bh-modal-overlay *,
.bh-modal-overlay *::before,
.bh-modal-overlay *::after {
  box-sizing: border-box;
}

.bh-jobs-root button,
.bh-jobs-root input,
.bh-jobs-root select,
.bh-jobs-root textarea,
.bh-modal-overlay button,
.bh-modal-overlay input,
.bh-modal-overlay select,
.bh-modal-overlay textarea {
  font-family: var(--bh-font-ui);
  font-size: var(--bh-ui-font-size);
  font-weight: var(--bh-ui-font-weight);
  line-height: var(--bh-ui-line-height);
}

.bh-job-card__title,
.bh-modal__title {
  font-family: var(--bh-font-ui);
  font-size: var(--bh-title-font-size);
  font-weight: var(--bh-title-font-weight);
  line-height: var(--bh-title-line-height);
}

.bh-job-description,
.bh-job-description p,
.bh-job-description li,
.bh-job-description td,
.bh-job-description th,
.bh-job-description div,
.bh-job-description span {
  font-family: var(--bh-font-ui);
  font-size: var(--bh-description-font-size);
  font-weight: var(--bh-description-font-weight);
  line-height: var(--bh-description-line-height);
}

.bh-job-card__meta,
.bh-meta-item {
  font-family: var(--bh-font-meta);
  font-size: var(--bh-meta-font-size);
  font-weight: var(--bh-meta-font-weight);
  line-height: var(--bh-meta-line-height);
  letter-spacing: var(--bh-meta-letter-spacing);
  text-transform: uppercase;
}

/* Root Container */
.bh-jobs-root {
  background: var(--bh-bg);
  color: var(--bh-text);
  padding: 0;
  width: 100%;
}

/* Controls Row */
.bh-jobs-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 32px;
}

.bh-jobs-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.bh-icon-search {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--bh-muted);
  pointer-events: none;
  flex-shrink: 0;
  z-index: 1;
  transition: color var(--bh-transition);
}

.bh-jobs-root .bh-search-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  background: var(--bh-surface);
  border: 1px solid var(--bh-border);
  color: var(--bh-text);
  padding: 11px 16px 11px 46px;
  outline: none;
  transition: border-color var(--bh-transition), background var(--bh-transition), box-shadow var(--bh-transition);
  appearance: none;
  -webkit-appearance: none;
  border-radius: var(--bh-radius);
  box-shadow: none;
  text-indent: 0;
}

.bh-jobs-root .bh-search-input::-webkit-search-decoration,
.bh-jobs-root .bh-search-input::-webkit-search-cancel-button,
.bh-jobs-root .bh-search-input::-webkit-search-results-button,
.bh-jobs-root .bh-search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

.bh-jobs-root .bh-search-input::placeholder {
  color: var(--bh-muted);
  font-family: var(--bh-font-ui);
  font-size: var(--bh-ui-font-size);
  font-weight: var(--bh-ui-font-weight);
  line-height: var(--bh-ui-line-height);
  opacity: 1;
}

.bh-jobs-root .bh-search-input:focus {
  border-color: var(--bh-primary);
  background: var(--bh-surface-2);
  box-shadow: 0 0 0 1px rgba(239, 69, 0, 0.12);
}

.bh-jobs-search-wrap:focus-within .bh-icon-search {
  color: var(--bh-primary);
}

.bh-dropdown-wrap {
  position: relative;
  min-width: 0;
}

.bh-dropdown-wrap::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--bh-muted);
  border-bottom: 1px solid var(--bh-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  transition: border-color var(--bh-transition);
}

.bh-dropdown-wrap:focus-within::after {
  border-color: var(--bh-primary);
}

.bh-filter-select {
  width: 100%;
  height: 44px;
  background: var(--bh-surface);
  border: 1px solid var(--bh-border);
  color: var(--bh-text);
  padding: 11px 38px 11px 14px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--bh-transition), background var(--bh-transition);
  appearance: none;
  -webkit-appearance: none;
  border-radius: var(--bh-radius);
}

.bh-filter-select:hover,
.bh-filter-select:focus {
  border-color: var(--bh-primary);
  background: var(--bh-surface-2);
}

.bh-filter-select option {
  background: var(--bh-surface);
  color: var(--bh-text);
}

/* Meta Line */
.bh-jobs-meta {
  color: var(--bh-muted);
  margin-bottom: 24px;
  min-height: 18px;
}

/* Loading and Empty States */
.bh-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  justify-content: center;
  color: var(--bh-muted);
}

.bh-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--bh-border);
  border-top-color: var(--bh-primary);
  border-radius: 50%;
  animation: bh-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes bh-spin {
  to { transform: rotate(360deg); }
}

.bh-no-jobs {
  text-align: center;
  padding: 80px 20px;
  color: var(--bh-muted);
}

.bh-no-jobs strong {
  display: block;
  color: var(--bh-text);
  font-family: var(--bh-font-ui);
  font-size: var(--bh-ui-font-size);
  font-weight: var(--bh-ui-font-weight);
  line-height: var(--bh-ui-line-height);
  margin-bottom: 8px;
}

/* Job Card */
.bh-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bh-job-card {
  border: 1px solid var(--bh-border);
  border-top: none;
  transition: border-color var(--bh-transition);
  animation: bh-fadeIn 0.3s ease both;
}

.bh-job-card:first-child {
  border-top: 1px solid var(--bh-border);
}

.bh-job-card:hover {
  border-color: var(--bh-border-hover);
}

.bh-job-card:hover + .bh-job-card {
  border-top-color: var(--bh-border-hover);
}

@keyframes bh-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.bh-job-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px;
  cursor: pointer;
  user-select: none;
  outline: none;
}

.bh-job-card__header:focus-visible {
  outline: 2px solid var(--bh-primary);
  outline-offset: -2px;
}

.bh-job-card__info {
  flex: 1;
  min-width: 0;
}

.bh-job-card__title {
  margin: 0 0 8px;
  color: var(--bh-text);
  letter-spacing: 0;
  transition: color var(--bh-transition);
}

.bh-job-card:hover .bh-job-card__title,
.bh-job-card__header:focus-visible .bh-job-card__title {
  color: var(--bh-primary);
}

.bh-job-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.bh-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--bh-muted);
}

.bh-meta-category {
  color: var(--bh-primary);
}

.bh-meta-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.bh-job-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.bh-btn-copy {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--bh-muted);
  transition: color var(--bh-transition);
  line-height: 0;
}

.bh-btn-copy:hover {
  color: var(--bh-primary);
}

.bh-btn-copy svg {
  width: 15px;
  height: 15px;
  display: block;
}

.bh-btn-apply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bh-primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  transition: background var(--bh-transition);
  white-space: nowrap;
}

.bh-btn-apply:hover {
  background: var(--bh-primary-hover);
}

.bh-btn-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.bh-expand-icon {
  color: var(--bh-muted);
  line-height: 0;
  flex-shrink: 0;
}

.bh-chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--bh-transition);
  display: block;
}

.bh-job-card.is-expanded .bh-chevron {
  transform: rotate(180deg);
}

.bh-job-card__body {
  padding: 0 28px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 0;
  animation: bh-fadeIn 0.2s ease;
}

.bh-job-description {
  color: var(--bh-muted);
  padding-top: 20px;
}

.bh-job-description p {
  margin: 0 0 12px;
}

.bh-job-description ul,
.bh-job-description ol {
  padding-left: 20px;
  margin: 0 0 12px;
}

.bh-job-description li {
  margin-bottom: 4px;
}

.bh-job-description strong,
.bh-job-description b,
.bh-job-description h1,
.bh-job-description h2,
.bh-job-description h3,
.bh-job-description h4,
.bh-job-description h5,
.bh-job-description h6 {
  color: var(--bh-text);
}

.bh-job-description h1,
.bh-job-description h2,
.bh-job-description h3,
.bh-job-description h4,
.bh-job-description h5,
.bh-job-description h6 {
  font-family: var(--bh-font-ui);
  font-size: var(--bh-description-font-size);
  font-weight: var(--bh-description-font-weight);
  line-height: var(--bh-description-line-height);
  margin: 16px 0 8px;
}

.bh-btn-apply--inline {
  margin-top: 20px;
  padding: 12px 24px;
}

/* Pagination */
.bh-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.bh-page-btn {
  background: transparent;
  border: 1px solid var(--bh-border);
  color: var(--bh-muted);
  padding: 8px 14px;
  cursor: pointer;
  transition: all var(--bh-transition);
  min-width: 40px;
  text-align: center;
}

.bh-page-btn:hover:not(:disabled) {
  border-color: var(--bh-primary);
  color: var(--bh-primary);
}

.bh-page-btn.active {
  background: var(--bh-primary);
  border-color: var(--bh-primary);
  color: #fff;
}

.bh-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Toast Notifications */
.bh-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.bh-toast {
  background: var(--bh-surface-2);
  border: 1px solid var(--bh-border);
  color: var(--bh-text);
  padding: 12px 18px;
  max-width: 320px;
  box-shadow: var(--bh-shadow);
  animation: bh-toastIn 0.25s ease;
  pointer-events: auto;
}

.bh-toast--success {
  border-left: 3px solid #22c55e;
}

.bh-toast--error {
  border-left: 3px solid var(--bh-primary);
}

@keyframes bh-toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Overlay */
.bh-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: bh-overlayIn 0.2s ease;
}

@keyframes bh-overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bh-modal-overlay[hidden] {
  display: none;
}

.bh-modal {
  position: relative;
  background: var(--bh-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--bh-text);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--bh-shadow), 0 0 60px rgba(239, 69, 0, 0.08);
  animation: bh-modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bh-modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.bh-modal::-webkit-scrollbar {
  width: 4px;
}

.bh-modal::-webkit-scrollbar-track {
  background: transparent;
}

.bh-modal::-webkit-scrollbar-thumb {
  background: var(--bh-border);
}

.bh-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--bh-muted);
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  transition: color var(--bh-transition);
  z-index: 2;
}

.bh-modal__close:hover {
  color: var(--bh-text);
}

.bh-modal__close svg {
  width: 18px;
  height: 18px;
  display: block;
}

.bh-modal__inner {
  padding: 36px;
}

.bh-modal__success {
  text-align: center;
  padding: 16px 0;
}

.bh-success-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  color: #22c55e;
}

.bh-success-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bh-modal__success-title {
  color: var(--bh-text);
  margin: 0 0 10px;
}

.bh-modal__success-message {
  color: var(--bh-muted);
  margin: 0 0 24px;
}

.bh-modal__eyebrow {
  color: var(--bh-primary);
  margin: 0 0 8px;
}

.bh-modal__title {
  color: var(--bh-text);
  margin: 0 0 28px;
  padding-right: 24px;
  letter-spacing: 0;
}

/* Apply Form */
.bh-apply-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.bh-form-row {
  display: flex;
  gap: 16px;
}

.bh-form-row--2col > * {
  flex: 1 1 0;
  min-width: 0;
}

.bh-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bh-label {
  color: var(--bh-muted);
  display: block;
}

.bh-required {
  color: var(--bh-primary);
  margin-left: 3px;
}

.bh-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--bh-border);
  color: var(--bh-text);
  padding: 8px 0;
  outline: none;
  transition: border-color var(--bh-transition);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  background-color: transparent;
}

.bh-input:focus {
  border-bottom-color: var(--bh-primary);
}

.bh-input::placeholder {
  color: var(--bh-muted-2);
  font-family: var(--bh-font-ui);
  font-size: var(--bh-ui-font-size);
  font-weight: var(--bh-ui-font-weight);
  line-height: var(--bh-ui-line-height);
}

.bh-file-label {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--bh-border);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color var(--bh-transition);
  color: var(--bh-muted);
  overflow: hidden;
}

.bh-file-label:hover {
  border-color: rgba(239, 69, 0, 0.4);
}

.bh-file-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.bh-file-input {
  display: none;
}

#bh-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bh-form-error {
  color: #f87171;
  margin: 0;
  padding: 10px 14px;
  background: rgba(248, 113, 113, 0.08);
  border-left: 2px solid #f87171;
}

.bh-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bh-primary);
  color: #fff;
  border: none;
  padding: 15px 28px;
  cursor: pointer;
  transition: background var(--bh-transition), opacity var(--bh-transition);
  width: 100%;
  margin-top: 6px;
}

.bh-btn-primary:hover:not(:disabled) {
  background: var(--bh-primary-hover);
}

.bh-btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
}

.bh-spinner-icon {
  width: 16px;
  height: 16px;
  animation: bh-spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .bh-job-card__header {
    padding: 18px;
    flex-wrap: wrap;
  }

  .bh-job-card__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .bh-job-card__body {
    padding: 0 18px 20px;
  }

  .bh-form-row--2col {
    flex-direction: column;
    gap: 18px;
  }

  .bh-modal__inner {
    padding: 24px 20px;
  }

  .bh-jobs-controls {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .bh-jobs-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bh-jobs-search-wrap {
    grid-column: 1 / -1;
  }
}

@media (max-width: 400px) {
  .bh-btn-apply {
    padding: 8px 12px;
  }
}

/* Elementor compatibility */
.elementor-widget-bullhorn_jobs .bh-jobs-root {
  padding: 0;
}
