/**
 * Job Offers Plugin - Frontend Styles
 * Design inspiré des captures d'écran fournies
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --job-primary: #6366f1;
    --job-primary-dark: #4f46e5;
    --job-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --job-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
    --job-text: #1f2937;
    --job-text-light: #6b7280;
    --job-text-muted: #9ca3af;
    --job-border: #e5e7eb;
    --job-bg: #ffffff;
    --job-bg-light: #f9fafb;
    --job-success: #10b981;
    --job-error: #ef4444;
    --job-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --job-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --job-radius: 16px;
    --job-radius-sm: 8px;
}

/* ==========================================================================
   Grid Container
   ========================================================================== */

.job-offers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 50px 15px;
}

.job-offers-container[data-columns="1"] .job-offers-grid { grid-template-columns: 1fr; }
.job-offers-container[data-columns="2"] .job-offers-grid { grid-template-columns: repeat(2, 1fr); }
.job-offers-container[data-columns="3"] .job-offers-grid { grid-template-columns: repeat(3, 1fr); }
.job-offers-container[data-columns="4"] .job-offers-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
    .job-offers-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .job-offers-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .job-offers-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Job Card
   ========================================================================== */
.job-offer-card {
    position: relative;
    border-radius: 25;
    padding: 25px 25px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.job-offer-card:before {
   content: '' !important;
   position: absolute !important;
   inset: 0;
   padding: 1px; /* épaisseur de ta bordure */
   background: linear-gradient(180deg, #1020B4 0%, #7814CF 77%, #FFF 97%);
   -webkit-mask: 
   linear-gradient(#fff 0 0) content-box, 
   linear-gradient(#fff 0 0);
   -webkit-mask-composite: xor;
   mask-composite: exclude;
   border-radius: inherit;
   pointer-events: none;
   border-radius: 25px !important;
}

.job-offer-title {
    font-size: 15px;
    font-weight: 400;
    color: #151515;
    margin: 0 0 8px 0;
    font-family: 'Lexend';
}

.job-offer-city {
    font-size: 12px;
    color: #1020B4;
    margin: -3px 0 20px 0;
    font-weight: 300;
    font-family: 'Lexend';
}

/* Tags */
.job-offer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.job-tag {
    position: relative;
    display: inline-block;
    padding: 5px 20px;
    font-size: 13px;
    font-weight: 300;
    color: #000;
    border-radius: 20px;
    font-family: 'Lexend';
}

.job-tag:after {
    content: '' !important;
   position: absolute !important;
   inset: 0;
   padding: 1px; /* épaisseur de ta bordure */
   background: linear-gradient(180deg, #1020B4 0%, #7814CF 77%, #FFF 97%);
   -webkit-mask: 
   linear-gradient(#fff 0 0) content-box, 
   linear-gradient(#fff 0 0);
   -webkit-mask-composite: xor;
   mask-composite: exclude;
   border-radius: inherit;
   pointer-events: none;
   border-radius: 28px !important;
}

/* Description */
.job-offer-description {
    font-size: 13px;
    color: #595959;
    line-height: 1.3;
    margin: 0 0 5px 0;
    font-family: 'Lexend';
    font-weight: 300;
}

/* Skills */
.job-offer-skills {
    margin-top: auto;
}

.skills-title {
    font-size: 13px;
    color: #595959;
    line-height: 1.3;
    margin: 0 0 5px 0;
    font-family: 'Lexend';
    font-weight: 300;
}

.skills-list {
    font-size: 13px;
    color: #595959;
    line-height: 1.3;
    margin: 0 0 5px 0;
    font-family: 'Lexend';
    font-weight: 300;
}

.job-offer-content {
    margin-bottom: 15px;
}

/* Apply Button */
.job-apply-btn {
    display: block;
    width: 100%;
    padding: 15px 24px;
    font-size: 16px;
    font-weight: 400;
    color: #ffffff;
    background: linear-gradient(90deg, #7814CF 0%, #1020B4 100%);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    text-align: center;
    border-radius: 50px;
    margin-top: auto;
    letter-spacing: .3px;
}

.job-apply-btn:hover {
    background: linear-gradient(90deg, #1020B4 0%, #7814CF 100%);
}

/* ==========================================================================
   Modal Overlay
   ========================================================================== */
.job-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.job-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Box */
.job-modal {
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.job-modal-overlay.active .job-modal {
    transform: scale(1) translateY(0);
    font-family: 'Lexend';
}

/* Close Button */
.job-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--job-bg-light);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: var(--job-text-light);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.job-modal-close:hover {
    background: var(--job-border);
    color: var(--job-text);
}

/* Modal Content */
.job-modal-content {
    padding: 40px;
    min-width: 1050px;
    max-width: 1050px;
    background-color: #FFF;
    border-radius: 18px;
}

.job-modal-title {
    font-size: 28px;
    font-weight: 500;
    color: #000;
    margin: 0 0 8px 0;
    text-align: center;
    font-family: 'Vinila Test';
}

.job-modal-subtitle {
    font-size: 14px;
    color: #000;
    margin: 0 0 32px 0;
    text-align: center;
    font-family: 'Lexend';
    font-weight: 300;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */
#jobApplicationForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 14px;
    font-weight: 400;
    color: #000;
    margin-bottom: 8px;
    font-family: 'Lexend';
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group select {
    height: 48px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--job-text);
    background: var(--job-bg);
    border: 1px solid var(--job-border);
    border-radius: var(--job-radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--job-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder {
    color: var(--job-text-muted);
}

/* Phone Input */
.phone-input-wrapper {
    display: flex;
    gap: 8px;
}

.phone-country-select {
    width: 110px !important;
    flex-shrink: 0;
    padding: 0 8px !important;
}

.phone-input-wrapper input[type="tel"] {
    flex: 1;
}

/* File Upload */
.file-upload-wrapper {
    position: relative;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.file-upload-button {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--job-bg-light);
    border: 1px dashed var(--job-border);
    border-radius: var(--job-radius-sm);
    color: #595959;
    font-size: 14px;
    font-family: 'Lexend';
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.file-upload-wrapper:hover .file-upload-button {
    border-color: #7814cf;
    background: rgba(99, 102, 241, 0.05);
}

.file-upload-wrapper.has-file .file-upload-button {
    border-color: var(--job-success);
    background: rgba(16, 185, 129, 0.05);
    color: var(--job-success);
}

.file-name {
    display: block;
    font-size: 12px;
    color: var(--job-success);
    margin-top: 4px;
}

/* Submit Button */
.submit-application-btn {
    height: 46px;
    padding: 0 32px;
    font-size: 16px;
    font-weight: 300;
    color: #ffffff;
    background: linear-gradient(90deg, #7814CF 0%, #1020B4 100%);
    border: none;
    border-radius: 28px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    margin-top: 12px;
    font-family: 'Vinila Test';
}

.submit-application-btn:hover {
    background: linear-gradient(90deg, #1020B4 0%, #7814CF 100%);
}

.submit-application-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Success Message
   ========================================================================== */
.job-modal-success {
    padding: 25px 40px;
    text-align: center;
    background-color: #ffffff;
    border-radius: 16px;
    max-width: 515px;
    width: 100%;
}

.success-icon {
    margin: 0 auto 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 80px;
    min-width: 80px;
    height: 80px;
    color: #ffffff;
}

.job-modal-success h2 {
    font-size: 26px;
    font-weight: 400;
    color: #000;
    margin: 0 auto 10px;
    font-family: 'Vinila Test';
}

.job-modal-success p {
    font-size: 15px;
    color: #595959;
    margin: 0;
    line-height: normal;
    font-family: 'Lexend';
    font-weight: 200;
}

.close-success-btn {
    height: 48px;
    padding: 0 48px;
    font-size: 15px;
    font-weight: 300;
    color: #ffffff;
    background: linear-gradient(90deg, #7814CF 0%, #1020B4 100%);
    border: none;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 15px;
    width: 100%;
    max-width: 100%;
}

.close-success-btn:hover {
    background: linear-gradient(90deg, #1020B4 0%, #7814CF 100%);
}

/* ==========================================================================
   Form Validation States
   ========================================================================== */
.form-group.error input,
.form-group.error select {
    border-color: var(--job-error);
}

.form-group .error-message {
    font-size: 12px;
    color: var(--job-error);
    margin-top: 4px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 600px) {
    .job-modal-content {
        padding: 24px;
    }
    
    .job-modal-title {
        font-size: 20px;
    }
    
    .job-modal-success {
        padding: 40px 24px;
    }
    
    .success-icon {
        width: 64px;
        height: 64px;
    }
    
}

#jobApplicationForm .iti__selected-dial-code {
    font-family: 'Lexend';
    font-weight: 400;
    font-size: 14px;
    color: #595959;
}

#jobApplicationForm .iti__country-list {
    font-family: 'Lexend';
    font-size: 14px;
    font-weight: 400;
}

/* ==========================================================================
   Spontaneous Application Form
   ========================================================================== */
.spontaneous-application-container {
    max-width: 860px;
    margin: 0 auto;
    font-family: 'Lexend';
}

.spontaneous-title {
    font-size: 28px;
    font-weight: 500;
    color: #000;
    margin: 0 0 30px 0;
    text-align: center;
    font-family: 'Vinila Test', sans-serif;
}

.spontaneous-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.spontaneous-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .spontaneous-form .form-row {
        grid-template-columns: 1fr;
    }
}

.spontaneous-form .form-group {
    display: flex;
    flex-direction: column;
}

.spontaneous-form .form-group.full-width {
    grid-column: 1 / -1;
}

.spontaneous-form label {
    font-size: 14px;
    font-weight: 400;
    color: #000;
    margin-bottom: 8px;
    font-family: 'Lexend', sans-serif;
}

.spontaneous-form input[type="text"],
.spontaneous-form input[type="email"],
.spontaneous-form input[type="tel"],
.spontaneous-form input[type="url"],
.spontaneous-form select,
.spontaneous-form textarea {
    padding: 14px 16px;
    font-size: 14px;
    color: #333;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Lexend', sans-serif;
    transition: border-color 0.2s ease;
    font-weight: 300;
}

.spontaneous-form input:focus,
.spontaneous-form select:focus,
.spontaneous-form textarea:focus {
    outline: none;
    border-color: #7814CF;
}

.spontaneous-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* Domain Options */
.domain-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.domain-label {
    font-weight: 400 !important;
    margin-bottom: 0 !important;
    font-size: 14px;
    color: #000;
    font-family: 'Lexend', sans-serif;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #000;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 15px;
    height: 15px;
    border: 1px solid #7814cf;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    transition: border-color 0.2s 
ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: #7814CF;
}

.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    background: #7814CF;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.radio-label {
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
}

/* Submit Button */
.submit-spontaneous-btn {
    height: 52px;
    padding: 0 32px;
    font-size: 16px;
    font-weight: 400;
    color: #ffffff;
    background: linear-gradient(90deg, #7814CF 0%, #1020B4 100%);
    border: none;
    border-radius: 28px;
    cursor: pointer;
    transition: background 0.3s ease;
    font-family: 'Lexend', sans-serif;
    margin-top: 10px;
}

.submit-spontaneous-btn:hover {
    background: linear-gradient(90deg, #1020B4 0%, #7814CF 100%);
}

.submit-spontaneous-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Success Message */
.spontaneous-success {
    text-align: center;
    padding: 40px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-width: 515px;
    width: 100%;
    margin: auto;
}

.spontaneous-success .success-icon {
    margin-bottom: 20px;
}

.spontaneous-success h2 {
    font-size: 26px;
    font-weight: 400;
    color: #000;
    margin: 0 auto 10px;
    font-family: 'Vinila Test';
}

.spontaneous-success p {
    font-size: 15px;
    color: #595959;
    margin: 0;
    line-height: normal;
    font-family: 'Lexend';
    font-weight: 200;
}

.close-spontaneous-btn {
    width: 100%;
    height: 48px;
    padding: 0 48px;
    font-size: 15px;
    font-weight: 400;
    color: #ffffff;
    background: linear-gradient(90deg, #7814CF 0%, #1020B4 100%);
    border: none;
    border-radius: 24px;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s ease;
}

.close-spontaneous-btn:hover {
    background: linear-gradient(90deg, #1020B4 0%, #7814CF 100%);
}

/* intl-tel-input styles for spontaneous form */
.spontaneous-form .iti {
    width: 100%;
}

.spontaneous-form .iti__selected-dial-code {
    font-family: 'Lexend', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #595959;
}

.spontaneous-form .domain-options .radio-option {
    margin-bottom: 0;
}

.spontaneous-form .domain-options .radio-option .radio-label {
    font-weight: 400;
}

@media (max-width: 992px) {

    .job-offers-container .job-offers-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .job-modal-overlay {
        padding: 10px;
    }

    .job-modal-content {
        min-width: 100%;
        max-width: 100%;
        width: 100%;
    }

    .job-modal {
        width: 100%;
    }

}

@media (max-width: 767px) {

    .job-offers-container .job-offers-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .job-offers-grid {
        gap: 15px;
    }

}
