/* Schmersal Jobs Widget - Isolated CSS with Namespace */

/* CSS Variables für konsistentes Theming */
:root {
    --schmersal-jobs-grey: #e0e0e0;
    --schmersal-jobs-font-color: #333;
    --schmersal-jobs-white: #fff;
    --schmersal-jobs-darkblue: #003e7e;
    --schmersal-jobs-border-radius: 5px;
    --schmersal-jobs-button-submit: #007bff;
    --schmersal-jobs-button-hover: #0056b3;
    --schmersal-jobs-form-error: #dc3545;
    --schmersal-jobs-focus-color: #4a90e2;
    --schmersal-jobs-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Container-level reset and isolation */
.schmersal-jobs-container {
    /* Reset all inherited styles */
    all: initial;
    /* Apply base styles */
    font-family: "Bio Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--schmersal-jobs-font-color);
    box-sizing: border-box;
    margin: 0;
    padding: 20px 0;
    display: block;
}

/* Ensure all children use border-box */
.schmersal-jobs-container *,
.schmersal-jobs-container *::before,
.schmersal-jobs-container *::after {
    box-sizing: inherit;
}

/* Screen reader only content */
.schmersal-jobs-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Filter Section */
.schmersal-jobs-filters {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.schmersal-jobs-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0;
}

/* Form Groups */
.schmersal-jobs-form-group {
    flex: 1 1 auto;
    min-width: 200px;
    margin: 0;
}

.schmersal-jobs-radius-group {
    flex: 1 1 auto;
    min-width: 300px;
    margin: 0;
}

/* Form Labels */
.schmersal-jobs-form-label,
.schmersal-jobs-radius-group legend {
    display: inline-block;
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--schmersal-jobs-font-color);
    font-size: inherit;
    white-space: nowrap;
}

.schmersal-jobs-radius-wrapper .schmersal-jobs-form-label {
    margin-bottom: 0;
    margin-right: 10px;
}

/* Form Controls */
.schmersal-jobs-form-control {
    display: block;
    width: 100%;
    padding: 10px;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: var(--schmersal-jobs-font-color);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--schmersal-jobs-white);
    background-clip: padding-box;
    border: 1px solid var(--schmersal-jobs-grey);
    border-radius: var(--schmersal-jobs-border-radius);
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    outline: 0;
}

.schmersal-jobs-form-control::placeholder {
    color: #666;
    opacity: 1;
}

.schmersal-jobs-form-control:focus {
    color: var(--schmersal-jobs-font-color);
    background-color: var(--schmersal-jobs-white);
    border-color: var(--schmersal-jobs-darkblue);
    outline: 2px solid var(--schmersal-jobs-focus-color);
    outline-offset: 2px;
}

/* Radius Wrapper */
.schmersal-jobs-radius-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

/* Radio Button Styling */
.schmersal-jobs-radius-controls {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}

.schmersal-jobs-radio {
    position: relative;
    display: inline-block;
}

.schmersal-jobs-radio label {
    font-weight: normal;
    margin: 0;
}

.schmersal-jobs-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    left: 0;
    top: 0;
    z-index: 1;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.schmersal-jobs-radio input[type="radio"] + label {
    position: relative;
    cursor: pointer;
    padding-left: 1.5em;
    display: inline-block;
    line-height: 1.2;
}

.schmersal-jobs-radio input[type="radio"] + label:before {
    content: '';
    display: inline-block;
    position: absolute;
    top: 0.1em;
    left: 0;
    width: 1em;
    height: 1em;
    border: 2px solid var(--schmersal-jobs-grey);
    border-radius: 50%;
    background-color: var(--schmersal-jobs-white);
    transition: all 0.2s ease;
}

.schmersal-jobs-radio input[type="radio"]:checked + label:before {
    border-color: var(--schmersal-jobs-darkblue);
    background-color: var(--schmersal-jobs-darkblue);
    box-shadow: inset 0 0 0 3px var(--schmersal-jobs-white);
}

.schmersal-jobs-radio input[type="radio"]:focus + label:before {
    outline: 2px solid var(--schmersal-jobs-focus-color);
    outline-offset: 2px;
}

/* Radius Input Wrapper */
.schmersal-jobs-radius-input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.schmersal-jobs-radius-input-wrapper .schmersal-jobs-form-control {
    width: 80px;
}

.schmersal-jobs-radius-unit {
    font-weight: normal;
    color: var(--schmersal-jobs-font-color);
}

/* Results Section */
.schmersal-jobs-results {
    margin-top: 30px;
}

.schmersal-jobs-results-info {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #666;
    font-weight: normal;
    text-align: center;
}

.schmersal-jobs-results-info #schmersal-jobs-results-count {
    font-weight: 600;
    color: var(--schmersal-jobs-font-color);
}

/* Job Grid */
.schmersal-jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    transition: opacity 0.3s ease;
    position: relative;
    min-height: 200px;
}

.schmersal-jobs-grid.loading {
    pointer-events: none;
}

.schmersal-jobs-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--schmersal-jobs-darkblue);
    border-radius: 50%;
    animation: schmersal-jobs-spin 1s linear infinite;
}

@keyframes schmersal-jobs-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Job Card Link */
.schmersal-jobs-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.schmersal-jobs-card-link:focus {
    outline: none;
}

/* Job Cards */
.schmersal-jobs-card {
    background: var(--schmersal-jobs-white);
    border: 2px solid var(--schmersal-jobs-grey);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    opacity: 0;
    height: 100%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Banner Image */
.schmersal-jobs-banner {
    margin: -20px -20px 15px -20px;
    width: calc(100% + 40px);
    height: 150px;
    overflow: hidden;
    background: var(--schmersal-jobs-grey);
    border-radius: 8px 8px 0 0;
}

/* Platzhalter für Karten ohne Banner mit Logo */
.schmersal-jobs-banner-placeholder {
    background: linear-gradient(135deg, #003e7e 0%, #0056b3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo Platzhalter Styling */
.schmersal-jobs-logo-placeholder {
    width: auto;
    height: 40px;
    opacity: 0.9;
}

/* Banner Bilder - volle Größe */
.schmersal-jobs-banner img:not(.schmersal-jobs-logo-placeholder) {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* Hover-Effekt nur für echte Banner-Bilder, nicht für Logo */
.schmersal-jobs-card:hover .schmersal-jobs-banner img:not(.schmersal-jobs-logo-placeholder) {
    transform: scale(1.05);
}

.schmersal-jobs-card.fade-in {
    animation: schmersal-jobs-fadeInUp 0.5s ease forwards;
}

@keyframes schmersal-jobs-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.schmersal-jobs-card:hover {
    transform: translateY(-15px) scale(1.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--schmersal-jobs-darkblue);
    transition: all 0.3s ease;
    z-index: 10;
}

.schmersal-jobs-card-link:focus .schmersal-jobs-card {
    outline: 2px solid var(--schmersal-jobs-focus-color);
    outline-offset: 2px;
}

/* Job Content */
.schmersal-jobs-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--schmersal-jobs-font-color);
    line-height: 1.3;
}

.schmersal-jobs-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 16px;
    margin-bottom: 12px;
}

.schmersal-jobs-location svg {
    flex-shrink: 0;
    stroke-width: 2;
}

.schmersal-jobs-location-text {
    line-height: 1.2;
}

.schmersal-jobs-details {
    flex: 1;
    margin-bottom: 16px;
}

.schmersal-jobs-type,
.schmersal-jobs-published {
    font-size: 16px;
    color: #666;
    margin-bottom: 6px;
}

.schmersal-jobs-type {
    font-weight: 500;
    color: var(--schmersal-jobs-darkblue);
}

.schmersal-jobs-published time {
    font-style: normal;
}

/* Job Link */
.schmersal-jobs-link {
    display: inline-flex;
    align-items: center;
    color: var(--schmersal-jobs-darkblue);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.3s;
    padding: 5px 0;
    margin-top: auto;
    pointer-events: none;
}

.schmersal-jobs-card:hover .schmersal-jobs-link {
    color: var(--schmersal-jobs-button-hover);
    text-decoration: none;
}

/* External link icon */
.schmersal-jobs-link.external-link:after {
    display: inline-block;
    font-family: bootstrap-icons !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin-right: .4em;
    margin-left: .4em;
    content: '\F1C5';
    font-size: 0.9em;
    transition: all .2s;
}

/* No Results */
.schmersal-jobs-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 18px;
}

/* Error Message */
.schmersal-jobs-error-message {
    background-color: #fee;
    color: var(--schmersal-jobs-form-error);
    padding: 15px;
    border-radius: var(--schmersal-jobs-border-radius);
    border: 1px solid #fcc;
    text-align: center;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .schmersal-jobs-container {
        padding: 10px 0;
    }
    
    .schmersal-jobs-filters {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .schmersal-jobs-filter-form {
        flex-direction: column;
        gap: 15px;
    }
    
    .schmersal-jobs-banner {
        height: 120px;
    }
    
    .schmersal-jobs-banner-placeholder {
        background: linear-gradient(135deg, #003e7e 0%, #0056b3 100%);
    }
    
    .schmersal-jobs-logo-placeholder {
        height: 30px;
    }
    
    .schmersal-jobs-form-group {
        min-width: 100%;
    }
    
    .schmersal-jobs-form-control {
        padding: 12px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    .schmersal-jobs-radius-group {
        min-width: 100%;
    }
    
    .schmersal-jobs-radius-wrapper {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .schmersal-jobs-radius-controls {
        flex-wrap: wrap;
        width: 100%;
        gap: 10px;
    }
    
    .schmersal-jobs-radius-input-wrapper {
        flex: 1 1 auto;
        display: flex;
        gap: 5px;
    }
    
    .schmersal-jobs-radius-input-wrapper .schmersal-jobs-form-control {
        flex: 1;
        min-width: 60px;
        max-width: 100px;
    }
    
    .schmersal-jobs-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .schmersal-jobs-card {
        padding: 15px;
    }
    
    .schmersal-jobs-results-info {
        font-size: 16px;
        margin-bottom: 15px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .schmersal-jobs-form-control {
        border-width: 2px;
    }
    
    .schmersal-jobs-card {
        border-width: 2px;
    }
    
    .schmersal-jobs-link {
        text-decoration: underline;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .schmersal-jobs-container *,
    .schmersal-jobs-container *::before,
    .schmersal-jobs-container *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}