/* ================================================================== */
/* 파워툴스 마스터클래스 - 공통 스타일시트                               */
/* powertools-articles.css                                              */
/* ================================================================== */

/* ------------------------------------------------------------------ */
/* 1. CSS 변수 (Design Tokens)                                         */
/* ------------------------------------------------------------------ */
:root {
    --primary-color:   #1a365d;
    --secondary-color: #2b6cb0;
    --text-color:      #2d3748;
    --border-color:    #e2e8f0;
    --highlight-bg:    #ebf8ff;
}

/* ------------------------------------------------------------------ */
/* 2. 기본 레이아웃                                                     */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
    line-height: 1.8;
    word-break: break-all;
    color: var(--text-color);
    background-color: #fff;
    margin: 0;
    padding: 40px 20px;
    overflow-x: hidden;
}

.main-wrapper {
    display: flex;
    max-width: 1140px;
    margin: 0 auto;
    position: relative;
}

.content-area {
    flex: 1;
    min-width: 0;
    max-width: 760px;
    padding-left: 50px;
}

.container {
    width: 100%;
    position: relative;
}

/* ------------------------------------------------------------------ */
/* 3. 사이드바                                                          */
/* ------------------------------------------------------------------ */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 40px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 25px;
    border-right: 1px solid var(--border-color);
}

.sidebar::-webkit-scrollbar { display: none; }

.sidebar h4 {
    font-size: 12px;
    color: #a0aec0;
    margin: 24px 0 10px;
    letter-spacing: 0.8px;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar h4:first-of-type { margin-top: 0; }

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li { margin-bottom: 4px; }

.sidebar-menu a {
    display: block;
    padding: 9px 12px;
    font-size: 13.5px;
    color: #4a5568;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.sidebar-menu a:hover {
    background-color: #f7fafc;
    color: var(--secondary-color);
}

.sidebar-menu li.active a {
    background-color: var(--highlight-bg);
    color: var(--secondary-color);
    font-weight: 700;
    border-left: 3px solid var(--secondary-color);
    border-radius: 0 6px 6px 0;
    padding-left: 9px;
}

/* ------------------------------------------------------------------ */
/* 4. 상단 내비게이션 바                                                */
/* ------------------------------------------------------------------ */
.top-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    color: #718096;
    margin-bottom: 30px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 8px;
}

.dropdown-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    color: var(--text-color);
    background-color: #fff;
    cursor: pointer;
    font-size: 13.5px;
    max-width: 100%;
}

.dropdown-select:focus {
    border-color: var(--secondary-color);
    outline: none;
}

/* ------------------------------------------------------------------ */
/* 5. 하단 이전/다음 내비게이션                                         */
/* ------------------------------------------------------------------ */
.bottom-nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.nav-card {
    border: 1px solid var(--border-color);
    padding: 18px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.nav-card:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}

.nav-card .dir {
    display: block;
    font-size: 11px;
    color: #a0aec0;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-card .title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-card.prev { text-align: left; }
.nav-card.next { text-align: right; }

.nav-card.disabled {
    opacity: 0.35;
    pointer-events: none;
    background-color: #fafafa;
}

/* ------------------------------------------------------------------ */
/* 6. 타이포그래피                                                       */
/* ------------------------------------------------------------------ */
h1 {
    font-size: clamp(22px, 4vw, 28px);
    color: var(--primary-color);
    line-height: 1.3;
    margin: 0 0 25px;
    font-weight: 800;
    letter-spacing: -0.5px;
    word-break: keep-all;
}

h2 {
    font-size: clamp(18px, 3vw, 22px);
    color: var(--primary-color);
    margin: 40px 0 15px;
    font-weight: 700;
    word-break: keep-all;
}

h3 {
    font-size: clamp(16px, 2.5vw, 20px);
    color: var(--primary-color);
    margin: 35px 0 15px;
    font-weight: 700;
    word-break: keep-all;
}

h4 {
    font-size: 16px;
    color: var(--primary-color);
    margin: 0 0 12px;
    font-weight: 700;
}

p {
    margin: 0 0 20px;
    font-size: 16px;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.intro {
    font-size: 17px;
    color: #4a5568;
    font-weight: 500;
}

.lesson-subtitle {
    font-size: clamp(16px, 2.5vw, 22px);
    font-weight: 500;
    color: #4a5568;
    margin: 6px 0 24px;
    word-break: keep-all;
}

.series-tag {
    font-size: 13px;
    font-weight: 700;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 40px 0;
}

kbd {
    background: #f1f3f5;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 13px;
    font-family: inherit;
    white-space: nowrap;
}

code {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.9em;
    word-break: break-all;
}

/* ------------------------------------------------------------------ */
/* 7. 수강생 인증 바                                                    */
/* ------------------------------------------------------------------ */
.user-auth-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--highlight-bg);
    border: 1px solid #bee3f8;
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    font-size: 14px;
    color: var(--secondary-color);
    flex-wrap: wrap;
    gap: 8px;
}

/* ------------------------------------------------------------------ */
/* 8. 영상 플레이어                                                     */
/* ------------------------------------------------------------------ */
.video-section { margin-bottom: 35px; }

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    background-color: #000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.video-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

.video-caption {
    font-size: 13px;
    color: #718096;
    margin: 10px 0 20px;
    text-align: center;
    font-style: italic;
}

/* ------------------------------------------------------------------ */
/* 9. 이미지                                                            */
/* ------------------------------------------------------------------ */
.pt_img { display: block; width: 100%; margin: 20px 0; }
.pt_img img { max-width: 100%; height: auto; display: block; border-radius: 6px; }

.img-desc {
    text-align: center;
    font-size: 0.875rem;
    color: #718096;
    margin: 6px 0 10px;
    padding: 4px 12px;
    display: block;
}

.image-placeholder {
    background-color: #f7fafc;
    border: 1px dashed #cbd5e0;
    border-radius: 6px;
    padding: 30px 20px;
    text-align: center;
    margin: 25px 0;
    color: #718096;
}

.image-placeholder .title {
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 5px;
    font-size: 14px;
}

.image-placeholder .desc {
    font-size: 13px;
    color: #a0aec0;
}

/* ------------------------------------------------------------------ */
/* 10. 콜아웃 / 체크리스트 / 경고 박스                                  */
/* ------------------------------------------------------------------ */
.callout-box {
    background-color: #fafafa;
    border-left: 4px solid var(--primary-color);
    padding: 18px 20px;
    margin: 28px 0;
    border-radius: 0 6px 6px 0;
}

.callout-box p {
    margin: 0;
    font-size: 15px;
    color: #4a5568;
}

.checklist-box {
    background-color: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    margin: 24px 0;
}

.checklist-title {
    margin-top: 0;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 16px;
}

.checklist-item {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
}

.checklist-item.last { margin-bottom: 0; }

.checklist-input {
    margin-right: 8px;
    transform: scale(1.1);
}

.warn-box {
    background: #fffbeb;
    border-left: 4px solid #f6ad55;
    border-radius: 0 4px 4px 0;
    padding: 16px 20px;
    margin: 20px 0;
}

.warn-box p { margin: 0; }

/* ------------------------------------------------------------------ */
/* 11. 유료 잠금 카드                                                   */
/* ------------------------------------------------------------------ */
.pay-fade-wrapper {
    position: relative;
    margin-top: -20px;
}

.pay-blurred-content {
    height: 150px;
    overflow: hidden;
    position: relative;
}

.pay-blurred-content::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, #fff 100%);
}

.premium-lock-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
    margin-top: 20px;
}

.premium-lock-card h4 {
    margin: 0 0 10px;
    font-size: 20px;
}

.premium-lock-card p {
    margin: 0 0 25px;
    font-size: 14px;
    color: #718096;
    line-height: 1.6;
}

.btn-pay-route {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 14px 40px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(26,54,93,0.1);
}

.btn-pay-route:hover { background-color: var(--secondary-color); }
.btn-pay-route:active { transform: scale(0.98); }

/* ------------------------------------------------------------------ */
/* 12. 레슨 전용 컴포넌트                                               */
/* ------------------------------------------------------------------ */

.tool-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
    background: #f8fafc;
}

/* 번호 스텝 박스 */
.step-box {
    counter-reset: step-counter;
    margin: 20px 0;
    padding-left: 0;
    list-style: none;
}

.step-box li {
    counter-increment: step-counter;
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.step-box li::before {
    content: counter(step-counter);
    min-width: 30px;
    height: 30px;
    background: var(--secondary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 3px;
}

.step-box li p { margin: 0; line-height: 1.7; }

/* 스텝 내용 묶음 — 번호 배지 옆에서 세로로 쌓이도록 */
.step-box li .step-body {
    flex: 1;
    min-width: 0;
}

.step-box li .step-body > *:first-child { margin-top: 0; }
.step-box li .step-body > *:last-child { margin-bottom: 0; }

/* 비교 테이블 */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 15px;
    border-top: 2px solid var(--secondary-color);
    border-bottom: 2px solid var(--secondary-color);
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compare-table table {
    min-width: 100%;
}

.compare-table th {
    background-color: var(--highlight-bg);
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.compare-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    word-break: keep-all;
}

.compare-table td:first-child {
    font-weight: 700;
    color: var(--secondary-color);
    white-space: nowrap;
}

/* AI 카드 */
.ai-card {
    display: flex;
    gap: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
    background: #fff;
}

.ai-card .ai-icon { font-size: 36px; flex-shrink: 0; }
.ai-card .ai-body h4 { margin: 0 0 8px; }
.ai-card .ai-body p { margin: 0; font-size: 15px; line-height: 1.6; }

/* 다음 레슨 예고 박스 */
.next-lesson-box {
    background-color: var(--highlight-bg);
    border: 1px solid #bee3f8;
    border-radius: 6px;
    padding: 20px;
    margin-top: 40px;
    text-align: center;
}

.next-lesson-box p { margin: 0; font-weight: 600; color: var(--secondary-color); }

/* ------------------------------------------------------------------ */
/* 13. TOP 버튼                                                         */
/* ------------------------------------------------------------------ */
#btn-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2b6cb0;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(43,108,176,0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, background 0.2s ease;
    z-index: 9999;
}

#btn-top:hover { background: #2c5282; }

#btn-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#btn-top svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ------------------------------------------------------------------ */
/* 14. 반응형                                                           */
/* ------------------------------------------------------------------ */

/* 태블릿 */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    .content-area { padding-left: 30px; }
}

/* 모바일 가로 / 소형 태블릿 */
@media (max-width: 768px) {
    body { padding: 20px 16px; }

    .sidebar { display: none; }

    .content-area {
        padding-left: 0;
        max-width: 100%;
    }

    .main-wrapper { display: block; }

    h1 { font-size: 22px; }
    h2 { font-size: 18px; margin-top: 32px; }
    h3 { font-size: 16px; margin-top: 28px; }

    .bottom-nav-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .nav-card.next { text-align: left; }

    .premium-lock-card { padding: 28px 20px; }

    .compare-table th,
    .compare-table td { font-size: 14px; padding: 10px; }

    .user-auth-bar { flex-direction: column; align-items: flex-start; }

    #btn-top { bottom: 20px; right: 20px; }

    .step-box li { gap: 10px; }

    .ai-card { flex-direction: column; }
    .ai-card .ai-icon { font-size: 28px; }
}

/* 모바일 세로 */
@media (max-width: 480px) {
    body { padding: 16px 12px; }

    .video-caption { font-size: 12px; }

    .callout-box { padding: 14px 16px; }
    .checklist-box { padding: 18px 16px; }
    .warn-box { padding: 14px 16px; }

    .btn-pay-route {
        display: block;
        padding: 14px 20px;
        text-align: center;
    }

    .step-box li::before {
        min-width: 26px;
        height: 26px;
        font-size: 13px;
    }
}

/* ------------------------------------------------------------------ */
/* 15. 햄버거 버튼 & 모바일 사이드바 드로어                             */
/* ------------------------------------------------------------------ */

/* 햄버거 버튼: 데스크톱에서는 숨김 */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    padding: 6px 8px;
    flex-shrink: 0;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: background 0.2s;
}

.hamburger-btn:hover span { background: var(--secondary-color); }

/* top-nav-bar 왼쪽 영역 */
.top-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.top-nav-location {
    font-size: 13.5px;
    color: #718096;
    white-space: nowrap;
}

/* 오버레이 (드로어 열렸을 때 배경 어둡게) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* 사이드바 드로어 */
.sidebar-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
}

.sidebar-drawer.open {
    transform: translateX(0);
}

/* 드로어 헤더 */
.sidebar-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.drawer-dashboard-link {
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary-color);
    text-decoration: none;
}

.drawer-dashboard-link:hover { text-decoration: underline; }

.sidebar-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #a0aec0;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
}

.sidebar-close-btn:hover {
    background: #f7fafc;
    color: var(--text-color);
}

/* 드로어 본문 */
.sidebar-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.sidebar-drawer-body h4 {
    font-size: 11px;
    color: #a0aec0;
    margin: 20px 0 8px;
    letter-spacing: 0.8px;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-drawer-body h4:first-child { margin-top: 0; }

.sidebar-drawer-body .sidebar-menu a {
    font-size: 14px;
    padding: 10px 12px;
}

/* 햄버거 → X 애니메이션 */
.hamburger-btn span {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-btn.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.is-open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* 햄버거 버튼 강제 노출을 위한 CSS */
@media (max-width: 768px) {
    .hamburger-btn {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1050;
        display: flex !important;
        /* 버튼 배경: 어두울 땐 밝게, 밝을 땐 어둡게 보임 */
        background: rgba(0, 0, 0, 0.6) !important; 
        border: none !important;
        padding: 8px !important;
        border-radius: 6px;
        /* 그림자를 넣어 배경색과 분리 */
        box-shadow: 0 2px 10px rgba(0,0,0,0.2) !important;
    }
    
    .hamburger-btn span {
        /* 선 색상을 무조건 흰색으로 고정 */
        background: #ffffff !important; 
    }
}