/* 1. CSS Variables for Consistent Styling */
:root {
    --primary-color: #4f7caa;
    --primary-hover: #59a6c7;
    --secondary-color: #040608;
    --accent-color: #1352a4;
    --background-color: #ffffff;
    --border-color: #dfe6e9;
    --box-shadow: rgba(0, 0, 0, 0.1);
    --box-shadow-hover: rgba(0, 0, 0, 0.15);
    --text-color: #2d3436;
    --link-color: #0984e3;
}

/* 2. Global Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: var(--background-color);
    color: var(--secondary-color);
    margin: 0;
    padding: 0;
    text-align: center;
    padding-top: 80px; /* Space for fixed navbar */
}

h1 {
    font-size: 2.5em;
    color: #8fcbf9; /* Custom color */
    margin: 20px 0;
}

/* 3. Navigation Bar */
header {
    background-color: var(--background-color);
    padding: 10px 0;
    box-shadow: 0 2px 4px var(--box-shadow);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin: 0;
    padding: 0;
}

.logo {
    width: 400px;
    height: auto;
    margin: 0;
    padding: 0;
}

.nav-center {
    flex: none;
    text-align: center;
}

.nav-title {
    font-size: 1.2em;
    color: var(--accent-color);
    font-weight: bold;
    text-align: center;
}

.nav-right {
    flex: 1;
}

/* 4. Mentor Caption */
.mentor-caption {
    font-size: 1em;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 5px;
    /* Removed text-align: center; */
}

/* 5. Direction Title */
.direction-title {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--accent-color);
    position: absolute;
    top: 0; /* 放置在容器顶部 */
    left: 50%;
    transform: translate(-50%, 0); /* 仅水平居中 */
    padding: 0px 10px;
    border-radius: 5px;
    pointer-events: none;
}

/* 6. Direction Container */
.direction-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 auto;
    width: 90%;
    max-width: 1200px;
}

/* 7. Direction */
.direction {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    background: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--box-shadow);
    padding: 80px 55px 10px 10px; /* 调整顶部填充 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.direction:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px var(--box-shadow-hover);
}

/* 8. Left Section */
.left-section {
    flex: 6.7; /* 70% */
    display: flex;
    flex-direction: column;
    align-items: center; /* 水平居中 */
    justify-content: center; /* 垂直居中 */
    font-size: 1em;
    color: var(--secondary-color);
    line-height: 1.6;
    text-align: left; /* 居中文本 */
    position: relative;
}

.left-section .project-image {
    max-width: 60%;
    height: auto;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.left-section .project-description {
    margin-top: 15px; /* 与图片间距 */
    max-width: 90%; /* 控制简介宽度 */
    text-align: justify; /* 居中文本 */
}

/* 9. Right Section */
.right-section {
    flex: 3.3; /* 30% */
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Mentor */
.right-section .mentor {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start; 
}

.mentor-photo {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 将内容对齐到右侧 */
    margin-right: 15px;
    width: 100%; /* 确保容器占满父容器宽度，以便正确对齐 */
}

.mentor-caption {
    align-self: flex-end; /* 在 flex 容器中将标题对齐到右侧 */
    font-size: 1em;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 5px;
}

.right-section .mentor img {
    width: 100px;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.right-section .mentor-info {
    display: flex;
    flex-direction: column;
    text-align: justify;
}

.right-section .mentor-info h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--secondary-color);
}

.right-section .mentor-info p {
    margin: 5px 0;
    font-size: 0.97em;
    color: var(--secondary-color);
}

/* 10. Project and Mentor Images */
.project-image {
    max-width: 100%;
    height: 5px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}


/* 固定图片的大小 */
.mentor-image {
    width: 200px;  /* 设置宽度为 200px */
    height: 150px; /* 设置高度为 150px */
    object-fit: cover; /* 确保图片不会失真，保持裁剪 */
    border-radius: 5px; /* 设置圆角为 5px */
    border: 1px solid var(--border-color); /* 设置边框 */
}

.mentor-image {
    border-radius: 15px; /* 为 mentor-image 设置更大圆角 */
}


/* 11. Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    color: var(--secondary-color);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 5px rgba(9, 132, 227, 0.5);
}

/* 12. Button Styles */
button, a {
    display: inline-block;
    padding: 10px 15px;
    margin: 10px 0;
    background-color: #fff;
    color: #000;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1em;
    transition: background 0.3s ease;
}

/* 13. Signup Button */
.signup-button {
    padding: 10px 20px;
    margin: 20px;
    background: #1581d3;
    color: #ffffff;
    border-radius: 5px;
    font-size: 1.2em;
    transition: background 0.3s ease;
}

.signup-button:hover {
    background: #7bbaf9;
}

/* 14. Return Button */
.return-button {
    padding: 10px 20px;
    margin: 10px 0;
    background: #b2bec3;
    color: #ffffff;
    border: 2px solid #b2bec3;
    border-radius: 5px;
    font-size: 1.2em;
    transition: background 0.3s ease, color 0.3s ease;
}

.return-button:hover {
    background: #b2bec3;
    color: #ffffff;
}

/* 15. Jump Button */
.jump-button {
    padding: 10px 20px;
    margin: 10px 0;
    background: #b2bec3;
    color: #ffffff;
    border: 2px solid #b2bec3;
    border-radius: 5px;
    font-size: 1.2em;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.jump-button:hover {
    background: #1e90ff;
    border-color: #3742fa;
    color: #ffffff;
}

/* 16. Gallery Styles */
.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    margin: 0 auto;
}

.gallery-item {
    background: var(--background-color);
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--box-shadow);
    width: calc(33% - 30px);
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px var(--box-shadow-hover);
}

.gallery-item img {
    max-width: 100%;
    height: auto;
    display: block;
    border-bottom: 1px solid var(--border-color);
}

.gallery-item h2 {
    font-size: 1.5em;
    color: var(--secondary-color);
    margin: 10px 0;
}

.gallery-item p {
    font-size: 1em;
    color: #636e72;
    margin: 10px;
}

/* 17. Container Styles for Sign Page */
.container {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    background: var(--background-color);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.container h1 {
    text-align: center;
    color: var(--secondary-color);
    font-size: 2.5em;
    margin-bottom: 20px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #636e72;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group input[type="file"],
.form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="file"]:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(9, 132, 227, 0.5);
}

.flashes {
    background: #fdd;
    padding: 10px;
    border: 1px solid #f00;
    list-style: none;
}

.flashes li {
    color: #f00;
}

.checkbox-group label {
    margin-right: 10px;
}

button.primary {
    background: var(--primary-color);
    border: none;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1em;
    transition: background 0.3s ease;
}

button.primary:hover {
    background: var(--primary-hover);
}

.signup-count {
    margin-top: 20px;
    font-size: 1.2em;
    color: var(--secondary-color);
}

form a {
    text-align: center;
    color: var(--link-color);
    font-size: 0.9em;
    text-decoration: none;
    margin-top: 10px;
}

form a:hover {
    text-decoration: underline;
}

/* 18. Responsive Design */

/* Medium Devices (Tablets, 768px and below) */
@media (max-width: 768px) {
    .gallery-item {
        width: calc(50% - 20px);
    }

    .direction {
        flex-direction: column;
        align-items: center;
        padding: 40px 20px 20px 20px; /* 调整小屏幕的填充 */
    }

    .left-section {
        padding-right: 0;
        margin-bottom: 20px;
        text-align: center;
    }

    .left-section .project-image {
        max-width: 60%;
    }

    .left-section .project-description {
        max-width: 100%; /* 适应小屏幕 */
    }

    .right-section {
        flex: 3;
        text-align: center;
        /* 保持左右紧密 */
    }

    .right-section .mentor {
        flex-direction: column;
        align-items: center;
    }

    .mentor-photo {
        margin-right: 0;
        margin-bottom: 10px;
        width: auto; /* 防止拉伸 */
        align-items: center; /* 居中对齐 */
    }

    .right-section .mentor img {
        margin-bottom: 10px;
    }

    .right-section .mentor-info {
        align-items: center;
        text-align: center;
    }

    .nav-title {
        font-size: 1.2em;
    }

    .direction-title {
        font-size: 1.3em;
        padding: 4px 8px;
    }
}

/* Small Devices (Mobile Phones, 480px and below) */
@media (max-width: 480px) {
    .gallery-item {
        width: 100%;
    }

    .direction-container {
        width: 95%;
    }

    .right-section .mentor img {
        width: 80px;
    }

    .left-section .project-image {
        max-width: 80%;
        top:12px;
        position:relative;
    }

    .nav-title {
        font-size: 1em;
    }

    .direction-title {
        font-size: 1.1em;
        padding: 1px 2px;
        top:-18px;
    }
    .form-group {
    margin-bottom: 15px;
}

.flashes {
    background: #fdd;
    padding: 10px;
    border: 1px solid #f00;
    list-style: none;
}

.flashes li {
    color: #f00;
}

.checkbox-group label {
    margin-right: 10px;
}
}
