/* CNS Careers Widget Styles */

.cns-careers-widget {
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.cns-careers-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #035182;
    margin-bottom: 1rem;
    text-align: center;
}

.cns-careers-description {
    font-size: 1.125rem;
    color: #4b5563;
    text-align: center;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Loading Spinner */
.cns-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.cns-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #035182;
    border-radius: 50%;
    animation: cns-spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.cns-loading p {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}

/* Error State */
.cns-error {
    text-align: center;
    padding: 2rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin: 1rem 0;
}

.cns-error p {
    color: #dc2626;
    margin-bottom: 1rem;
}

/* Modal Portal for maximum z-index */
#cns-modal-portal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2147483647 !important;
    pointer-events: none !important;
}

#cns-modal-portal .cns-modal-overlay {
    pointer-events: all !important;
}

/* Success Message */
.cns-success-message {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 2147483647 !important;
    background: #10b981 !important;
    color: white !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    animation: cns-slide-in 0.3s ease-out !important;
}

.cns-success-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cns-success-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    margin-left: 0.5rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes cns-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Filters */
.cns-filters {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid #e5e7eb;
}

.cns-filters h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.cns-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.cns-filters select {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-family: inherit;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.cns-filters select:focus {
    outline: none;
    border-color: #035182;
    box-shadow: 0 0 0 3px rgba(3, 81, 130, 0.1);
}

/* Jobs Grid */
.cns-jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Job Card */
.cns-job-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.cns-job-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(3, 81, 130, 0.15);
    border-color: #035182;
}

.cns-job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.cns-job-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    line-height: 1.4;
    flex: 1;
}

.cns-job-department {
    background: #035182;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.cns-job-excerpt {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.cns-job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cns-job-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.cns-job-meta-item svg {
    width: 16px;
    height: 16px;
    color: #9ca3af;
}

.cns-view-details-button {
    background: #035182;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.cns-view-details-button:hover {
    background: #024066;
    transform: translateY(-1px);
}

.cns-view-details-button:active {
    transform: translateY(0);
}

.cns-apply-button {
    background: #035182;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cns-apply-button:hover {
    background: #024066;
    transform: translateY(-1px);
}

.cns-apply-button:active {
    transform: translateY(0);
}

/* No Jobs State */
.cns-no-jobs {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
    grid-column: 1 / -1;
}

.cns-no-jobs p {
    font-size: 1.125rem;
    margin: 0;
}

/* Modal Styles */
.cns-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    padding: 1rem !important;
    animation: cns-fade-in 0.2s ease-out !important;
    overflow-y: auto !important;
}

.cns-modal {
    background: white !important;
    border-radius: 12px !important;
    max-width: 600px !important;
    width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    animation: cns-slide-up 0.3s ease-out !important;
    position: relative !important;
    z-index: 2147483647 !important;
    margin: auto !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    isolation: isolate !important;
}

.cns-job-details-modal {
    max-width: 800px !important;
}

@keyframes cns-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cns-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prevent body scroll when modal is open */
body.cns-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Additional scroll prevention for themes that use different containers */
body.cns-modal-open #page,
body.cns-modal-open #main,
body.cns-modal-open .site,
body.cns-modal-open .elementor {
    overflow: hidden !important;
}

/* Override common z-index conflicts with maximum specificity */
.cns-modal-overlay {
    z-index: 2147483647 !important;
}

/* Ensure modal stays above all Elementor elements */
.elementor .cns-modal-overlay,
.elementor-widget-container .cns-modal-overlay,
.elementor-section .cns-modal-overlay,
.elementor-column .cns-modal-overlay,
.e-con .cns-modal-overlay,
.e-parent .cns-modal-overlay,
.e-child .cns-modal-overlay {
    z-index: 2147483647 !important;
    position: fixed !important;
    isolation: isolate !important;
}

/* Override any theme or plugin z-index conflicts with maximum specificity */
html body .cns-modal-overlay {
    z-index: 2147483647 !important;
    position: fixed !important;
}

html body .cns-modal {
    z-index: 2147483647 !important;
    position: relative !important;
}

/* Force modal to be on top of everything */
.cns-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2147483647 !important;
    isolation: isolate !important;
}

/* Specific overrides for Elementor containers */
div[data-elementor-type] .cns-modal-overlay,
div[data-elementor-id] .cns-modal-overlay,
.elementor-element .cns-modal-overlay {
    position: fixed !important;
    z-index: 2147483647 !important;
    isolation: isolate !important;
}

/* Reset any transforms that might create new stacking contexts */
.cns-modal-overlay {
    transform: none !important;
    will-change: auto !important;
    contain: none !important;
}

/* Keep flexbox centering for modal */
.cns-modal-overlay .cns-modal {
    position: relative !important;
    margin: auto !important;
}

.cns-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.cns-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.cns-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cns-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Application Form */
.cns-application-form {
    padding: 1.5rem;
}

.cns-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cns-form-field {
    display: flex;
    flex-direction: column;
}

.cns-form-field label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.cns-form-field input,
.cns-form-field textarea,
.cns-form-field select {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
}

.cns-form-field input:focus,
.cns-form-field textarea:focus,
.cns-form-field select:focus {
    outline: none;
    border-color: #035182;
    box-shadow: 0 0 0 3px rgba(3, 81, 130, 0.1);
}

.cns-form-field input.error,
.cns-form-field textarea.error {
    border-color: #dc2626;
}

.cns-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

.error-message {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.submit-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.cns-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.cns-button-primary,
.cns-button-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.cns-button-primary {
    background: #035182;
    color: white;
}

.cns-button-primary:hover:not(:disabled) {
    background: #024066;
}

.cns-button-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.cns-button-secondary {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}

.cns-button-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Elementor Preview Styles */
.cns-preview-notice {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.cns-preview-notice h3 {
    color: #0369a1;
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
}

.cns-preview-notice p {
    color: #0c4a6e;
    margin: 0 0 1rem 0;
}

.cns-preview-notice ul {
    text-align: left;
    color: #0c4a6e;
    margin: 0;
    padding-left: 1.5rem;
}

.cns-preview-notice li {
    margin-bottom: 0.25rem;
}

/* Job Details Modal Styles */
.cns-modal-body {
    padding: 1.5rem;
}

.cns-job-details-meta {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.cns-detail-item {
    display: flex;
    gap: 0.25rem;
    color: #4b5563;
    font-size: 0.875rem;
}

.cns-detail-item strong {
    font-weight: 600;
    color: #1f2937;
}

.cns-job-details-section {
    margin-bottom: 1.5rem;
}

.cns-job-details-section:last-child {
    margin-bottom: 0;
}

.cns-job-details-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.cns-job-description,
.cns-job-requirements,
.cns-job-benefits {
    color: #4b5563;
    font-size: 0.9375rem;
    line-height: 1.7;
}

.cns-job-description p,
.cns-job-requirements p,
.cns-job-benefits p {
    margin-bottom: 0.75rem;
}

.cns-job-description ul,
.cns-job-requirements ul,
.cns-job-benefits ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.cns-job-description li,
.cns-job-requirements li,
.cns-job-benefits li {
    margin-bottom: 0.5rem;
}

.cns-modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cns-careers-title {
        font-size: 2rem;
    }
    
    .cns-jobs-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .cns-job-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .cns-job-department {
        align-self: flex-start;
    }
    
    .cns-form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .cns-form-actions {
        flex-direction: column;
    }
    
    .cns-modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .cns-filter-row {
        grid-template-columns: 1fr;
    }
    
    .cns-success-message {
        right: 10px;
        left: 10px;
        top: 10px;
    }
}

@media (max-width: 480px) {
    .cns-careers-title {
        font-size: 1.75rem;
    }
    
    .cns-job-card {
        padding: 1rem;
    }
    
    .cns-modal-header,
    .cns-application-form {
        padding: 1rem;
    }
}