/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --bg-main: #ffffff;
    --bg-side: #f8fafc;
    --text-main: #334155;
    --text-head: #0f172a;
    --border: #e2e8f0;
    --code-bg: #1e293b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg-main); color: var(--text-main); line-height: 1.8; }

.layout { display: flex; min-height: 100vh; }

/* 사이드바 */
.sidebar { width: 300px; background: var(--bg-side); border-right: 1px solid var(--border); padding: 40px 20px; position: fixed; height: 100vh; overflow-y: auto; }
.sidebar h2 { font-weight: 800; font-size: 1.2rem; margin-bottom: 30px; color: var(--primary); letter-spacing: -0.5px; }
.sidebar ul { list-style: none; }
.sidebar li { margin-bottom: 8px; }
.sidebar a { text-decoration: none; color: #64748b; font-size: 0.95rem; display: block; padding: 10px 15px; border-radius: 8px; transition: 0.2s; }
.sidebar a:hover, .sidebar a.active { background: #f1f5f9; color: var(--primary); font-weight: 600; }

/* 본문 영역 */
.content { margin-left: 300px; padding: 60px 80px; width: 100%; max-width: 1200px; }
.container { max-width: 850px; }

h1 { font-size: 2.8rem; font-weight: 800; color: var(--text-head); margin-bottom: 20px; letter-spacing: -1.5px; }
h2 { font-size: 1.8rem; font-weight: 700; color: var(--text-head); margin-top: 50px; margin-bottom: 20px; border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; }
h3 { font-size: 1.4rem; font-weight: 600; margin-top: 30px; color: var(--text-head); }

p { margin-bottom: 20px; font-size: 1.1rem; }
strong { color: var(--text-head); font-weight: 600; }

/* 코드 및 박스 */
pre { background: var(--code-bg); color: #f8fafc; padding: 25px; border-radius: 12px; font-family: 'Fira Code', monospace; font-size: 0.95rem; overflow-x: auto; margin: 25px 0; border: 1px solid #334155; }
code { background: #f1f5f9; color: #e11d48; padding: 2px 6px; border-radius: 4px; font-family: 'Fira Code', monospace; font-size: 0.9rem; }
pre code { background: none; color: inherit; padding: 0; }

.img-placeholder { width: 100%; background: #f8fafc; border: 2px dashed #cbd5e1; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 60px 20px; margin: 30px 0; color: #94a3b8; }
.img-placeholder i { font-size: 3rem; margin-bottom: 10px; }

.callout { background: #f0fdf4; border-left: 5px solid #22c55e; padding: 25px; border-radius: 4px 12px 12px 4px; margin: 30px 0; }
.callout.info { background: #eff6ff; border-left-color: #3b82f6; }
.callout.warn { background: #fff7ed; border-left-color: #f97316; }
.callout h4 { margin-bottom: 10px; color: var(--text-head); font-size: 1.1rem; }

.nav-btns { display: flex; justify-content: space-between; margin-top: 60px; padding-top: 30px; border-top: 1px solid var(--border); }
.btn { padding: 12px 25px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: 0.2s; }
.btn-prev { background: #f1f5f9; color: #475569; }
.btn-next { background: var(--primary); color: white; }
.btn:hover { opacity: 0.8; transform: translateY(-2px); }

@media (max-width: 1024px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 40px 20px; }
}
/* 코드 복사 버튼 스타일 */
.code-wrapper {
    position: relative;
    margin-bottom: 25px;
}

/* 예제 코드 박스 자체의 여백 조정 (버튼과 겹치지 않게) */
.code-wrapper pre {
    padding-top: 40px;
    padding-bottom: 40px;
    margin: 0;
}

/* 복사 버튼 공통 스타일 */
.copy-btn {
    position: absolute;
    background: rgba(241, 245, 249, 0.9); /* 연한 회색 반투명 */
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
}

.copy-btn i {
    margin-right: 4px;
}

/* 마우스 올렸을 때 효과 */
.copy-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 복사 완료되었을 때 효과 */
.copy-btn.copied {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

/* 위치 지정: 우측 상단 */
.btn-top {
    top: 10px;
    right: 10px;
}

/* 위치 지정: 우측 하단 */
.btn-bottom {
    bottom: 10px;
    right: 10px;
}
/* 사이드바 하단 핀아웃 버튼 영역 */
.sidebar-footer {
    padding: 20px 15px;
    margin-top: 30px;
}

.pinout-btn {
    width: 100%;
    padding: 12px;
    background: #2563eb; /* 신뢰감을 주는 파란색 */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.pinout-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* 팝업 모달 전체 배경 오버레이 */
.pinout-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2000; /* 최상단에 띄우기 */
    display: none; /* 기본 상태는 숨김 */
    align-items: center;
    justify-content: center;
}

/* 모달이 활성화되었을 때 클래스 */
.pinout-modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); /* 어두운 투명 배경 */
    backdrop-filter: blur(4px); /* 뒷배경 흐리게 효과 */
}

/* 팝업 창 본체 */
.modal-box {
    position: relative;
    background: white;
    padding: 30px 20px 20px 20px;
    border-radius: 16px;
    width: 85%;
    max-width: 1000px;
    height: 80%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    z-index: 2001;
    animation: modalSlideUp 0.3s ease-out;
}

/* 팝업 우측 상단 닫기 X 버튼 */
.modal-close-btn {
    position: absolute; top: 15px; right: 20px;
    font-size: 28px; border: none; background: none;
    cursor: pointer; color: #94a3b8; transition: color 0.2s;
}
.modal-close-btn:hover { color: #1e293b; }

.modal-box h3 {
    margin: 0 0 15px 0;
    font-size: 1.2rem; color: #1e293b;
    display: flex; align-items: center; gap: 8px;
}

/* 도면 이미지가 담기는 스크롤 박스 */
.modal-img-container {
    overflow: auto; /* 도면이 크므로 스크롤바가 생기도록 설정 */
    flex-grow: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px;
}

.modal-img-container img {
    display: block;
    margin: 0 auto;
    min-width: 850px; /* 핀 이름 글씨가 깨지지 않고 보이도록 최소 너비 유지 */
    max-width: 100%;
    height: auto;
}

/* 팝업이 아래서 위로 통 튀어오르는 애니메이션 */
@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}