:root {
    /* Inherit main variables from jobs.css */
    /* Only define page-specific overrides if strictly necessary and consistent */
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    
    /* Use the primary color from jobs.css (Indigo) */
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    /* Match the lighter header from jobs.css */
    --gradient-header: linear-gradient(135deg, #f5f3ff 0%, #e0e7ff 100%);
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Page Header */
.page-header {
    background: var(--gradient-header);
    color: var(--text-main);
    padding: 60px 0 60px;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 700px;
    margin: 0 auto;
    font-weight: 500;
    color: var(--text-muted);
}

/* Job Detail Container */
.job-detail-container {
    background-color: #fff;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 2;
    margin-bottom: 60px;
    border: 1px solid var(--border-color);
}

.job-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
    background: transparent;
    color: var(--text-main);
    box-shadow: none;
}

.job-detail-header::before {
    display: none;
}

.job-title-wrapper h1 {
    font-size: 2.5rem;
    margin: 0 0 15px 0;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.job-type {
    display: inline-block;
    background: #e0e7ff;
    color: var(--primary-color);
    padding: 8px 20px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: none;
    border: none;
}

.job-actions {
    display: flex;
    gap: 15px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 1.1rem;
    text-decoration: none;
}

.btn i {
    margin-right: 10px;
}

.btn-apply {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.btn-apply:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
}

.btn-save {
    background-color: #fff;
    color: var(--text-muted);
    border: 2px solid var(--border-color);
}

.btn-save:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

/* Job Detail Body */
.job-detail-body {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 60px;
}

/* Meta Info */
.job-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.meta-item {
    display: flex;
    align-items: flex-start;
    background: #fff;
    padding: 25px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.meta-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.meta-item i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-right: 20px;
    margin-top: 5px;
}

.meta-text h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.meta-text p {
    margin: 0;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.2rem;
}

/* Sections */
.job-section {
    margin-bottom: 50px;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 25px;
    color: var(--text-main);
    font-weight: 800;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    opacity: 0.2;
}

.job-content {
    font-size: 1.15rem;
    color: #334155;
    line-height: 1.9;
}

.job-list {
    list-style: none;
    padding-left: 0;
}

.job-list li {
    margin-bottom: 18px;
    padding-left: 35px;
    position: relative;
    font-size: 1.15rem;
    color: #334155;
}

.job-list li::before {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #fff;
    background: var(--primary-color);
    position: absolute;
    left: 0;
    top: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

/* Sidebar */
.job-sidebar .sidebar-card {
    background-color: #fff;
    padding: 35px;
    border-radius: var(--radius-md);
    margin-bottom: 35px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.sidebar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-primary);
}

.sidebar-card h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.overview-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border-color);
}

.overview-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.overview-item i {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-right: 15px;
    width: 30px;
    text-align: center;
    background: rgba(79, 70, 229, 0.1);
    padding: 10px;
    border-radius: 10px;
}

.overview-text h4 {
    margin: 0 0 4px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.overview-text p {
    margin: 0;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.05rem;
}

.share-links {
    display: flex;
    gap: 12px;
}

.share-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background-color: #f1f5f9;
    color: var(--text-muted);
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1.2rem;
}

.share-link:hover {
    color: #fff;
    transform: translateY(-3px) rotate(5deg);
}

.share-link.facebook:hover {
    background-color: #1877f2;
    box-shadow: 0 4px 10px rgba(24, 119, 242, 0.3);
}

.share-link.twitter:hover {
    background-color: #1da1f2;
    box-shadow: 0 4px 10px rgba(29, 161, 242, 0.3);
}

.share-link.linkedin:hover {
    background-color: #0a66c2;
    box-shadow: 0 4px 10px rgba(10, 102, 194, 0.3);
}

.share-link.whatsapp:hover {
    background-color: #25d366;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    /* Darker overlay */
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    /* High z-index to sit above header */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: #fff;
    padding: 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal.show .modal-content {
    transform: scale(1);
}

/* Modal Header */
.modal-header {
    padding: 30px;
    background: var(--gradient-header);
    color: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    text-align: center;
}

.modal-header h2 {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    font-weight: 800;
}

.modal-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* Close Button */
.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Form Styling */
#job-application-form {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1rem;
}

.required {
    color: #ef4444;
}

.form-control {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: #f8fafc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background-color: #fff;
}

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

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

.file-upload-input {
    display: none;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8fafc;
    text-align: center;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background-color: #eef2ff;
    transform: scale(1.02);
}

.file-upload-label i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.file-upload-label span {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 5px;
}

.file-upload-label strong {
    color: var(--primary-color);
}

.file-upload-label small {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 10px;
}

.file-name {
    margin-top: 10px;
    padding: 10px;
    background-color: rgba(79, 70, 229, 0.1);
    border-radius: var(--radius-md);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.file-name:not(:empty) {
    display: block;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 18px 30px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.btn-submit.loading .spinner {
    display: inline-block;
}

.btn-submit.loading .btn-text {
    opacity: 0.7;
}

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

/* Form Footer */
.form-footer {
    margin-top: 20px;
    text-align: center;
}

.form-footer small {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-footer small a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.form-footer small a:hover {
    text-decoration: underline;
}

/* Error Messages */
.error-message {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 5px;
    display: none;
    font-weight: 500;
}

.error-message.show {
    display: block;
}

.form-control:invalid ~ .error-message {
    display: block;
}

.form-control.error {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.was-validated .form-control:invalid {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.was-validated .form-control:valid {
    border-color: var(--success-color, #10b981);
    background-color: rgba(16, 185, 129, 0.05);
}

/* General Error Styling for PHP errors */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #047857;
}

/* Responsive */
@media (max-width: 992px) {
    .job-detail-body {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .job-sidebar {
        order: 2;
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }

    .job-detail-container {
        padding: 20px;
        margin-top: -20px;
    }

    .job-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .job-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .job-meta {
        grid-template-columns: 1fr;
    }

    /* Mobile Modal Improvements */
    .modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 20px;
    }

    #job-application-form {
        padding: 20px;
    }
}