/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #0d47a1; /* 짙은 파랑 */
    --accent-color: #42a5f5;  /* 밝은 파랑 */
    --text-color: #333;
    --gray-text: #666;
    --bg-light: #f8f9fa;
    --sidebar-width: 250px;
}

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

html {
    scroll-behavior: smooth; /* 메뉴 클릭 시 부드럽게 이동 */
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-light);
    color: var(--text-color);
    overflow-x: hidden; /* 가로 스크롤 방지 */
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* =========================================
   1. 사이드바 (Sidebar)
   ========================================= */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--primary-color);
    color: #fff;
    transition: all 0.3s;
    height: 100vh;
    position: fixed; /* 스크롤 해도 고정 */
    top: 0;
    left: 0;
    z-index: 999;
}

/* 사이드바 숨김 처리 (JS에서 클래스 추가 시) */
#sidebar.hidden {
    margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-close-container {
    text-align: right;
    padding: 10px;
}

/* 닫기 버튼 */
#sidebarClose {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
}

#sidebarClose:hover {
    color: #fff;
}

.sidebar-header {
    padding: 0 20px 20px 20px;
    text-align: center;
    background: var(--primary-color);
}

.profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 4px solid var(--accent-color);
    object-fit: cover;
}

#sidebar ul.components {
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

#sidebar ul li a {
    padding: 15px 25px;
    font-size: 1.1em;
    display: block;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: 0.3s;
}

#sidebar ul li a:hover {
    background: var(--accent-color);
    color: #fff;
}

#sidebar ul li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

/* =========================================
   2. 사이드바 트리거 (Edge Trigger)
   ========================================= */
#sidebarOpenTrigger {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 30px; /* 감지 영역 너비 */
    z-index: 998;
    cursor: pointer;
    visibility: hidden; /* 사이드바가 열려있을 땐 숨김 */
    transition: background 0.3s;
}

/* 사이드바가 닫혔을 때만 트리거 영역 활성화 */
body.sidebar-closed #sidebarOpenTrigger {
    visibility: visible;
}

/* 엣지 영역 호버 시 시각적 피드백 */
body.sidebar-closed #sidebarOpenTrigger:hover {
    background: rgba(66, 165, 245, 0.4);
}

/* =========================================
   3. 메인 콘텐츠 (Main Content)
   ========================================= */
#content {
    width: 100%;
    margin-left: var(--sidebar-width); /* 사이드바 너비만큼 밀기 */

    /* [수정 포인트 1] 사이드바가 열려있을 때: 오른쪽에도 여백을 줌 */
    /* 왼쪽은 사이드바가 있으니 50px, 오른쪽은 100px 정도로 여백을 줘서 꽉 차 보이지 않게 함 */
    padding: 50px 100px 50px 50px;

    transition: all 0.3s;

    /* 내부 섹션 정렬을 위한 Flex 설정 */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* [수정 포인트 2] 사이드바가 닫혔을 때: 좌우 대칭으로 넓은 여백을 줌 */
body.sidebar-closed #content {
    margin-left: 0;

    /* 좌우를 15%~20% 정도로 넉넉하게 비워서 중앙에 예쁘게 모이게 함 */
    padding: 50px 15%;
}

/* 섹션 공통 스타일 */
.section {
    background: #fff;
    padding: 40px;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);

    /* 박스 크기 제어 */
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.section-header h2 {
    font-size: 1.8rem;
    color: #333;
    font-weight: 700;
}

.icon-link {
    font-size: 1.5rem;
    margin-right: 10px;
    color: var(--gray-text);
}

.highlight {
    color: var(--primary-color);
}

/* =========================================
   4. 컴포넌트 스타일 (Components)
   ========================================= */

/* --- About Me Grid --- */
.about-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.about-item {
    display: flex;
    align-items: center;
}

.about-item .icon-box {
    font-size: 1.8rem;
    color: var(--text-color);
    width: 50px;
    text-align: center;
    margin-right: 15px;
}

.about-item .info-box {
    display: flex;
    flex-direction: column;
}

.about-item .label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.about-item .value {
    font-size: 0.95rem;
    color: var(--gray-text);
    line-height: 1.4;
}

.about-item .link {
    text-decoration: none;
    color: var(--primary-color);
}

.about-item .link:hover {
    text-decoration: underline;
}

/* --- Skills --- */
.skill-category {
    margin-bottom: 25px;
}

.skill-category h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.skill-category h3 i {
    margin-right: 8px;
}

.skill-tags span {
    display: inline-block;
    background: #e3f2fd;
    color: var(--primary-color);
    padding: 8px 16px;
    margin: 0 5px 10px 0;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: 0.2s;
}

.skill-tags span:hover {
    background: var(--primary-color);
    color: #fff;
}

/* --- Projects (List Style) --- */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 25px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.project-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: var(--accent-color);
}

.project-main-info {
    display: flex;
    align-items: center;
    flex: 2;
    min-width: 0;
}

.project-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    margin-right: 20px;
    border: 1px solid #eee;
    background: #f8f9fa;
    flex-shrink: 0;
}

.project-text h3 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
    color: #333;
    font-weight: 700;
}

.project-text p {
    margin: 0;
    font-size: 0.95rem;
    color: #666;

    white-space: normal;
    word-break: keep-all; /* 단어 단위로 줄바꿈 (한글에 최적화) */
    line-height: 1.5;     /* 줄 간격 확보 */
}

.project-meta-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    flex: 0 0 auto;
    min-width: 280px; /* 최소 너비 확보 (필요에 따라 조절 가능) */
}

.project-meta {
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;

    /* [수정] 고정 너비를 주어 글자 길이에 상관없이 위치를 고정 */
    width: 200px;
    flex-shrink: 0; /* 공간이 좁아져도 찌그러지지 않게 고정 */
}

.project-meta.border-left {
    border-left: 1px solid #eee;
}

.project-meta:last-child {
    width: 160px;
}

.meta-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.meta-label i {
    margin-right: 6px;
    color: var(--gray-text);
}

.meta-value {
    font-size: 0.9rem;
    color: #555;
}

/* --- Contact Links --- */
.contact-links {
    display: flex;
    gap: 15px;
}

.channel-btn {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
    transition: transform 0.2s;
}

.channel-btn:hover {
    transform: translateY(-3px);
}

.channel-btn i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.channel-btn.github {
    background-color: #333;
}

.channel-btn.velog {
    background-color: #20c997;
}

/* =========================================
   5. 반응형 미디어 쿼리 (Media Queries)
   ========================================= */

/* 태블릿 (992px 이하) */
@media (max-width: 992px) {
    /* About Me 그리드 2열로 변경 */
    .about-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 프로젝트 카드 세로 정렬로 변경 */
    .project-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .project-main-info {
        margin-bottom: 20px;
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 15px;
    }

    .project-text p {
        white-space: normal;
    }

    .project-meta-group {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 15px;
    }

    .project-meta {
        padding: 0 20px 0 0;
    }

    .project-meta.border-left {
        border-left: none;
    }
}

/* =========================================
   6. OTHERS 섹션 스타일 (새로 추가됨)
   ========================================= */
.other-category {
    margin-bottom: 40px; /* 카테고리 간 간격 */
}

/* 카테고리 제목 (Awards 등) */
.other-category h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    display: inline-block;
    width: 100%;
}

.other-category h3 i {
    margin-right: 8px;
    color: var(--accent-color);
}

/* 리스트 컨테이너 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 개별 항목 (날짜 + 내용) */
.history-item {
    display: flex;
    align-items: flex-start;
}

/* 날짜 스타일 (왼쪽 고정) */
.history-item .date {
    min-width: 140px;
    font-weight: 500;
    color: #999;
    font-size: 0.95rem;
    margin-top: 2px;
}

/* 내용 스타일 (오른쪽) */
.history-item .history-content {
    flex: 1;
}

.history-item .history-content strong {
    display: block;
    font-size: 1.05rem;
    color: #333;
    margin-bottom: 4px;
}

.history-item .history-content p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* 프로젝트 카드를 클릭 가능한 요소처럼 보이게 함 */
.project-item {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* 프로젝트 내부 버튼 그룹 (간격 수정됨) */
.project-actions {
    display: flex;
    gap: 5px;

    margin-top: 20px;
    margin-bottom: 2px;
}

/* =========================================
   모달 (Modal) 스타일 (필수 추가)
   ========================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000; /* 사이드바(999)보다 높게 설정하여 위에 뜨게 함 */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s, visibility 0.3s;
}

/* 모달 숨김 상태 (JS에서 클래스 추가/제거로 제어) */
.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* 클릭 이벤트 차단 */
}

/* 배경 오버레이 (어두운 배경) */
.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* 반투명 검정 */
    backdrop-filter: blur(3px); /* 배경 흐림 효과 */
}

/* 모달 컨텐츠 박스 */
.modal-content {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 800px; /* 최대 너비 제한 */
    max-height: 85vh; /* 화면 높이의 85%까지만 차지 */
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow-y: auto; /* 내용이 넘치면 스크롤 생성 */
    z-index: 2001;
    padding: 0; /* 내부 여백은 readme-body에서 처리 */

    /* 나타날 때 애니메이션 */
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 닫기 버튼 (우상단 고정) */
.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    background: rgba(255, 255, 255, 0.8); /* 배경이 겹칠 수 있으므로 반투명 흰색 */
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    color: #333;
    background: #f1f3f5;
    transform: rotate(90deg); /* 회전 효과 */
}

/* --- 모달 내부 컨텐츠 스타일 (README 스타일) --- */
.readme-body {
    padding: 40px;
    line-height: 1.6;
    color: #333;
}

.readme-header {
    border-bottom: 2px solid #f1f3f5;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.readme-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.readme-header .subtitle {
    color: #868e96;
    font-size: 1rem;
    font-weight: 500;
}

.readme-section {
    margin-bottom: 40px;
}

.readme-section h3 {
    font-size: 1.4rem;
    color: #212529;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    font-weight: 700;
}

.readme-section h3 i {
    margin-right: 12px;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.readme-section ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.readme-section li {
    margin-bottom: 8px;
    color: #495057;
}

.readme-section li strong {
    color: #212529;
}

/* 문제 해결 박스 스타일 */
.problem-item {
    background: #f8f9fa;
    border-left: 4px solid var(--accent-color);
    padding: 20px 25px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
}

.problem-item h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 700;
}

.problem-item p {
    margin: 0;
    font-size: 0.95rem;
    color: #495057;
}

/* 스크롤바 스타일링 (모달 내부) */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 16px 16px 0;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* =========================================
   README 버튼 스타일
   ========================================= */

/* 버튼 기본 스타일 */
.btn-readme {
    /* 기존 스타일을 덮어쓰고 더 예쁘게 */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px; /* 크기 살짝 키움 */

    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%); /* 그라데이션 배경 */
    border: 1px solid #e9ecef;
    border-radius: 50px; /* 완전 둥근 알약 형태 */

    color: #495057;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;

    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}

.btn-readme i {
    color: var(--accent-color); /* 아이콘 색상 포인트 */
    font-size: 1rem;
}

/* 호버 효과 */
.btn-readme:hover {
    background: #fff;
    border-color: var(--accent-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15); /* 파란색 계열 그림자 */
}

.btn-readme:hover i {
    color: var(--primary-color);
}

/* 클릭 효과 */
.btn-readme:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    background: #f1f3f5;
}

/* 모바일 (768px 이하) */
@media (max-width: 768px) {
    /* About Me 그리드 1열로 변경 */
    .about-grid {
        grid-template-columns: 1fr;
    }

    /* 사이드바 기본 숨김 */
    #sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
    }

    /* 콘텐츠 마진 제거 */
    #content {
        /* 모바일에서는 여백이 너무 크면 안되므로 줄임 */
        padding: 80px 20px 20px 20px;
    }

    body.sidebar-closed #content {
        padding: 80px 20px 20px 20px;
    }

    .history-item {
        flex-direction: column; /* 모바일에서는 세로로 배치 */
        margin-bottom: 10px;
    }

    .history-item .date {
        min-width: auto;
        margin-bottom: 5px;
        /* color: var(--accent-color);  <-- 이 줄을 지우거나 아래처럼 변경 */
        color: #999; /* 모바일에서도 회색 유지 */
    }

    /* 모바일에서는 '엣지 트리거' 방식이 터치로 어려울 수 있으나,
       일관성을 위해 유지하거나 필요 시 상단 바를 추가할 수 있음 */
}