/* Shared styles for job ads list & detail pages */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --color-bg: #eef2f7;
    --color-bg-end: #e8f0f8;
    --color-surface: #ffffff;
    --color-text: #2c3e50;
    --color-text-muted: #7f8c8d;
    --color-text-light: #95a5a6;
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-header: #1a5276;
    --color-header-end: #2471a3;
    --color-exact: #8e44ad;
    --color-exact-bg: #f4ecf7;
    --color-exact-border: #9b59b6;
    --color-role: #2980b9;
    --color-role-bg: #ebf5fb;
    --color-role-border: #3498db;
    --color-school: #c0392b;
    --color-school-bg: #fdedec;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(26, 82, 118, 0.06);
    --shadow-md: 0 4px 20px rgba(26, 82, 118, 0.1);
    --shadow-lg: 0 12px 40px rgba(26, 82, 118, 0.12);
    --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    margin: 0;
    padding: 0;
    background: linear-gradient(165deg, var(--color-bg) 0%, #f5f7fa 40%, var(--color-bg-end) 100%);
    background-attachment: fixed;
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

/* —— Site header —— */
.site-header {
    background: linear-gradient(135deg, var(--color-header) 0%, var(--color-header-end) 100%);
    color: white;
    box-shadow: 0 4px 24px rgba(26, 82, 118, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.site-brand-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.site-brand-text strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-brand-text span {
    font-size: 0.75rem;
    opacity: 0.85;
    font-weight: 500;
}

.nav-link {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateX(-2px);
}

.nav-link-forward:hover {
    transform: translateX(2px);
}

/* —— Page layout —— */
.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.page-hero {
    text-align: center;
    margin-bottom: 32px;
}

.page-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.03em;
}

.page-hero p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 1.05rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* —— Stats grid —— */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(52, 152, 219, 0.08);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.highlight {
    border-color: rgba(142, 68, 173, 0.25);
    background: linear-gradient(180deg, #fff 0%, var(--color-exact-bg) 100%);
}

.stat-card.highlight-role {
    border-color: rgba(52, 152, 219, 0.25);
    background: linear-gradient(180deg, #fff 0%, var(--color-role-bg) 100%);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-card.highlight .stat-value {
    color: var(--color-exact);
}

.stat-card.highlight-role .stat-value {
    color: var(--color-role);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

.stat-sublabel {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-top: 2px;
}

/* —— Panel (filters) —— */
.panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px 28px;
    margin-bottom: 28px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin: 0 0 16px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
}

.filter-row + .filter-row {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #ecf0f1;
}

.filter-label-text {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
    min-width: 140px;
}

.filter-select {
    flex: 1;
    min-width: 220px;
    max-width: 400px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 2px solid #e8ecef;
    border-radius: var(--radius-sm);
    background: #fafbfc;
    color: var(--color-text);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.filter-select:hover {
    border-color: var(--color-primary);
    background: white;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
    background: white;
}

.filter-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text);
    user-select: none;
}

.filter-checkbox-label input {
    width: 20px;
    height: 20px;
    accent-color: var(--color-exact);
    cursor: pointer;
}

/* —— Job cards grid —— */
.jobs-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.job-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 0;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
}

.job-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #dfe6e9;
    transition: height 0.2s;
}

.job-card.match-exact::before {
    background: linear-gradient(90deg, var(--color-exact), #bb8fce);
}

.job-card.match-role::before {
    background: linear-gradient(90deg, var(--color-primary), #5dade2);
}

.job-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.job-card:hover::before {
    height: 5px;
}

.job-card.hidden {
    display: none;
}

.job-card-body {
    padding: 22px 24px 0;
    flex: 1;
}

.job-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.job-employer {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 12px;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 14px;
}

.job-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    background: #f4f6f8;
    padding: 4px 10px;
    border-radius: 20px;
}

.job-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
    flex-shrink: 0;
}

.job-description {
    color: #5d6d7e;
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.job-card-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #f0f3f5;
    margin-top: auto;
}

.salary-indicator {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
}

.salary-indicator.exact-match {
    background: var(--color-exact-bg);
    color: #6c3483;
    border: 1px solid rgba(155, 89, 182, 0.35);
}

.salary-indicator.role-specific {
    background: var(--color-role-bg);
    color: #1a5276;
    border: 1px solid rgba(52, 152, 219, 0.35);
}

.salary-indicator-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.salary-badge-small {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 6px;
}

.salary-indicator.exact-match .salary-badge-small {
    background: rgba(142, 68, 173, 0.2);
    color: var(--color-exact);
}

.salary-indicator.role-specific .salary-badge-small {
    background: rgba(52, 152, 219, 0.2);
    color: var(--color-role);
}

.job-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    transition: gap 0.2s, color 0.2s;
}

.job-card:hover .job-link {
    gap: 10px;
    color: var(--color-primary-dark);
}

/* —— Loading & empty states —— */
.state-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.state-message .state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.state-message p {
    margin: 0;
    font-size: 1.05rem;
    color: var(--color-text-muted);
}

/* —— Detail page overrides —— */
.detail-header .site-header-inner {
    justify-content: flex-start;
}

.job-detail-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.job-detail-card .job-header {
    border-bottom: 2px solid #f0f3f5;
    padding-bottom: 28px;
    margin-bottom: 32px;
}

.job-detail-card .job-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 12px;
}

.job-detail-card .job-employer {
    font-size: 1.15rem;
}

.job-detail-card .job-meta {
    margin-top: 16px;
}

.job-detail-card .job-meta-item {
    font-size: 0.875rem;
    padding: 6px 12px;
}

.section {
    margin-bottom: 36px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f3f5;
    letter-spacing: -0.02em;
}

.section-content {
    font-size: 1rem;
    color: #4a5568;
    line-height: 1.75;
}

/* Structured job description from JobTech text_formatted */
.job-description-html {
    font-size: 1rem;
    color: #4a5568;
    line-height: 1.75;
}

.job-description-html p {
    margin: 0 0 1em;
}

.job-description-html p:last-child {
    margin-bottom: 0;
}

.job-description-html .job-desc-heading,
.job-description-html h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 1.75em 0 0.65em;
    padding-bottom: 0.35em;
    border-bottom: 2px solid #eef2f7;
    letter-spacing: -0.02em;
}

.job-description-html .job-desc-heading:first-child,
.job-description-html h3:first-child {
    margin-top: 0;
}

.job-description-html strong {
    font-weight: 700;
    color: var(--color-text);
}

.job-description-html ul,
.job-description-html ol {
    margin: 0.5em 0 1em 1.25em;
    padding: 0;
}

.job-description-html li {
    margin-bottom: 0.35em;
}

.job-description-html a {
    color: var(--color-primary);
    font-weight: 600;
}

.job-sidebar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.sidebar-block {
    background: linear-gradient(180deg, #fafbfc 0%, #f4f6f8 100%);
    border: 1px solid #e8ecef;
    border-radius: var(--radius-md);
    padding: 20px 22px;
}

.sidebar-block .section-title {
    font-size: 1rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom-color: #e0e5ea;
}

.sidebar-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 12px 0 4px;
}

.sidebar-text {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.5;
}

.sidebar-text:last-child {
    margin-bottom: 0;
}

.sidebar-text a {
    color: var(--color-primary);
    font-weight: 600;
    word-break: break-all;
}

.contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid #e8ecef;
}

.contact-name {
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}

.contact-card a {
    display: block;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 4px;
}

.contact-card a:hover {
    text-decoration: underline;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.info-item {
    padding: 18px 20px;
    background: linear-gradient(180deg, #fafbfc 0%, #f4f6f8 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.info-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.info-value {
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 600;
}

.external-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 14px rgba(52, 152, 219, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.external-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.45);
}

.salary-section {
    border-radius: var(--radius-lg);
    padding: 32px;
    color: white;
    margin-bottom: 32px;
    overflow: hidden;
    position: relative;
}

.salary-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.salary-section.exact-match {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 50%, #6c3483 100%);
    box-shadow: 0 8px 32px rgba(142, 68, 173, 0.35);
}

.salary-section.role-specific {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 50%, #1a5276 100%);
    box-shadow: 0 8px 32px rgba(52, 152, 219, 0.35);
}

.salary-section h2 {
    color: white;
    margin-bottom: 16px;
    font-size: 1.35rem;
    position: relative;
    z-index: 1;
}

.salary-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.salary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.salary-stat-item {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.salary-stat-label {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.salary-stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.salary-stat-unit {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 2px;
}

.salary-info {
    margin-top: 12px;
    font-size: 0.9rem;
    opacity: 0.95;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.salary-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    margin-top: 24px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: background 0.2s;
    position: relative;
    z-index: 1;
}

.salary-detail-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.error-card {
    text-align: center;
    padding: 48px 32px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.error-card h2 {
    color: #c0392b;
    margin-bottom: 10px;
    font-size: 1.25rem;
}

@media (max-width: 640px) {
    .page {
        padding: 20px 16px 36px;
    }

    .panel {
        padding: 18px 20px;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        max-width: none;
    }

    .jobs-container {
        grid-template-columns: 1fr;
    }

    .job-detail-card {
        padding: 24px 20px;
    }
}
