/*static/css/main.css */

/* static/css/main.css - 최종 통합 완결판 */

/* --- [0] Local Font Setup (Pretendard) --- */
@font-face {
    font-family: 'Pretendard';
    src: url('../fonts/Pretendard-Regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('../fonts/Pretendard-SemiBold.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('../fonts/Pretendard-Bold.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}

/* --- [1] 글로벌 변수 및 초기화 --- */
:root {
    --primary-blue: #3b82f6;
    --sidebar-bg: #1e293b;
    --sidebar-width: 260px;
    --header-height: 64px;
    --slate-400: #94a3b8;
    --slate-700: #334155;
    --light-bg: #f1f5f9;
    --base-font-size: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Pretendard', -apple-system, system-ui, sans-serif !important;
    letter-spacing: -0.025em;
    -webkit-font-smoothing: antialiased;
    color: #111;
    background: #fafafa;
}

/* --- [2] 대시보드 레이아웃 구조 --- */
.dashboard-body { overflow: hidden; height: 100vh; }


.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #f8fafc;
    display: flex; flex-direction: column; flex-shrink: 0;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 1050; overflow-y: auto;
}

.app-main {
    flex: 1; display: flex; flex-direction: column;
    background-color: var(--light-bg); overflow-y: auto; min-width: 0;
}
.app-content {
    flex: 1;           /* 🚀 남는 공간을 확장해서 푸터를 맨 아래로 밀어냄 */
    padding: 2rem;
    display: block;
}

/*.app-header {*/
/*    height: var(--header-height); background-color: #fff;*/
/*    border-bottom: 1px solid #e2e8f0; display: flex;*/
/*    align-items: center; justify-content: space-between;*/
/*    padding: 0 2rem; flex-shrink: 0; z-index: 1040;*/
/*}*/

.app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    min-height: 100vh;
}

.app-footer {
    padding: 1.5rem 2rem; background-color: #fff;
    border-top: 1px solid #e2e8f0; width: 100%; margin-top: auto;
}

/* --- [3] 사이드바 내부 UI 디자인 --- */
/*.sidebar-header {*/
/*    background-color: var(--sidebar-bg);*/
/*    min-height: 64px; padding: 1.25rem 1.5rem;*/
/*    border-bottom: 1px solid rgba(255, 255, 255, 0.05);*/
/*    display: flex; align-items: center; justify-content: space-between;*/
/*}*/

.sidebar-nav-wrapper { padding: 0; }

.nav-section-title {
    margin-top: 1.5rem; margin-bottom: 0.5rem; padding: 0 16px;
    display: flex; align-items: center;
}
.nav-section-title::after {
    content: ""; flex: 1; height: 1px;
    background: rgba(255,255,255,0.05); margin-left: 10px;
}
.nav-section-title small {
    color: var(--primary-blue) !important;
    font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
}

.navbar-nav .nav-link {
    border-radius: 8px; /* 둥근 배경 */
    transition: all 0.2s ease-in-out;
    font-weight: 600;
    color: #475569 !important;
}

/* 🚀 마우스 올렸을 때 (Hover) */
.navbar-nav .nav-link:hover {
    color: var(--primary-blue) !important;
    background-color: rgba(59, 130, 246, 0.05); /* 아주 연한 파란색 배경 */
}
/* 🚀 기존 .active-link와 .active-link::after 부분을 지우고 아래로 교체하세요 */

/* 우선순위를 높이기 위해 앞에 부모 클래스를 붙입니다 */
.navbar-nav .nav-link.active-link {
    font-weight: 700 !important;
    border-radius: 8px;
    position: relative;
    padding: 8px 16px !important;            /* 크기 보정 */
}

/* 블록 안에서 더 확실한 포인트를 주려면 아래 선 스타일을 유지하세요 */
.navbar-nav .nav-link.active-link:before {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 20%;
    right: 20%;
    height: 2px;
    background-color: rgba(59, 130, 246, 1) !important;
    border-radius: 2px;
}
.nav-auth-section {
    border-top: none !important; /* PC에서 선 제거 */
    padding-top: 0 !important;
    margin-top: 0 !important;
    display: flex;
    align-items: center;
}

/* 메인 링크 스타일 */
.dashboard-link {
    color: #cbd5e1 !important;
    padding: 10px 16px !important;
    display: flex; align-items: center;
    border-radius: 8px; text-decoration: none;
    margin-bottom: 4px; font-size: 1rem;
    transition: all 0.2s ease;
}
.nav-icon-svg { width: 18px; height: 18px; margin-right: 12px; flex-shrink: 0; opacity: 0.8; }
.dashboard-link.active { background-color: var(--primary-blue); color: #fff !important; }
.dashboard-link:hover:not(.active) { background-color: var(--slate-700); color: #fff !important; }

/* ★ 하위 메뉴 Active 스타일 보강 ★ */
.dashboard-sub-link {
    color: var(--slate-400) !important;
    padding: 8px 16px 8px 46px !important;
    text-decoration: none; display: block; font-size: 0.85rem;
    transition: color 0.2s;
}
.dashboard-sub-link:hover, .dashboard-sub-link.active {
    color: var(--primary-blue) !important; /* 활성화 시 파란색 */
    font-weight: 600;
}

/* --- [4] 공통 및 기존 UI (복구 완료) --- */
.container { max-width: 1140px; margin: 0 auto; }

/* 드롭존 업로드 영역 */
.dropzone, .pdf-dropzone {
    border: 2px dashed #cfd4dc; border-radius: 12px; padding: 40px;
    text-align: center; background: #fff; transition: all .2s;
    margin: 12px 0; cursor: pointer; user-select: none;
}
.dropzone:hover, .pdf-dropzone:hover { border-color: var(--primary-blue); background: #f8fafc; }
.dropzone.is-dragover, .pdf-dropzone.dragover { background: #eef6ff; border-color: var(--primary-blue); }

/* 카드 스타일 */
.card {
    background:#fff; border:1px solid rgba(15,23,42,0.08);
    border-radius:16px; padding:20px; margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 메인 퀵 카드 */
.st-qcard {
    background: #fff; border: 1px solid rgba(15,23,42,0.08); border-radius: 16px;
    padding: 2rem !important; display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: inherit; transition: all 0.2s; height: 100%;
}
.st-qcard:hover { transform: translateY(-5px); border-color: var(--primary-blue); box-shadow: 0 12px 30px rgba(0,0,0,0.08); }
.st-qicon { width: 80px; height: 80px; margin-bottom: 1.5rem; object-fit: contain; }
.st-qcard strong { font-size: 1.2rem; color: #1e293b; }

/* 버튼 공통 */
.btn { border-radius: 8px; font-weight: 500; }

.dropdown-menu.rounded-4 {
    border-radius: 1.25rem !important;
    min-width: 160px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
    margin: 0; /* 부트스트랩 기본 마진 제거로 정렬 보정 */
    left:0;
}
/* --- [5] 반응형 설정 --- */
@media (max-width: 1024px) {
    .app-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 300px; max-width: 90%; transform: translateX(-100%); z-index: 2000; }
    .app-sidebar.show { transform: translateX(0); box-shadow: 10px 0 40px rgba(0,0,0,0.5); }
    .dashboard-body.sidebar-open .app-main::after { content: ""; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1999; cursor: pointer; }
}


/* 모바일 화면(768px 이하) 대응 완결판 */
@media (max-width: 768px) {
    /* 1. 모바일 세로 메뉴에서 쌩뚱맞은 가로 밑줄 무조건 제거 */
    .navbar-nav .nav-link.active-link:before {
        display: none !important;
    }

    /* 2. 드롭다운 토글 버튼들(PDF, UTILITIES)의 모바일 잔상 및 선택 컬러 강제 초기화 */
    .navbar-nav .dropdown-toggle,
    .navbar-nav .dropdown-toggle.show,
    .navbar-nav .dropdown-toggle:focus,
    .navbar-nav .dropdown-toggle:active {
        color: #475569 !important; /* main.css에 정의된 기본 회검정색상으로 고정 */
        background-color: transparent !important; /* 혹시 모를 잔상 배경 제거 */
    }

    /* 3. [핵심] 오직 '실제 활성화된 단일 페이지 이동 링크'만 파란색으로 지정 */
    /* 단, 드롭다운 토글 버튼(.dropdown-toggle)은 철저히 제외시킵니다. */
    .navbar-nav .active-link:not(.dropdown-toggle) {
        color: #3b82f6 !important;
    }
}