/**
 * Persy Scraper Frontend Styles
 *
 * Styles for job filters, map, and job cards.
 */

/* ==========================================================================
   Filter Widget
   ========================================================================== */

.persy-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.persy-filter-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    flex: 1;
}

.persy-filter-field {
    flex: 1;
    min-width: 150px;
}

/* Layout Variations */
.persy-filter-layout-vertical {
    flex-direction: column;
}

.persy-filter-layout-vertical .persy-filter-fields {
    flex-direction: column;
}

.persy-filter-layout-vertical .persy-filter-field {
    min-width: 100%;
}

.persy-filter-layout-grid .persy-filter-fields {
    display: grid;
    gap: 1rem;
}

.persy-filter-grid-2 .persy-filter-fields {
    grid-template-columns: repeat(2, 1fr);
}

.persy-filter-grid-3 .persy-filter-fields {
    grid-template-columns: repeat(3, 1fr);
}

.persy-filter-grid-4 .persy-filter-fields {
    grid-template-columns: repeat(4, 1fr);
}

/* Inputs */
.persy-filter-input,
.persy-filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.persy-filter-input:focus,
.persy-filter-select:focus {
    border-color: #0073aa;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.persy-filter-input::placeholder {
    color: #999;
}

/* Checkboxes */
.persy-filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.persy-filter-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.persy-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.persy-filter-checkbox input {
    margin: 0;
}

.persy-filter-count {
    color: #666;
    font-size: 0.875em;
}

/* Actions */
.persy-filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.persy-filter-submit,
.persy-filter-reset {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.persy-filter-submit {
    background-color: #0073aa;
    color: #fff;
}

.persy-filter-submit:hover {
    background-color: #005a87;
}

.persy-filter-reset {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.persy-filter-reset:hover {
    background-color: #f5f5f5;
}

/* Loading */
.persy-filter-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.persy-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: persy-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Map Widget
   ========================================================================== */

.persy-map-wrapper {
    position: relative;
}

.persy-map-container {
    width: 100%;
    min-height: 300px;
    background: #e5e3df;
    border-radius: 8px;
    overflow: hidden;
}

.persy-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* Popup Styles */
.persy-map-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
}

.persy-map-popup .leaflet-popup-content {
    margin: 0;
    padding: 1rem;
}

.persy-map-popup-content {
    min-width: 200px;
}

.persy-map-popup-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.persy-map-popup-company {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.persy-map-popup-location {
    font-size: 0.875rem;
    color: #999;
    margin-bottom: 0.75rem;
}

.persy-map-popup-link a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: background-color 0.15s;
}

.persy-map-popup-link a:hover {
    background: #005a87;
    color: #fff;
}

/* ==========================================================================
   Job Cards (AJAX Results)
   ========================================================================== */

.persy-jobs-list {
    position: relative;
    min-height: 100px;
}

.persy-jobs-list.persy-loading {
    opacity: 0.5;
    pointer-events: none;
}

.persy-jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.persy-job-card {
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.persy-job-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.persy-job-title {
    margin: 0 0 0.75rem;
    font-size: 1.125rem;
    line-height: 1.4;
}

.persy-job-title a {
    color: #333;
    text-decoration: none;
}

.persy-job-title a:hover {
    color: #0073aa;
}

.persy-job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: #666;
}

.persy-job-company,
.persy-job-location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.persy-job-excerpt {
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    color: #555;
    line-height: 1.6;
}

.persy-job-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s;
}

.persy-job-link:hover {
    background: #005a87;
    color: #fff;
}

.persy-no-jobs {
    padding: 3rem 2rem;
    text-align: center;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ==========================================================================
   Taxonomy Archive — Hero
   ========================================================================== */

.persy-tax-page {
    padding: 0;
}

.persy-tax-hero {
    background: linear-gradient(135deg, var(--persy-primary-dark, #1a6fb5) 0%, var(--persy-primary, #2987CC) 55%, var(--persy-primary-light, #3fa0e0) 100%);
    color: #fff;
    padding: 3rem 0 2.5rem;
    margin-bottom: 0;
}

.persy-tax-hero__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    margin-top: var(--persy-hero-margin, 100px);
}

.persy-tax-hero__breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.22rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 1.5rem;
}

.persy-tax-hero__breadcrumb a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.15s;
}

.persy-tax-hero__breadcrumb a:hover {
    color: #fff;
}

.persy-tax-hero__body {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.persy-tax-hero__icon {
    flex-shrink: 0;
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.persy-tax-hero__title {
    font-size: clamp(2.25rem, 6vw, 3.375rem);
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    margin: 0 0 0.5rem;
}

.persy-tax-hero__accent {
    color: #ffe066;
}

.persy-tax-hero__desc {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.6;
}

.persy-tax-hero__meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1.25rem;
}

.persy-tax-hero__count {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1.3125rem;
    font-weight: 600;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* ==========================================================================
   Taxonomy Archive — Toolbar & Grid
   ========================================================================== */

.persy-tax-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.persy-tax-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
    gap: 1rem;
    flex-wrap: wrap;
}

.persy-tax-toolbar__results {
    font-size: 1.3125rem;
    color: #666;
}

.persy-tax-toolbar__back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1.22rem;
    color: var(--persy-primary, #2987CC);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.persy-tax-toolbar__back:hover {
    color: var(--persy-primary-dark, #1a6fb5);
}

.persy-tax-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* ==========================================================================
   Taxonomy Archive — Enhanced Cards
   ========================================================================== */

@keyframes persyCardIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.persy-tax-card {
    display: flex;
    flex-direction: column;
    border-left: 3px solid transparent;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    animation: persyCardIn 0.4s ease both;
    animation-delay: calc((var(--card-index, 1) - 1) * 50ms);
}

.persy-tax-card:hover {
    box-shadow: 0 8px 24px rgba(var(--persy-primary-rgb, 41, 135, 204), 0.15);
    transform: translateY(-3px);
    border-left-color: var(--persy-primary, #2987CC);
}

.persy-tax-card__company {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    min-height: 32px;
}

.persy-tax-card__logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}

.persy-tax-card__company-name {
    font-size: 1.22rem;
    color: #888;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persy-tax-card .persy-job-title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    flex-grow: 1;
}

.persy-tax-card .persy-job-title a {
    color: #222;
    transition: color 0.15s;
}

.persy-tax-card .persy-job-title a:hover {
    color: var(--persy-primary, #2987CC);
}

.persy-tax-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.persy-tax-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1.125rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
}

.persy-tax-card__badge--location {
    background: #e8f3fb;
    color: var(--persy-primary-dark, #1a6fb5);
}

.persy-tax-card__badge--type {
    background: #e6f7ee;
    color: #1d7a45;
}

.persy-tax-card__badge--salary {
    background: #fff8e1;
    color: #8a6000;
}

.persy-tax-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.persy-tax-card__date {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1.125rem;
    color: #aaa;
}

.persy-tax-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.875rem;
    background: var(--persy-primary, #2987CC);
    color: #fff;
    border-radius: 6px;
    font-size: 1.22rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s;
    margin-left: auto;
}

.persy-tax-card__cta:hover {
    background: var(--persy-primary-dark, #1a6fb5);
    color: #fff;
    transform: translateX(2px);
}

/* ==========================================================================
   Taxonomy Archive — Pagination
   ========================================================================== */

.persy-tax-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.persy-tax-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1.3125rem;
    color: #444;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    background: #fff;
}

.persy-tax-pagination .page-numbers:hover {
    background: #f0f7fd;
    border-color: var(--persy-primary, #2987CC);
    color: var(--persy-primary, #2987CC);
}

.persy-tax-pagination .page-numbers.current {
    background: var(--persy-primary, #2987CC);
    border-color: var(--persy-primary, #2987CC);
    color: #fff;
    font-weight: 700;
    pointer-events: none;
}

.persy-tax-pagination .page-numbers.dots {
    border-color: transparent;
    background: transparent;
    pointer-events: none;
}

/* ==========================================================================
   Taxonomy Archive — Empty state
   ========================================================================== */

.persy-tax-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 2rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .persy-filter-form {
        flex-direction: column;
    }

    .persy-filter-fields {
        flex-direction: column;
    }

    .persy-filter-field {
        min-width: 100%;
    }

    .persy-filter-grid-2 .persy-filter-fields,
    .persy-filter-grid-3 .persy-filter-fields,
    .persy-filter-grid-4 .persy-filter-fields {
        grid-template-columns: 1fr;
    }

    .persy-filter-actions {
        width: 100%;
    }

    .persy-filter-submit,
    .persy-filter-reset {
        flex: 1;
    }

    .persy-jobs-grid {
        grid-template-columns: 1fr;
    }

    .persy-tax-grid {
        grid-template-columns: 1fr;
    }

    .persy-tax-hero {
        padding: 2rem 0 1.75rem;
    }

    .persy-tax-hero__body {
        flex-direction: column;
        gap: 0.75rem;
    }

    .persy-tax-hero__icon {
        width: 44px;
        height: 44px;
    }

    .persy-tax-card__footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .persy-tax-card__cta {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .persy-tax-grid {
        grid-template-columns: 1fr;
    }
}

.elementor-location-header {
    width: 100%;
}

/* ── Archive Filter Bar ─────────────────────────────────────────────────── */

.persy-archive-filters {
    margin-bottom: 1.75rem;
}

.persy-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    align-items: center;
}

.persy-filter-bar .persy-filter-select {
    flex: 1 1 160px;
    padding: 0.6rem 2.25rem 0.6rem 0.875rem;
    border: 1.5px solid #dde3ea;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #333;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

.persy-filter-bar .persy-filter-select:focus {
    outline: none;
    border-color: var(--persy-primary, #2987CC);
    box-shadow: 0 0 0 3px rgba(var(--persy-primary-rgb, 41, 135, 204), 0.14);
}

.persy-filter-bar .persy-filter-select:hover {
    border-color: var(--persy-primary, #2987CC);
}

.persy-filter-reset {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 1rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #666;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
    background: #fff;
}

.persy-filter-reset:hover {
    border-color: #e04f4f;
    color: #e04f4f;
}

.persy-filter-submit {
    padding: 0.6rem 1.25rem;
    background: var(--persy-primary, #2987CC);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.persy-filter-submit:hover {
    background: var(--persy-primary-dark, #1a6fb5);
}

@media (max-width: 600px) {
    .persy-filter-bar .persy-filter-select {
        flex: 1 1 calc(50% - 0.625rem);
    }

    .persy-filter-reset {
        flex: 1 1 100%;
        justify-content: center;
    }
}
