/**
 * CSIA Job Postings Styles
 * Updated to match CSIA website design and color scheme
 * Colors: Red (#dc291e), Black (#000000), White (#ffffff)
 * Font: Barlow, sans-serif
 */

.csia-job-postings {
  width: 100%;
  padding: 0;
  font-family: "Barlow", sans-serif;
  background: #ffffff;
  color: #000000;
  margin-block-start: 0;
  position: relative;
  overflow: visible;
}

/* Filters */
.csia-job-filters {
  background: #000000 !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 25px 0 !important;
  margin: 0 0 30px 0 !important;
  box-shadow: none !important;
  width: 100% !important;
  position: relative;
}

.csia-filter-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 20px !important;
  align-items: end !important;
}

.csia-filter-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 150px;
}

.csia-filter-group label {
  font-weight: 600 !important;
  margin-bottom: 8px !important;
  color: #ffffff !important;
  font-size: 14px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* Ensure labels are readable on mobile */
@media (max-width: 768px) {
  .csia-filter-group label {
    font-size: 13px !important;
    margin-bottom: 6px !important;
  }
}

.csia-filter-select {
  padding: 12px 15px !important;
  border: 1px solid #ffffff !important;
  border-radius: 6px !important;
  background: white !important;
  font-size: 14px !important;
  color: #000000 !important;
  transition: all 0.15s ease-in-out !important;
  min-width: 180px !important;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.csia-filter-select:focus {
  outline: none;
  border-color: #dc291e;
  box-shadow: 0 0 0 3px rgba(220, 41, 30, 0.15);
  transform: translateY(-1px);
}

.csia-refresh-btn {
  background: #dc291e;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 0px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  height: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(220, 41, 30, 0.2);
  white-space: nowrap;
}

.csia-refresh-btn:hover {
  background: #b8221a;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 41, 30, 0.3);
}

.csia-refresh-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(220, 41, 30, 0.2);
}

/* Loading and Error States */
.csia-jobs-loading {
  text-align: center;
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.csia-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #dc291e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
  box-shadow: 0 2px 8px rgba(220, 41, 30, 0.2);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.csia-jobs-error {
  background: #fff5f5;
  color: #dc291e;
  border: 1px solid #dc291e;
  border-radius: 8px;
  padding: 20px;
  margin: 20px auto;
  text-align: center;
  box-shadow: 0 2px 4px rgba(220, 41, 30, 0.1);
  max-width: 1200px;
}

.csia-no-jobs {
  text-align: center;
  padding: 40px 20px;
  color: #000000;
  font-style: italic;
  max-width: 1200px;
  margin: 0 auto;
}

/* Job Items */
.csia-jobs-container {
  display: grid;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.csia-job-item {
  background: white;
  border-bottom: 1px solid #000000;
  /* border-radius: 12px; */
  /* padding: 30px; */
  padding-bottom: 20px;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); */
}

.csia-job-preview {
  color: #000000;
  line-height: 1.6;
  font-size: 15px;
  margin-bottom: 15px;
}

.csia-job-preview h1,
.csia-job-preview h2,
.csia-job-preview h3,
.csia-job-preview h4,
.csia-job-preview h5,
.csia-job-preview h6 {
  color: #dc291e;
  margin-top: 0;
  margin-bottom: 15px;
}

.csia-job-preview p {
  margin-bottom: 10px;
}

.csia-job-content {
  color: #000000;
  line-height: 1.6;
  font-size: 15px;
}

.csia-job-content h1,
.csia-job-content h2,
.csia-job-content h3,
.csia-job-content h4,
.csia-job-content h5,
.csia-job-content h6 {
  color: #dc291e;
  margin-top: 0;
  margin-bottom: 15px;
}

.csia-job-content p {
  margin-bottom: 10px;
}

.csia-job-content strong {
  color: #dc291e;
  font-weight: 700;
}

.csia-job-header {
  margin-bottom: 15px;
}

.csia-job-title {
  font-size: 26px;
  font-weight: 700;
  color: #dc291e;
  margin: 0 0 15px 0;
  line-height: 1.3;
  letter-spacing: -0.5px;
}

.csia-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 10px;
}

.csia-job-basic-info {
  color: #000000;
  font-size: 16px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.csia-job-company {
  background: #000000;
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.csia-job-region {
  background: #dc291e;
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(220, 41, 30, 0.1);
}

.csia-job-details {
  margin-bottom: 20px;
}

.csia-job-address {
  color: #000000;
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.csia-job-deadline {
  color: #dc291e;
  font-size: 14px;
  font-weight: 600;
  background: #fff5f5;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #dc291e;
  display: inline-block;
}

.csia-job-actions {
  margin-top: 20px;
  text-align: left;
}

.csia-job-actions .wp-block-button {
  margin: 0;
}

.csia-job-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  text-decoration: none !important;
}

.csia-job-toggle * {
  pointer-events: none;
}

.toggle-icon {
  font-size: 12px;
  transition: transform 0.15s ease-in-out;
}

.csia-job-description {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid #000000;
  position: relative;
}

.csia-job-description::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: #dc291e;
}

.csia-job-description-content {
  color: #000000;
  line-height: 1.6;
  font-size: 15px;
}

.csia-job-description-content strong {
  color: #dc291e;
  font-weight: 700;
}

.csia-job-description-content em {
  color: #000000;
  font-style: italic;
}

/* Pagination */
.csia-jobs-pagination {
  text-align: center;
  margin-top: 30px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
}

.csia-load-more-btn {
  background: #000000;
  color: white;
  border: none;
  padding: 15px 35px;
  border-radius: 0px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.csia-load-more-btn:hover {
  background: #dc291e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 41, 30, 0.3);
}

.csia-load-more-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Additional Enhancements */
.csia-job-postings h2 {
  color: #dc291e;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 30px;
  text-align: center;
  letter-spacing: -0.5px;
}

.csia-job-postings h3 {
  color: #000000;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

/* Enhanced focus states for accessibility */
.csia-filter-select:focus,
.csia-refresh-btn:focus,
.csia-job-toggle:focus,
.csia-load-more-btn:focus,
.csia-job-actions .wp-block-button__link:focus {
  outline: 2px solid #dc291e;
  outline-offset: 2px;
}

/* Improved loading state */
.csia-jobs-loading p {
  color: #000000;
  font-size: 16px;
  margin-top: 10px;
}

/* Enhanced no jobs state */
.csia-no-jobs {
  text-align: center;
  padding: 60px 20px;
  color: #000000;
  font-style: italic;
  font-size: 18px;
}

.csia-no-jobs::before {
  content: "🏔️";
  display: block;
  font-size: 48px;
  margin-bottom: 20px;
}

/* WordPress Button Compatibility */
.wp-block-button__link,
.wp-element-button {
  background: #dc291e !important;
  color: #ffffff !important;
  border: none !important;
  padding: 13.5px 27px !important;
  border-radius: 0px !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  font-family: "Barlow", sans-serif !important;
  text-transform: none !important;
  text-decoration: none !important;
  display: inline-block !important;
  transition: all 0.15s ease-in-out !important;
}

.wp-block-button__link:hover,
.wp-element-button:hover {
  background: #b8221a !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(220, 41, 30, 0.3) !important;
}

/* Force override any conflicting styles */
.csia-job-postings .csia-job-filters {
  background: #000000 !important;
}

.csia-job-postings .csia-filter-group label {
  color: #ffffff !important;
}

.csia-job-postings .csia-filter-select {
  border: 2px solid #ffffff !important;
  background: #000 !important;
  border-radius: 0px !important;
  color: #fff !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .csia-jobs-container {
    padding: 0 15px;
  }

  .csia-job-filters {
    padding: 20px 0 !important;
    margin: 0 0 20px 0 !important;
    width: 100% !important;
  }

  .csia-filter-content {
    flex-direction: column;
    align-items: stretch;
    padding: 0 15px !important;
    gap: 15px !important;
  }

  .csia-filter-group {
    min-width: auto;
    margin-bottom: 0;
    width: 100%;
  }

  .csia-filter-select {
    min-width: auto;
    width: 100%;
  }

  .csia-refresh-btn {
    width: 100%;
    margin-top: 0;
    min-height: 44px; /* Better touch target */
  }

  .csia-filter-select {
    min-height: 44px; /* Better touch target */
  }

  .csia-job-title {
    font-size: 22px;
  }

  .csia-job-meta {
    flex-direction: column;
    gap: 10px;
  }

  .csia-job-company,
  .csia-job-region {
    display: inline-block;
    width: fit-content;
  }

  .csia-job-item {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .csia-jobs-container {
    padding: 0 10px;
  }

  .csia-job-item {
    padding: 15px;
  }

  .csia-job-title {
    font-size: 20px;
  }

  .csia-job-filters {
    padding: 15px 0 !important;
    margin: 0 0 15px 0 !important;
    width: 100% !important;
  }

  .csia-filter-content {
    padding: 0 10px !important;
    gap: 12px !important;
  }

  .csia-filter-select {
    padding: 12px 15px !important;
    font-size: 16px !important; /* Prevent zoom on iOS */
  }

  .csia-refresh-btn {
    padding: 14px 24px;
    font-size: 14px;
  }

  .csia-job-postings h2 {
    font-size: 28px;
  }

  .csia-job-postings h3 {
    font-size: 20px;
  }
}

/* Print styles */
@media print {
  .csia-job-filters,
  .csia-job-actions,
  .csia-jobs-pagination {
    display: none;
  }

  .csia-job-item {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }

  .csia-job-description {
    display: block !important;
  }
}

.csia-job-postings h2.job-title {
  text-align: left;
  color: #000;
}
