/* General Styles */
:root {
    --primary-color: #333;
    /* 글자색 (진한 회색) */
    --secondary-color: #f5faff;
    /* 배경색 (아주 연한 파랑) */
    --card-bg: #fff;
    /* 카드와 사이드바 배경색 (흰색) */
    --border-color: #b0c4de;
    /* 경계선 색 (차분한 파랑-회색) */
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.main-container {
    position: relative;
}

/* Header Styles */
.portfolio-header {
    display: flex;
    align-items: center;
    padding: 10px 2rem;
    background-color: #fdfeff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.portfolio-title {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
    flex-grow: 1;
    text-align: center;
    margin: 0;
}

/* Sidebar Toggle Button - Hidden */
.toggle-btn {
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    z-index: 1002;
    display: none;
    /* Button hidden */
}

/* Sidebar - Always Open */
.sidebar {
    width: 150px;
    /* Width when open */
    background: var(--card-bg);
    padding: 1.5rem;      /* 변경: 전체적인 내부 여백 줄이기 */
    padding-top: 2.5rem;  /* 변경: 위쪽 여백 줄이기 */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: calc(100vh - 50px);
    /* Adjust height considering header */
    overflow-y: auto;
    top: 50px;
    /* Position below the header */
    z-index: 999;
}

.sidebar .profile {
    text-align: center;
    margin-bottom: 1rem; /* 변경: 프로필 아래 여백 줄이기 */
    display: block;
}

.sidebar .profile-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--border-color);
    margin: 0 auto 10px;
}

.sidebar .description {
    text-align: center;
    color: #666;
    font-style: italic;
    display: block;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin-top: 1.5rem; /* 변경: 네비게이션 위쪽 여백 줄이기 */
}

.sidebar-nav li a:hover {
    background-color: var(--secondary-color);
}

.sidebar-nav li a {
    display: flex;
    align-items: center;      /* 변경: 아이콘과 텍스트를 세로 중앙 정렬 */
    gap: 10px;
    padding: 10px 15px; /* 변경: 상하 패딩 다시 줄여보기 */
    text-decoration: none;
    color: var(--primary-color);
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.sidebar-nav .icon {
    font-size: 1.2em;
    line-height: 1; /* 아이콘 자체 줄간격 조정 */
}

.sidebar-nav .nav-text {
    visibility: visible;
    opacity: 1;
    font-size: 1rem;
    line-height: 1.2; /* 텍스트 줄 간격 명시적 설정 */
}

/* Main Content - Always Shifted */
.content {
    flex-grow: 1;
    padding: 2rem;
    margin-left: 200px;
    /* Fixed margin for open sidebar (150px width + 50px gap) */
}

.section {
    padding-top: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 2.5em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0;
    padding-bottom: 1rem;
}

/* About Section */
.info-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.info-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    flex: 1 1 250px;
}

.info-card p {
    margin: 5px 0;
}

.info-card span {
    font-size: 1.2em;
    margin-right: 5px;
}

.info-card a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-card a:hover {
    text-decoration: underline;
}

/* GitHub Link Button */
.github-link-container {
    text-align: center;
    margin-top: 30px;
}

.github-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 95%;
    max-width: 1100px;
    padding: 12px 20px;
    background-color: #95b3d1;
    border: 1px solid #87a6c5;
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.github-link-button:hover {
    background-color: #a6b5da;
}

.github-link-button .btn-icon {
    font-size: 1.2em;
}

/* Projects Section */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(370px, 1fr));
    gap: 30px;
}

.project-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 20px;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    flex-wrap: nowrap;
    gap: 10px;
}

.tag {
    background-color: #e0e0e0;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    white-space: nowrap;
}

.date {
    font-size: 0.75em;
    color: #666;
    white-space: nowrap;
}

.project-card img {
    width: 100%;
    height: auto;
    display: block;
}

/* Research & Publication Section */
#research .project-card {
    cursor: default;
    transition: none;
    padding: 20px;
}

#research .project-card:hover {
    transform: none;
}

/* Education Section */
.education-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.education-item h3 {
    margin-top: 0;
    margin-bottom: 5px;
}

.education-item .period {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.education-item .description {
    margin: 0;
}

/* Skills Section */
.skills-category {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.category-title {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 1.1em;
    width: 150px;
    /* Adjust if needed */
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-tag {
    background-color: #e0e0e0;
    color: #333;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 80%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 10px;
    position: relative;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 20px;
}

.modal-header h2 {
    text-align: center;
    margin-top: 0;
    padding-right: 30px;
}

.project-images {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.project-images img {
    max-width: 100%;
    height: auto;
}

/* Tech Stack Box and Buttons */
.tech-box {
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.9em;
    color: #555;
    margin-top: 15px;
    background-color: #f8f8f8;
}

.project-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 0 10px;
}

.project-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background-color: #f0f8ff;
    border: 1px solid #b0c4de;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.project-btn:hover {
    background-color: #e3f2fd;
}

/* Specific button style for PROJECTS section (VERTICAL) */
#projects .project-btn {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 10px 5px;
    min-width: 75px;
    text-align: center;
}

/* Contact Section */
.contact-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.contact-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    flex: 1 1 250px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}

.contact-item span {
    font-size: 1em;
}

/* Video Modal Styles */
.modal-body .video-title {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 20px;
}

.video-container {
    /* For YouTube iframe */
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-container-local video {
    /* Style for local video */
    max-height: 70vh;
    display: block;
    margin: auto;
}


/* Footer Info in Sidebar */
.footer-info {
    text-align: left;
    margin-top: 1.5rem; /* 변경: 푸터 위쪽 여백 줄이기 */
    padding-left: 10px; /* 변경: 왼쪽 여백 줄이기 */
    font-size: 0.75em;  /* 변경: 글자 크기 줄이기 */
    color: #888;
    line-height: 1.3;   /* 변경: 줄 간격 더 줄이기 */
    overflow-wrap: break-word; /* 추가 */
}

.footer-info p {
    margin: 2px 0; /* 변경: 문단 간격 더 줄이기 */
}

/* Ensure footer details are always visible */
.footer-line-detailed {
    display: block;
}

/* ================================== */
/* Responsive Styles (Mobile First Approach - Example for max-width: 768px) */
/* ================================== */

@media (max-width: 768px) {

    /* --- Header Adjustments --- */
    .portfolio-header {
        padding: 10px 1rem;
    }

    .portfolio-title {
        font-size: 1.5em;
        text-align: left;
        margin-left: 10px;
    }

    /* --- Sidebar Adjustments --- */
    .sidebar {
        width: 120px; /* Smaller sidebar */
        padding: 1rem 0.5rem; /* Reduced padding */
        padding-top: 2rem;
        height: calc(100vh - 45px); /* Adjust height if needed */
        top: 45px; /* Adjust top if needed */
    }

    .sidebar .profile {
        margin-bottom: 0.5rem; /* Further reduce profile margin */
    }

    .sidebar .profile-img {
        width: 60px;
        height: 60px;
    }

    .sidebar .profile h3 {
        font-size: 1em;
        margin-top: 5px;
    }

    .sidebar .description {
        font-size: 0.8em;
        margin-bottom: 0.5rem; /* Further reduce description margin */
    }

    .sidebar-nav ul {
        margin-top: 1rem; /* Smaller margin above nav */
    }

    .sidebar-nav li a {
        padding: 8px 10px; /* Smaller link padding */
        gap: 8px;
    }

    .sidebar-nav .icon {
        font-size: 1em;
    }

    .sidebar-nav .nav-text {
        font-size: 0.9em;
    }

    /* --- [수정] Footer Info Adjustments for Small Screens --- */
    .footer-info {
        /* display: none; */  /* 이 부분을 삭제하거나 주석 처리 */
        margin-top: 1rem;     /* 작은 화면에서 위쪽 여백 더 줄이기 */
        padding-left: 8px;    /* 작은 화면에서 왼쪽 여백 더 줄이기 */
        font-size: 0.65em;    /* 작은 화면에서 글자 크기 더 줄이기 */
        line-height: 1.2;     /* 작은 화면에서 줄 간격 더 줄이기 */
        color: #888;
        overflow-wrap: break-word; /* 단어 깨짐 방지 */
    }

    .footer-info p {
        margin: 1px 0; /* 작은 화면에서 문단 간격 더 줄이기 */
    }

    /* --- Main Content Adjustments --- */
    .content {
        margin-left: 130px; /* Adjust margin for 120px sidebar */
        padding: 1rem;
    }

    .section-title {
        font-size: 1.8em;
        padding-bottom: 0.5rem;
    }

    /* --- Grid Layouts (Single Column) --- */
    .info-grid,
    .project-grid,
    .contact-grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .info-card,
    .project-card,
    .contact-card {
        flex-basis: auto;
        width: auto;
    }

    /* --- Project Card Adjustments --- */
    .project-card {
        padding: 15px;
    }

    .project-header {
        padding: 10px;
    }

    .project-buttons {
        flex-wrap: wrap;
        justify-content: space-around;
        gap: 8px;
    }

    #projects .project-btn {
        min-width: 65px;
        font-size: 0.8em;
        padding: 8px 3px;
    }

    .tech-box {
        font-size: 0.8em;
        padding: 8px;
    }

    /* --- Skills Section Adjustments --- */
    .skills-category {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .category-title {
        width: auto;
        font-size: 1em;
    }

    .skill-tag {
        font-size: 0.8em;
        padding: 4px 10px;
    }

    /* --- Modal Adjustments --- */
    .modal-content {
        width: 90%;
        margin: 10% auto;
        padding: 1rem;
        max-height: 85vh;
    }

    .modal-header h2 {
        font-size: 1.3em;
    }

    .close-btn {
        top: 5px;
        right: 10px;
        font-size: 24px;
    }

    .pdf-container,
    .video-container,
    .video-container-local video {
        max-height: 65vh;
    }
} /* End of @media query */

/* Style for summary section in modal using Flexbox */
.modal-body .summary-container {
    display: flex;
    align-items: baseline;
    margin-bottom: 1em;
}

.modal-body .summary-title {
    flex-shrink: 0;
    margin-right: 0.5em;
    font-weight: bold;
}

.modal-body .summary-text {
    text-align: left;
}

/* Style for inline video in Details Modal */
.modal-body .details-video-container {
    max-width: 90%;
    margin: 25px auto;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

.modal-body .details-video-container video {
    display: block;
    width: 100%;
    max-height: 50vh;
}