/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/*
 * Prefer Bootstrap 5 utility classes in markup over adding rules to this file.
 * The rules below predate that preference and are not a precedent to follow.
 * Add a rule only for what utilities cannot express, and say why in a comment.
 * See CLAUDE.md > Important Patterns and Conventions > Frontend Styling.
 */

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Override for select dropdowns to show arrow */
select.chat-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 16px 12px;
  cursor: pointer;
  padding-right: 2.5rem;
}

/* Typewriter visibility - hidden until typing starts */
[data-controller~="typewriter"]:not([data-typed]) {
  opacity: 0;
}

[data-controller~="typewriter"][data-typing] {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

#answer-input {
  flex: 1;
  min-width: 0;
}

#job-finder-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  /* Important for flex children with overflow */
}

/* When showing matched jobs, the intro message should not grow */
#job-finder-content>.chat-messages:has(+.matched-jobs-container) {
  flex: none;
}

.assistant-message {
  justify-content: flex-start;
}

.assistant-message .message-content {
  background: #f3f4f6;
  border-radius: 1rem;
  color: #1f2937;
  display: inline-block;
  max-width: 80%;
  padding: 1rem 1.25rem;
}

.btn-apply {
  background: #3b82f6;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: block;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-apply:active {
  transform: translateY(0);
}

.btn-apply:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Global Body Styling */
body {
  background: #efefef;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
}

/* Full-page chat layout */
body:not(:has(.job-apply-layout)):has(.chat-container) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body:not(:has(.job-apply-layout)):has(.chat-container) turbo-frame {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

/* Combined job detail + chat layout */
body:has(.job-apply-layout) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body:has(.job-apply-layout) .navbar {
  flex-shrink: 0;
}

.job-apply-layout {
  background: #efefef;
  display: flex;
  flex: 1;
  gap: 1rem;
  min-height: 0;
}

@media (min-width: 992px) {
  .job-apply-layout {
    padding: 1rem;
  }
}

.job-apply-details {
  background: #fff;
  border-radius: 8px;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.job-apply-chat {
  background: #fff;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  width: 420px;
}

.job-apply-chat turbo-frame {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.job-apply-chat .chat-container {
  flex: 1;
  margin: 0;
  max-width: none;
  min-height: 0;
  width: 100%;
}

.chat-container {
  background: #fff;
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: 0 auto;
  min-height: 0;
  max-width: 900px;
  width: 100%;
}

.chat-form {
  margin: 0;
}

.chat-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  padding: 1.5rem 2rem;
  position: relative;
  z-index: 1;
}

.chat-header h3 {
  color: #1f2937;
  font-size: 1.25rem;
}

.chat-input {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 1.5rem;
  box-sizing: border-box;
  font-size: 1rem;
  padding: 0.875rem 1.25rem;
  transition: all 0.2s;
  width: 100%;
}

.chat-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

.character-counter {
  color: #6b7280;
  font-size: 0.75rem;
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.character-counter.over-limit {
  color: var(--bs-danger);
}

.chat-input-area {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  padding: 1rem;
}

.chat-input-area:has(#text-input-row:empty) {
  display: none;
}

.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 40vh;
  opacity: 0;
  overflow-y: auto;
  padding: 0 2rem 1.5rem;
}

.option-buttons.visible {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

.option-button {
  background: #fff;
  border: 1.5px solid #3b82f6;
  border-radius: 2rem;
  color: #3b82f6;
  font-size: 0.9375rem;
  padding: 0.5rem 1.25rem;
  transition: all 0.15s ease;
}

.option-button:hover,
.option-button:active {
  background: #3b82f6;
  color: #fff;
}

/* Multi-select: the options sit in their own row alongside the Done submit. */
.option-buttons-multi {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-check:checked + .option-button {
  background: #3b82f6;
  color: #fff;
}

.option-button-done {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.option-button-done:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* .btn sets display, which would otherwise beat the hidden attribute. */
.option-button-done[hidden] {
  display: none;
}

.chat-messages {
  background: #f9fafb;
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  scroll-behavior: smooth;
}

/* Completion link - hidden by default */
.completion-link {
  opacity: 0;
  transition: opacity 0.5s ease-in;
}

.completion-link.visible {
  opacity: 1;
}

/* Company About */
.company-description {
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.7;
  margin: 0;
  max-width: 720px;
}

.company-name {
  color: #1f2937;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

/* Input wrapper - hidden by default, shown by controller */
.input-wrapper {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease-in;
  width: 100%;
}

.input-wrapper.visible {
  opacity: 1;
}

.job-apply-bar {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  bottom: 0;
  left: 0;
  padding: 1rem 1.5rem 0.5rem;
  position: fixed;
  right: 0;
  z-index: 100;
}

body:has(.job-apply-bar) {
  padding-bottom: 5rem;
}

@media (min-width: 992px) {
  .job-apply-bar {
    border-top: none;
    padding: 0;
    position: static;
  }

  body:has(.job-apply-bar) {
    padding-bottom: 0;
  }
}

.job-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.job-card-content {
  flex: 1;
  padding: 1.25rem 1.25rem 0.75rem;
}

.job-card-footer {
  padding: 0.75rem 1.25rem 1.25rem;
}

.job-card-title {
  color: #1f2937;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.75rem;
}

.jobs-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .jobs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.job-meta {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.job-meta-item {
  align-items: center;
  color: #6b7280;
  display: flex;
  font-size: 0.875rem;
  gap: 0.375rem;
}

.match-score-badge {
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 2rem;
  color: #166534;
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.75rem;
  text-transform: uppercase;
}

.job-description {
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 1rem;
}

.job-detail-description {
  h2 {
    font-size: 1.25rem;
  }
}

.job-location {
  align-items: center;
  display: flex;
  gap: 0.375rem;
}

.job-row {
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem 0;
  text-decoration: none;
}

.job-row:hover .job-row-title {
  color: #3b82f6;
  text-decoration: underline;
}

.job-row-info {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.job-row-meta {
  align-items: flex-start;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
  gap: 0.25rem;
}

.job-row-title {
  color: #1f2937;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.job-row-title:hover {
  color: #3b82f6;
  cursor: pointer;
  text-decoration: underline;
}

.job-share {
  border-bottom: 1px solid #afb1b7;
  border-top: 1px solid #afb1b7;
  color: #afb1b7;
  padding: 1rem 0;
}

.job-title {
  color: #1f2937;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 1rem;
}

/* Jobs Hero Image */
.jobs-hero-image {
  max-height: 30vh;
  object-fit: cover;
}

/* Jobs Listing Page Styling */
.jobs-content {
  background: #fff;
  max-width: 800px;
}

/* Empty state */
.jobs-empty {
  color: #6b7280;
  padding: 4rem 2rem;
  text-align: center;
}

.jobs-empty h2 {
  color: #1f2937;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.jobs-empty p {
  font-size: 1rem;
  margin: 0;
}

.jobs-empty svg {
  color: #d1d5db;
  margin-bottom: 1.5rem;
}

.jobs-count {
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.jobs-filter-container {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 0.375rem;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
}

.jobs-filter-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 992px) {
  .jobs-filter-row {
    align-items: flex-end;
    flex-direction: row;
  }
}

.jobs-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.jobs-filter-label {
  color: #6c757d;
  font-size: 0.8125rem;
  font-weight: 500;
}

.jobs-filter-zip-row {
  display: flex;
  gap: 0.5rem;
}

.jobs-filter-zip {
  flex: 1;
  min-width: 12rem;
}

@media (min-width: 992px) {
  .jobs-filter-zip {
    flex: none;
    width: 8rem;
  }
}

.jobs-filter-radius {
  flex-shrink: 0;
  width: 6rem;
}

.jobs-filter-submit {
  display: flex;
  gap: 0.5rem;
}

.jobs-filter-search {
  flex: 1;
  white-space: nowrap;
}

@media (min-width: 992px) {
  .jobs-filter-search {
    flex: none;
  }
}

.jobs-filter-error {
  color: #dc3545;
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

/* Jobs List */
.jobs-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jobs-pagination {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 992px) {
  .jobs-pagination {
    flex-direction: row;
    gap: 0;
    justify-content: space-between;
  }
}

.jobs-pagination-form {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.jobs-pagination-label {
  color: #1f2937;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.jobs-pagination-input {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9375rem;
  padding: 0.25rem 0.5rem;
  text-align: center;
  width: 3.5rem;
}

.jobs-pagination-total {
  color: #6b7280;
  font-size: 0.9375rem;
}

.jobs-pagination-go {
  background-color: var(--bs-primary);
  border: none;
  border-radius: 0.375rem;
  color: #fff;
  font-size: 0.9rem;
  padding: 0.375rem 1rem;
}

.jobs-pagination-go:hover {
  background-color: var(--bs-primary);
  color: #fff;
  filter: brightness(0.9);
}

.jobs-pagination-nav {
  display: flex;
  gap: 0.5rem;
}

.jobs-pagination-prev {
  background-color: var(--bs-secondary);
  border: none;
  border-radius: 0.375rem;
  color: #fff;
  font-size: 0.9rem;
  padding: 0.375rem 1rem;
}

.jobs-pagination-prev:hover {
  background-color: var(--bs-secondary);
  color: #fff;
  filter: brightness(0.9);
}

.jobs-pagination-next {
  background-color: var(--bs-primary);
  border: none;
  border-radius: 0.375rem;
  color: #fff;
  font-size: 0.9rem;
  padding: 0.375rem 1rem;
}

.jobs-pagination-next:hover {
  background-color: var(--bs-primary);
  color: #fff;
  filter: brightness(0.9);
}

/* Matched jobs should fill remaining space and scroll */
.matched-jobs-container {
  background: #f9fafb;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.message-bubble {
  animation: slideIn 0.2s ease-out;
  display: flex;
  margin-bottom: 1.5rem;
}

.send-button {
  align-items: center;
  background: #3b82f6;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 36px;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
  width: 36px;
}

.send-button:active {
  transform: scale(0.95);
}

.send-button:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.send-button:disabled,
.send-button:disabled:hover {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.send-button svg {
  height: 16px;
  width: 16px;
}

/* Smooth transitions for turbo frame replacements */
turbo-frame {
  display: block;
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background: #3b82f6;
  border-radius: 1rem;
  color: #fff;
  display: inline-block;
  max-width: 80%;
  padding: 1rem 1.25rem;
}

/* Responsive */
@media (min-width: 992px) {
  .job-row {
    display: grid;
    grid-template-columns: 4fr 2fr 1fr;
  }
}

/* Chat Widget */
.chat-widget {
  bottom: 2rem;
  position: fixed;
  right: 2rem;
  z-index: 1000;
}

.chat-widget-popup {
  background: #fff;
  border-radius: 12px;
  bottom: 4.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  display: none;
  position: absolute;
  right: 0;
  width: 280px;
}

.chat-widget-popup.open {
  display: block;
}

.chat-widget-header {
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.chat-widget-header-name {
  align-items: center;
  display: flex;
  font-weight: 600;
  gap: 0.5rem;
}

.chat-widget-dot-indicator {
  background: #3b82f6;
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.chat-widget-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
}

.chat-widget-body {
  padding: 1rem;
}

.chat-widget-message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chat-widget-avatar {
  background: #3b82f6;
  border-radius: 50%;
  flex-shrink: 0;
  height: 36px;
  width: 36px;
}

.chat-widget-message p {
  color: #1f2937;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
}

.chat-widget-cta {
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #1f2937;
  display: flex;
  font-size: 0.875rem;
  font-weight: 600;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  text-decoration: none;
}

.chat-widget-cta:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.chat-widget-cta-arrow {
  color: #ef4444;
  font-size: 1.25rem;
}

.chat-widget-toggle {
  background: #3b82f6;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(30, 64, 175, 0.5);
  cursor: pointer;
  height: 52px;
  width: 52px;
}

.apply-widget {
  align-items: center;
  bottom: 1.5rem;
  display: flex;
  gap: 0.75rem;
  position: fixed;
  right: 1.5rem;
  text-decoration: none;
  z-index: 1000;
}

.apply-widget-avatar {
  background: #3b82f6;
  border-radius: 50%;
  flex-shrink: 0;
  height: 52px;
  width: 52px;
}

.apply-widget-bubble {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  color: #1f2937;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.625rem 0.875rem;
}

@media (max-width: 768px) {
  .job-title {
    font-size: 1.25rem;
  }
}
