* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #eef4ff 0%, #f8faff 38%, #f5f7fb 100%);
  color: #14213d;
}

ol#browse-categories-list li {
    padding: 5px 10px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #cad0e338;
}
a.browse-link.browse-filter-link {
    text-decoration: none;
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.topbar {
  background: linear-gradient(90deg, #0b3d91 0%, #1450b8 100%);
  color: #fff;
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 9;
  box-shadow: 0 8px 26px rgba(11, 61, 145, 0.28);
}

.topbar-inner,
.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo-wrap {
  justify-content: flex-start;
}

.logo-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd166 0%, #fca311 100%);
  color: #14213d;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.site-title {
  margin: 0;
  font-size: 1.24rem;
  letter-spacing: 0.2px;
}

.site-subtitle {
  margin: 0;
  opacity: 0.95;
  font-size: 0.8rem;
}

.top-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.theme-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.95rem;
}

.theme-icon-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.theme-icon-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
  border-radius: 8px;
}

.page-shell {
  padding: 22px 0 30px;
}

.card,
.subcard {
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #e6ecf8;
  box-shadow: 0 10px 34px rgba(12, 38, 86, 0.08);
}

.subcard {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
}

.hero {
  margin-bottom: 16px;
  background: linear-gradient(160deg, #ffffff 0%, #f4f8ff 100%);
}

.search-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
}

.grid-2 {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d4dae6;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input:focus {
  outline: none;
  border-color: #2b63c9;
  box-shadow: 0 0 0 3px rgba(43, 99, 201, 0.14);
  background: #fff;
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.primary-btn,
.ghost-btn,
.plan-btn,
.secondary-btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, #0d46a1 0%, #1f62cd 100%);
  color: #fff;
  padding: 11px 14px;
  box-shadow: 0 6px 16px rgba(17, 80, 183, 0.26);
}

.secondary-btn {
  background: #eef3fb;
  color: #1c2f52;
  padding: 11px 12px;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 8px 10px;
  transition: background 140ms ease;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.ghost-btn-link {
  display: inline-block;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
}

.plan-btn {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  background: linear-gradient(180deg, #eef3ff 0%, #e5eeff 100%);
  margin-bottom: 8px;
}

.muted {
  color: #5f6f87;
}

.tiny {
  font-size: 0.8rem;
}

.job-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.browse-ordered {
  margin: 10px 0 20px 0;
  padding: 0;
  max-height: 250px;
  overflow-y: auto;
  list-style: none;
}

#browse-cities-list {
  max-height: none;
  overflow-y: visible;
}

.browse-ordered li {
  margin-bottom: 0;
}

.province-item {
  list-style: none;
  margin: 0;
  padding: 0;
}

.province-toggle {
    width: 100%;
    text-align: left;
    border: none;
    background: #f2f6ff;
    color: #0d46a1;
    padding: 10px 10px;
    border-radius: 7px;
    margin: 0;
    cursor: pointer;
    display: block;
    font-weight: 600;
    transition: background 150ms ease;
    text-transform: uppercase;
}

.province-toggle:hover {
  background: #e7efff;
}

.province-cities {
  margin: 8px 0 0 14px;
  padding-left: 12px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 240ms ease;
}

.province-cities li {
  list-style: disc;
}

.browse-link {
  background: none;
  border: none;
  color: #0f4bac;
  cursor: pointer;
  text-align: left;
  padding: 2px 0;
  font-size: 0.92rem;
}

.browse-link:hover {
  text-decoration: underline;
}

.job-card {
  border: 1px solid #e8edf4;
  border-radius: 12px;
  padding: 13px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  transition: transform 160ms ease, box-shadow 160ms ease;
  cursor: pointer;
}

.job-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 49, 101, 0.11);
}

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.job-title {
  margin: 0 0 6px;
}

.job-meta {
  margin: 0;
  font-size: 0.9rem;
  color: #607089;
}

.job-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.chip {
  border: 1px solid #d4dae6;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer {
  color: #607089;
  font-size: 0.85rem;
  padding-bottom: 20px;
}

.job-detail-card hr {
  border: 0;
  border-top: 1px solid #e6ecf8;
  margin: 14px 0;
}

.job-description-full {
  line-height: 1.6;
}

.job-facts {
  margin: 10px 0 0;
  padding-left: 18px;
}

.job-facts li {
  margin-bottom: 4px;
}

.primary-btn-link {
  display: inline-block;
  margin-top: 14px;
  text-decoration: none;
  background: linear-gradient(135deg, #0d46a1 0%, #1f62cd 100%);
  color: #fff;
  padding: 11px 14px;
  border-radius: 8px;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  z-index: 30;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(460px, 92%);
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  position: relative;
  border: 1px solid #e6ecf8;
  box-shadow: 0 20px 48px rgba(14, 30, 56, 0.26);
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  border: none;
  background: #eef3ff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .search-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

body.dark-theme {
  background: linear-gradient(180deg, #0b1120 0%, #0f172a 50%, #0a1020 100%);
  color: #dbe7ff;
}

body.dark-theme .topbar {
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

body.dark-theme .card,
body.dark-theme .subcard,
body.dark-theme .modal-content,
body.dark-theme .job-card {
  background: #111b31;
  border-color: #27324d;
  color: #dbe7ff;
}

body.dark-theme .hero,
body.dark-theme .job-card {
  background: #111b31;
}

body.dark-theme .input {
  background: #0f1a30;
  border-color: #2b3b61;
  color: #e4ecff;
}

body.dark-theme .theme-icon {
  border-color: #2b3b61;
  background: #0f1a30;
}

body.dark-theme .input:focus {
  border-color: #5c8dff;
  box-shadow: 0 0 0 3px rgba(92, 141, 255, 0.2);
}

body.dark-theme .secondary-btn,
body.dark-theme .plan-btn,
body.dark-theme .province-toggle,
body.dark-theme .modal-close {
  background: #1a2744;
  color: #dbe7ff;
}

body.dark-theme .muted,
body.dark-theme .job-meta,
body.dark-theme .footer {
  color: #9fb0d6;
}

body.dark-theme .chip {
  border-color: #3a4a73;
}

body.dark-theme .browse-link {
  color: #f3f7ff;
}

body.dark-theme .browse-link:hover {
  color: #ffffff;
}

body.dark-theme .job-detail-card hr {
  border-top-color: #2b3b61;
}

/* ==========================================================================
   HORIZONTAL JOB ROW LAYOUT
   ========================================================================== */

#job-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.job-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    color: inherit;
}

.job-row:hover {
    border-color: #0284c7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.job-row-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.job-row-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 20px;
    flex-shrink: 0;
}

.job-row-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.job-row-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.job-row-title:hover {
    color: #0284c7;
}

.job-row-meta-line {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: #64748b;
    flex-wrap: wrap;
}

.job-row-company {
    font-weight: 500;
    color: #475569;
}

.job-row-right {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: flex-end;
    margin-left: 20px;
}

.job-row-tags {
    display: flex;
    gap: 8px;
}

.row-tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 9999px;
    background-color: #f1f5f9;
    color: #475569;
}

.job-row-action .row-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.job-row:hover .job-row-action .row-btn {
    background-color: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

@media (max-width: 768px) {
    .job-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
    }
    
    .job-row-right {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
        border-top: 1px solid #f1f5f9;
        padding-top: 12px;
    }
}

/* Dark Mode Overrides for Job Rows */
body.dark-theme .job-row {
    background-color: #111b31;
    border-color: #27324d;
}

body.dark-theme .job-row-logo {
    background-color: #0f1a30;
    border-color: #27324d;
}

body.dark-theme .job-row-title {
    color: #dbe7ff;
}

body.dark-theme .job-row-meta-line {
    color: #9fb0d6;
}

body.dark-theme .job-row-company {
    color: #cbd5e1;
}

body.dark-theme .row-tag {
    background-color: #1a2744;
    color: #9fb0d6;
}

body.dark-theme .job-row-action .row-btn {
    background-color: #064e3b;
    border-color: #065f46;
    color: #6ee7b7;
}

@media print {
    header, 
    .navbar, 
    #header, 
    nav, 
    .site-header {
        display: none !important;
    }

    body {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .card.ajc-job-view {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.tab-btn {
  border: 1px solid #d4dae6;
  background: #ffffff;
  color: #1f2937;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.tab-btn.active,
.tab-btn:hover {
  background: #0d46a1;
  color: #ffffff;
  border-color: #0d46a1;
}

.tab-panel {
  display: none;
}

.tab-panel:not(.hidden) {
  display: block;
  animation: fadeIn 0.2s ease;
}

.profile-grid,
.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.plan-grid {
  margin-top: 16px;
}

.plan-card {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
}

.plan-card h4 {
  margin: 0 0 10px;
}

.plan-card p {
  margin: 0 0 16px;
  color: #475569;
}

@media (max-width: 900px) {
  .profile-grid,
  .plan-grid {
    grid-template-columns: 1fr;
  }
}

/* Force dark mode colors to override inline styles set by JavaScript */
body.dark-theme .ajc-job-view {
    background: #111b31 !important;
    color: #dbe7ff !important;
}

body.dark-theme .ajc-job-view h1,
body.dark-theme .ajc-job-view h2,
body.dark-theme .ajc-job-view h3 {
    color: #dbe7ff !important;
}

body.dark-theme .ajc-job-view div[style*="background"] {
    background: #1a2744 !important;
    border-color: #27324d !important;
}

/* Job View Container Card */
.ajc-job-view {
    padding: 40px; 
    color: #14213d; 
    background: #fff;
    border-radius: 8px; /* Cleaned up the sharp card corners */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ajc-job-view h1 {
    font-size: 2.5rem; 
    margin: 0 0 10px 0; 
    font-weight: 800; 
    color: #0b3d91;
}

.ajc-job-view h2 {
    font-size: 1.5rem; 
    margin: 0 0 20px 0; 
    color: #475569; 
    font-weight: 500;
}

/* Metadata Grid Box */
.job-meta-box {
    
    border: 1px solid #e2e8f0; 
    padding: 20px; 
    margin-bottom: 30px; 
    border-radius: 4px;
}

.job-meta-grid {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px;
}

.job-meta-grid p {
    margin: 5px 0;
}

/* Position Details Section */
.job-details-section {
    line-height: 1.8; 
    font-size: 1.1rem;
}

.job-details-section h3 {
    border-bottom: 2px solid #0b3d91; 
    padding-bottom: 5px; 
    color: #0b3d91;
    margin-top: 0;
}

/* CRITICAL FIX: Preserves database line breaks and spaces */
.job-desc-body {
    margin-bottom: 30px;
    white-space: pre-wrap; 
    word-break: break-word; /* Prevents overflow strings from breaking the layout */
}

/* Footer / Action Section */
.job-view-footer {
    margin-top: 40px; 
    padding-top: 25px; 
    border-top: 2px solid #e2e8f0;
}

.job-actions-wrapper {
    display: flex; 
    gap: 12px; 
    align-items: center;
    flex-wrap: wrap; /* Keeps it responsive on mobile */
}

.job-back-link {
    margin-left: auto; 
    text-decoration: none; 
    color: #0b3d91; 
    font-weight: 600;
}

.job-back-link:hover {
    text-decoration: underline;
}

/* Responsive adjustment for small screens */
@media (max-width: 600px) {
    .job-meta-grid {
        grid-template-columns: 1fr;
    }
    .ajc-job-view {
        padding: 20px;
    }
    .job-back-link {
        margin-left: 0;
        width: 100%;
        margin-top: 10px;
    }
}

