/* Reset and Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Elementor Container Override */
.elementor-html-tag {
    width: 100% !important;
    max-width: none !important;
}

.elementor-widget-html {
    width: 100% !important;
    max-width: none !important;
}


body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}


.container {
    width: 100%;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e3e3e3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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


/* Positions Overview Styles */
.positions-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.position-card {
    position: relative;
    height: 300px;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease, opacity 0.4s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.position-card.selected {
    transform: scale(1.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* 选中状态下的背景蒙版保持0.1黑色 */
.position-card.selected[data-job="admin"] .position-background {
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('https://hkujcesgri.hku.hk/wp-content/uploads/2025/08/admin_2.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.position-card.selected[data-job="ra"] .position-background {
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('https://hkujcesgri.hku.hk/wp-content/uploads/2025/08/research_2.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.position-card.selected[data-job="student_helper"] .position-background {
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('https://hkujcesgri.hku.hk/wp-content/uploads/2025/08/student_2.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.position-card.deselected {
    transform: scale(0.95);
    opacity: 0.7;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 非选中状态下保持白色蒙版不变（如果有的话，这里不做额外处理，保持原有样式） */

.position-card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.position-background {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

/* Individual position backgrounds */
.position-card[data-job="admin"] .position-background {
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('https://hkujcesgri.hku.hk/wp-content/uploads/2025/08/admin_2.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.position-card[data-job="ra"] .position-background {
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('https://hkujcesgri.hku.hk/wp-content/uploads/2025/08/research_2.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.position-card[data-job="student_helper"] .position-background {
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('https://hkujcesgri.hku.hk/wp-content/uploads/2025/08/student_2.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.position-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    color: white;
    padding: 2rem;
    text-align: left;
}

.position-overlay * {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.position-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.position-summary {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem !important;
    opacity: 0.9;
}

.view-details-btn {
    background: #385a48;
    color: white;
    border: 2px solid #385a48;
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.view-details-btn:hover {
    background: #2d4a3a;
    border-color: #2d4a3a;
    transform: scale(1.05);
}

/* Job List Styles */
.job-list {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    opacity: 0;
    max-height: 0;
    transition: all 0.5s ease-in-out;
}

.job-list.show {
    opacity: 1;
    max-height: 2000px;
}

.job-list.hidden {
    display: none;
}

.list-container {
    padding: 2rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.category-title {
    font-size: 2rem;
    color: #2c3e50;
    font-weight: 600;
}

.list-content {
    margin-top: 1rem;
}

.jobs-table-wrapper {
    overflow-x: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.jobs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 1rem;
}

.jobs-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #2c3e50;
}

.jobs-table thead th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jobs-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.jobs-table tbody tr:last-child {
    border-bottom: none;
}

.jobs-table tbody tr:hover,
.jobs-table tbody tr.hover {
    background: linear-gradient(135deg, #f8f9ff 0%, #f5f7ff 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.jobs-table td {
    padding: 1.2rem 1.5rem;
    vertical-align: top;
}

.job-title-cell {
    width: 50%;
}

.job-title-link {
    background: none;
    border: none;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    padding: 0;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    width: 100%;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

.job-title-link:hover {
    color: #667eea;
    text-shadow: 0.5px 0 0 currentColor;
    transform: translateX(5px);
}

.job-date-cell {
    width: 25%;
    color: #495057;
    font-weight: 500;
}

.job-status-cell {
    width: 25%;
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.available {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

.status-badge.available:hover {
    background: linear-gradient(135deg, #20c997, #17a2b8);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.status-badge.closed {
    background: #6c757d;
    color: white;
}

/* Job Details Styles */
.job-details {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    opacity: 0;
    max-height: 0;
    transition: all 0.5s ease-in-out;
}

.job-details.show {
    opacity: 1;
    max-height: 2000px;
}

.job-details.hidden {
    display: none;
}

.details-container {
    padding: 2rem;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.details-nav {
    margin-bottom: 1rem;
}

.back-btn {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-btn:hover {
    background: linear-gradient(135deg, #495057, #343a40);
    transform: translateX(-3px);
}

.job-title {
    font-size: 2rem;
    color: #2c3e50;
    font-weight: 600;
    margin-top: 0.5rem;
    max-width: 600px;
    word-wrap: break-word;
    line-height: 1.3;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.description-section {
    margin-bottom: 2rem;
}

.job-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #495057;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.details-grid h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.responsibilities-list,
.requirements-list,
.benefits-list {
    list-style: none;
}

.responsibilities-list li,
.requirements-list li,
.benefits-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.5;
}

.responsibilities-list li::before {
    content: "✓";
    color: #28a745;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.requirements-list li::before {
    content: "•";
    color: #007bff;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.benefits-list li::before {
    content: "★";
    color: #ffc107;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.apply-section {
    text-align: center;
    padding-top: 2rem;
    border-top: 2px solid #e9ecef;
}

.apply-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 20px rgba(0, 123, 255, 0.3);
}

.apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 123, 255, 0.4);
}

/* Application Form Styles */
.application-form {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease-in-out;
}

.application-form.show {
    opacity: 1;
    max-height: 3000px;
}

.application-form.hidden {
    display: none;
}

.form-container {
    padding: 2rem;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.form-title {
    font-size: 1.8rem;
    color: #2c3e50;
    font-weight: 600;
}

.form-fields {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.form-field label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.form-field label.required::after {
    content: " *";
    color: #dc3545;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

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

.form-field input[type="file"] {
    padding: 0.5rem;
    border: 2px dashed #dee2e6;
    background: #f8f9fa;
}

.form-field.error input,
.form-field.error select,
.form-field.error textarea {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.field-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

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

.cancel-btn,
.submit-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.cancel-btn {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.cancel-btn:hover {
    background: #5a6268;
    border-color: #5a6268;
}

.submit-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-color: #28a745;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.3);
}

.submit-btn:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Message Styles */
.success-message,
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.success-message.show,
.error-message.show {
    opacity: 1;
}

.success-message.hidden,
.error-message.hidden {
    display: none;
}

.success-content,
.error-content {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.success-icon {
    width: 60px;
    height: 60px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1rem auto;
}

.error-icon {
    width: 60px;
    height: 60px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1rem auto;
}

.success-content h3,
.error-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.success-content p,
.error-content p {
    color: #6c757d;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.ok-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ok-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* Phone Input Container Styles */
.phone-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.country-code-input {
    flex: 0 0 80px;
    max-width: 80px;
    min-width: 80px;
    width: 80px !important;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.country-code-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.phone-number-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.phone-number-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-overlay.hidden {
    display: none;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.show {
    display: block !important;
}

/* Responsive Design */

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.6rem;
    }
    
    .header-perks {
        padding: 1rem;
    }
    
    .header-perks h2 {
        font-size: 1.3rem;
    }
    
    .positions-overview {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .position-card {
        height: auto;
        min-height: 250px;
    }
    
    .position-background {
        min-height: 250px;
        height: 100%;
    }
    
    .position-overlay {
        position: relative;
        padding: 1.5rem;
        min-height: 250px;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }
    
    .position-title {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
        white-space: nowrap; /* 防止标题换行 */
        overflow: hidden;
        text-overflow: ellipsis; /* 如果太长则显示省略号 */
    }
    
    .position-summary {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 1rem !important;
    }
    
    .view-details-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        width: auto;
        align-self: flex-start;  /* 让按钮左对齐，不拉伸 */
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 优化移动端job-details显示 */
    .job-details.show {
        max-height: none;
        height: auto;
    }
    
    .job-details {
        margin-bottom: 1rem;
        border-radius: 10px;
    }
    
    /* 确保详情内容区域有足够的最小高度和适当的滚动 */
    .details-container {
        padding: 1rem;
        min-height: auto;
    }
    
    /* 优化详情页面的标题和内容间距 */
    .details-header {
        display: flex;
        flex-direction: column;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
        border-bottom: 2px solid #e9ecef;
    }
    
    /* 第一行：返回按钮和关闭按钮 */
    .details-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }
    
    /* 将关闭按钮移到details-nav容器中（通过CSS） */
    .details-header {
        position: relative;
    }
    
    .close-btn {
        position: absolute;
        top: 0;
        right: 0;
    }
    
    /* 第二行：职位标题 */
    .job-title {
        font-size: 1.3rem;
        margin-top: 2rem; /* 为上面的按钮行留出空间 */
        margin-bottom: 0;
        word-break: break-word;
        line-height: 1.4;
    }
    
    
    /* 优化列表样式以适应移动端 */
    .responsibilities-list li,
    .requirements-list li,
    .benefits-list li {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 0.5rem;
    }
    
    /* 优化详情页面的按钮和交互元素 */
    .back-btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        margin-bottom: 1rem;
    }
    
    .close-btn {
        padding: 0.5rem 0.7rem;
        font-size: 1.2rem;
        height: fit-content;
    }
    
    .apply-btn {
        width: 100%;
        margin-top: 1.5rem;
        padding: 1rem;
        font-size: 1rem;
    }
    
    /* 优化职位描述文字 */
    .job-description {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .cancel-btn,
    .submit-btn {
        width: 100%;
    }

    /* Table responsive styles */
    .list-container,
    .details-container,
    .form-container {
        padding: 1rem;
    }

    .category-title,
    .job-title {
        font-size: 1.5rem;
    }

    .jobs-table-wrapper {
        box-shadow: none;
        border-radius: 8px;
    }

    .jobs-table {
        font-size: 0.9rem;
    }

    .jobs-table thead th {
        padding: 0.8rem 1rem;
        font-size: 0.8rem;
    }

    .jobs-table td {
        padding: 1rem;
    }

    .job-title-link {
        font-size: 1rem;
    }

    .job-date-cell {
        font-size: 0.9rem;
    }

    .status-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
    }

    /* 优化应用表单的移动端显示 */
    .application-form.show {
        max-height: none;
        height: auto;
    }
    
    .application-form {
        margin-bottom: 1rem;
        border-radius: 10px;
    }
    
    .back-btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}