/* Job Offer Widget Styles */
.job-widget {
  position: relative;
  width: var(--side-widget-trigger-width, 48px);
  height: var(--side-widget-trigger-height, 165px);
  z-index: 1;
}

/* Trigger Button */
.job-widget-trigger {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  background-color: #ba283c;
  /* Elegant deep red */
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: 0;
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 2px 0 8px rgba(47, 67, 90, 0.15);
  transition: background-color 0.2s;

  /* Positioning inside the wrapper */
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Hover on desktop */
@media (hover: hover) and (pointer: fine) {
  .job-widget:not(.is-open) .job-widget-trigger:hover {
    background-color: #9c1f30;
  }
}

.job-widget.is-open .job-widget-trigger {
  opacity: 0;
  pointer-events: none;
}

/* Modal Backdrop */
.job-widget-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(18, 29, 43, 0.6);
  /* Dark, premium brand-compatible overlay */
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* Anchor to the top instead of vertical center */
  padding: var(--container-padding);
  padding-top: calc(var(--header-height-desktop, 90px) + 24px);
  /* Drop just beneath the header */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: pointer;
  /* To indicate you can click outside */
}

.job-widget-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* Modal Panel */
.job-widget-panel {
  position: relative;
  width: 100%;
  max-width: 850px;
  /* ~50% wider desktop modal */
  background-color: #fdfdfc;
  /* Very subtle warm white */
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(186, 40, 60, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - (var(--container-padding) * 2));
  transform: scale(0.97) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  cursor: default;
  /* Reset cursor over panel */
}

.job-widget-backdrop.is-open .job-widget-panel {
  transform: scale(1) translateY(0);
}

.job-widget-header {
  padding: 20px 24px;
  background-color: #ba283c;
  /* Deep red header */
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.job-widget-header h3 {
  font-size: 1.125rem;
  margin: 0;
  color: var(--white);
  line-height: 1.4;
  font-family: var(--font-heading);
}

.job-widget-headline-accent {
  color: var(--brand-caramel);
}

.job-widget-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.job-widget-close:hover,
.job-widget-close:focus {
  background-color: rgba(255, 255, 255, 0.3);
  outline: none;
}

.job-widget-close svg {
  width: 24px;
  height: 24px;
}

.job-widget-body {
  padding: 32px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0; /* Ensures flex container allows inner overflow */
  -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
  overscroll-behavior: contain; /* Prevents scroll chaining and snapping to body */
}

.job-widget-role {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-top: 0;
  margin-bottom: 12px;
}

.job-widget-intro {
  font-size: 0.90rem;
  line-height: 1.4;
  color: var(--text-main);
  margin-bottom: 10px;
}

.job-widget-section {
  margin-bottom: 20px;
  background: var(--white);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(47, 67, 90, 0.05);
}

.job-widget-section-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--brand-dark);
  margin-bottom: 12px;
}

.job-widget-list {
  padding-left: 0;
  margin: 0;
  list-style: none;
  /* We use custom bullets */
}

.job-widget-list li {
  position: relative;
  margin-bottom: 0px;
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.job-widget-list li::before {
  content: "•";
  color: #ba283c;
  position: absolute;
  left: 0;
  top: -1px;
  font-size: 1.2rem;
}

.job-widget-list li:last-child {
  margin-bottom: 0;
}

.job-widget-cta-area {
  margin-top: 24px;
  padding-top: 4px;
}

.job-widget-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background-color: #ba283c;
  color: var(--white);
}

.job-widget-cta:hover {
  background-color: #9c1f30;
  color: var(--white);
}

.cta-icon {
  flex-shrink: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .job-widget-backdrop {
    display: block;
    padding: 0;
  }

  .job-widget-panel {
    position: fixed;
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: 12px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    min-height: 0;
    margin: 0;
    border-radius: 18px;
    display: grid;
    grid-template-rows: auto 1fr;
    transform: translateY(12px);
  }

  .job-widget-backdrop.is-open .job-widget-panel {
    transform: translateY(0);
  }

  .job-widget-header {
    padding: 16px;
    position: relative;
    top: auto;
    z-index: 1;
  }

  .job-widget-body {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding: 24px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {

  .job-widget-backdrop,
  .job-widget-panel {
    transition: none;
  }
}