/**
 * Job Listings module styles.
 *
 * Loaded via humhub\modules\joblistings\assets\JoblistingsAsset — do not
 * duplicate any of this in view-level <style> blocks or registerCss() calls.
 *
 * Color-mode support (Bootstrap 5.3): no hard-coded colors. Everything is driven by
 * Bootstrap's --bs-* CSS variables, which switch automatically with
 * data-bs-theme="light|dark" on <html> (or any ancestor). The few module-level
 * tokens below are defined once for light and overridden for dark.
 */

/* ------------------------------------------------------------------ */
/* Module tokens                                                       */
/* ------------------------------------------------------------------ */
:root,
[data-bs-theme="light"] {
    --jl-card-shadow-hover: 0 0.25rem 0.75rem rgba(var(--bs-body-color-rgb), 0.12);
    --jl-card-border-hover: var(--bs-border-color);
    --jl-saved-color: var(--bs-warning, #ffc107);
    --jl-muted-bg: var(--bs-tertiary-bg);

    /* Native form controls (dropdown popups etc.) follow color-scheme */
    color-scheme: light;
}

[data-bs-theme="dark"] {
    /* Dark surfaces need a deeper, darker shadow to remain visible */
    --jl-card-shadow-hover: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.55);
    --jl-card-border-hover: var(--bs-border-color-translucent);
    --jl-saved-color: var(--bs-warning, #ffca2c);
    --jl-muted-bg: var(--bs-tertiary-bg);

    color-scheme: dark;
}

/* ------------------------------------------------------------------ */
/* Card grid (job/index.php, job/saved.php)                            */
/* ------------------------------------------------------------------ */
.joblistings-grid .job-item-column {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.joblistings-grid .job-item-column .job-card {
    height: 100%;
}

.job-card {
    color: var(--bs-body-color);
    transition: box-shadow 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.job-card:hover,
.job-card:focus-within {
    box-shadow: var(--jl-card-shadow-hover);
    border-color: var(--jl-card-border-hover);
}

.job-card .panel-heading {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

.job-card .panel-heading a {
    color: var(--bs-body-color);
    text-decoration: none;
}

.job-card .panel-heading a:hover,
.job-card .panel-heading a:focus-visible {
    color: var(--bs-link-hover-color);
    text-decoration: underline;
}

/* Footer divider inside the card follows the active color mode */
.job-card .border-top {
    border-color: var(--bs-border-color) !important;
}

/* ------------------------------------------------------------------ */
/* Job detail page                                                     */
/* ------------------------------------------------------------------ */
.job-description {
    line-height: 1.6;
    color: var(--bs-body-color);
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Bookmark / save toggle button                                       */
/* ------------------------------------------------------------------ */
.joblistings-save-toggle {
    border: none;
    background: none;
    color: var(--bs-secondary-color);
}

.joblistings-save-toggle:hover,
.joblistings-save-toggle:focus-visible {
    color: var(--bs-body-color);
}

.joblistings-save-toggle[data-saved="1"] i {
    color: var(--jl-saved-color);
}

/* ------------------------------------------------------------------ */
/* Applicant pipeline (application/index.php, _application_item.php)   */
/* ------------------------------------------------------------------ */
.application-item {
    border-color: var(--bs-border-color) !important;
}

.application-item:last-child {
    border-bottom: none !important;
}

.joblistings-status-select {
    min-width: 160px;
}

/* Badge-styled filter links (status counts in the applicant pipeline modal) */
.joblistings-badge-link {
    border: none;
    background: none;
    padding: 0;
    margin-right: 4px;
    color: inherit;
}

/* ------------------------------------------------------------------ */
/* Form fields (selects, inputs, textareas) — light/dark mode          */
/*                                                                     */
/* Scoped by field name so it also applies inside HumHub modals, which */
/* render outside the module's page wrappers. The custom property is   */
/* marked !important to override the inline                            */
/* "--form-control-bg: var(--input-bg)" set by the views.              */
/* ------------------------------------------------------------------ */
:is(input, select, textarea)[name^="Job["],
:is(input, select, textarea)[name^="JobSearch["],
:is(input, select, textarea)[name^="Application["],
:is(input, select, textarea)[name^="Category["],
select[name="status"],
select[name="rating"],
textarea[name="internal_notes"],
#jobsPerPage,
#defaultCurrency {
    --form-control-bg: var(--bs-body-bg) !important;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

:is(input, select, textarea)[name^="Job["]:focus,
:is(input, select, textarea)[name^="JobSearch["]:focus,
:is(input, select, textarea)[name^="Application["]:focus,
:is(input, select, textarea)[name^="Category["]:focus,
select[name="status"]:focus,
select[name="rating"]:focus,
textarea[name="internal_notes"]:focus,
#jobsPerPage:focus,
#defaultCurrency:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

:is(input, textarea)[name^="Job["]::placeholder,
:is(input, textarea)[name^="JobSearch["]::placeholder,
:is(input, textarea)[name^="Application["]::placeholder,
:is(input, textarea)[name^="Category["]::placeholder {
    color: var(--bs-secondary-color);
}

/* Native dropdown popups follow color-scheme, not the --bs-* variables */
select[name^="Job["] option,
select[name^="JobSearch["] option,
select[name^="Application["] option,
select[name^="Category["] option,
select[name="status"] option,
select[name="rating"] option,
#defaultCurrency option {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* ------------------------------------------------------------------ */
/* Collapsible mobile filter bar (job/index.php)                       */
/*                                                                     */
/* Toggled by a .filter-toggle-link button via Bootstrap 5's native    */
/* data-bs-toggle="collapse" — no custom JS needed. Below md it        */
/* behaves like any other Bootstrap collapse; from md up it's always   */
/* shown, regardless of collapse state.                                */
/* ------------------------------------------------------------------ */
@media (min-width: 768px) {
    .joblistings-filter-collapse {
        display: block !important;
        height: auto !important;
    }
}

/* ------------------------------------------------------------------ */
/* Job section nav (views/job/_nav.php)                                */
/*                                                                     */
/* Pill navigation shared by the job board, My job listings, Saved     */
/* jobs and My applications pages. One row; scrolls horizontally on    */
/* narrow screens instead of wrapping into a stack of buttons.         */
/* ------------------------------------------------------------------ */
.joblistings-section-nav {
    margin-bottom: 1rem;
}

.joblistings-section-nav .panel-body {
    padding: 0.5rem;
}

.joblistings-section-nav .nav {
    --bs-nav-link-padding-x: 0.9rem;
    --bs-nav-link-padding-y: 0.45rem;
    --bs-nav-link-color: var(--bs-secondary-color);
    --bs-nav-link-hover-color: var(--bs-body-color);
    --bs-nav-pills-link-active-bg: var(--bs-primary);
    --bs-nav-pills-link-active-color: var(--bs-white);

    flex-wrap: nowrap;
    gap: 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.joblistings-section-nav .nav-item {
    flex: 0 0 auto;
}

.joblistings-section-nav .nav-link {
    white-space: nowrap;
    border-radius: var(--bs-border-radius);
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.joblistings-section-nav .nav-link:not(.active):hover,
.joblistings-section-nav .nav-link:not(.active):focus-visible {
    background-color: var(--bs-tertiary-bg);
}

.joblistings-section-nav .nav-link .fa,
.joblistings-section-nav .nav-link [class*="fa-"] {
    margin-right: 0.35rem;
}

/* ------------------------------------------------------------------ */
/* Admin quick-nav button bar (views/admin/_nav.php)                   */
/* ------------------------------------------------------------------ */
.joblistings-admin-nav .btn {
    flex: 1 1 auto;
}

@media (min-width: 576px) {
    .joblistings-admin-nav .btn {
        flex: 0 0 auto;
    }
}

/* ------------------------------------------------------------------ */
/* Admin dashboard                                                     */
/* ------------------------------------------------------------------ */

/* Overview stat tiles — 2-up on phones, 4-up from md */
.joblistings-stat-tile {
    padding: 8px 0;
    border-radius: var(--bs-border-radius);
    background-color: var(--jl-muted-bg);
    color: var(--bs-body-color);
}

/* Pending-approval row — stacked on phones, inline from sm up */
.joblistings-pending-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-color: var(--bs-border-color) !important;
}

@media (min-width: 576px) {
    .joblistings-pending-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }
}

/* ------------------------------------------------------------------ */
/* Accessibility / motion                                              */
/* ------------------------------------------------------------------ */
.job-card a:focus-visible,
.joblistings-save-toggle:focus-visible,
.joblistings-badge-link:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: var(--bs-border-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
    .job-card,
    .joblistings-section-nav .nav-link {
        transition: none;
    }
}