/* ===================================
   downloads.css — 공개 자료실 (게시판형)
   ===================================

   ★ 색·간격은 var(--x, 기본값) 형태로 쓴다.
     variables.css 에 그 변수가 있으면 그 값이 쓰이고,
     없으면 기본값이 먹는다. 변수명을 추측해서 틀려도 화면이 안 깨진다.
     (코드에서 실제 확인된 것: --color-text-muted, --color-text-light,
      --radius-lg, --space-lg. 나머지는 확인 못 해서 대체값을 둔다)
*/

.dl-wrap { margin-top: 8px; }

/* ── 상단 줄: 건수 + 검색 ── */
.dl-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.dl-total {
    font-size: 14px;
    color: var(--color-text-muted, #8b929e);
}
.dl-total b {
    color: var(--color-primary, #f97316);
    font-weight: 700;
}
.dl-search {
    display: flex;
    margin-left: auto;
    border: 1px solid var(--color-border, #e2e5ea);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    background: #fff;
}
.dl-search input {
    border: 0;
    outline: 0;
    padding: 9px 12px;
    width: 220px;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
    color: var(--color-text, #262b33);
}
.dl-search input::placeholder { color: var(--color-text-muted, #a8aeb8); }
.dl-search button {
    border: 0;
    background: var(--color-primary, #f97316);
    color: #fff;
    padding: 0 14px;
    cursor: pointer;
    font-size: 14px;
}
.dl-search button:hover { filter: brightness(0.93); }

/* ── 목록 ── */
.dl-list {
    border-top: 2px solid var(--color-text, #262b33);
    border-bottom: 1px solid var(--color-border, #e2e5ea);
}

/* 열 너비를 헤더와 행이 공유한다 */
.dl-head, .dl-row {
    display: grid;
    grid-template-columns: 62px 1fr 150px 108px 92px 118px;
    align-items: center;
    gap: 10px;
}

.dl-head {
    padding: 12px 8px;
    border-bottom: 1px solid var(--color-border, #e2e5ea);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text, #262b33);
    background: var(--color-bg-light, #f7f8fa);
}
.dl-head span { text-align: center; }
.dl-head .dl-c-title { text-align: left; padding-left: 4px; }

.dl-row {
    padding: 16px 8px;
    border-bottom: 1px solid var(--color-border, #eef0f3);
    transition: background .12s;
}
.dl-row:last-child { border-bottom: 0; }
.dl-row:hover { background: var(--color-bg-light, #f7f8fa); }

.dl-c-no, .dl-c-file, .dl-c-date, .dl-c-cnt {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted, #8b929e);
}
.dl-c-no { font-weight: 600; }
.dl-c-cnt b { color: var(--color-text, #262b33); font-weight: 600; }

/* 제목 칸 */
.dl-c-title { min-width: 0; padding-left: 4px; }
.dl-name {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text, #262b33);
    text-decoration: none;
    word-break: break-word;
}
.dl-name:hover { color: var(--color-primary, #f97316); }
.dl-name .dl-ico {
    width: 26px; height: 26px;
    flex: 0 0 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background: rgba(249, 115, 22, .1);
    color: var(--color-primary, #f97316);
}
.dl-desc {
    margin: 5px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-muted, #8b929e);
    word-break: break-word;
}

/* 파일 형식 배지 */
.dl-ext {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    background: var(--color-bg-light, #f0f2f5);
    color: var(--color-text-muted, #6b7280);
}
.dl-size { display: block; margin-top: 4px; font-size: 12px; }

/* 다운로드 버튼 */
.dl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-primary, #f97316);
    border-radius: var(--radius-md, 8px);
    color: var(--color-primary, #f97316);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: .12s;
}
.dl-btn:hover {
    background: var(--color-primary, #f97316);
    color: #fff;
}

/* 비어있음 / 오류 */
.dl-msg {
    padding: 56px 20px;
    text-align: center;
    color: var(--color-text-muted, #8b929e);
    font-size: 14px;
    line-height: 1.7;
}
.dl-msg i { display: block; font-size: 34px; margin-bottom: 12px; opacity: .5; }
.dl-msg a { color: var(--color-primary, #f97316); font-weight: 600; }

/* ── 모바일 ──
   열 6개를 좁은 화면에 밀어넣으면 글씨가 뭉갠다.
   번호·헤더를 숨기고 세로로 쌓는다. */
@media (max-width: 767px) {
    .dl-head { display: none; }
    .dl-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "title title"
            "meta  btn";
        padding: 15px 4px;
        gap: 10px;
    }
    .dl-c-no { display: none; }
    .dl-c-title { grid-area: title; }
    .dl-c-file { grid-area: meta; text-align: left; }
    .dl-c-date, .dl-c-cnt { display: none; }
    .dl-c-btn { grid-area: btn; }
    .dl-btn { width: auto; padding: 8px 14px; }
    .dl-size { display: inline; margin-left: 6px; }
    .dl-search { margin-left: 0; width: 100%; }
    .dl-search input { width: 100%; }
}

/* ── 잠긴 자료 ── */
.dl-ico-lock {
    background: rgba(234, 179, 8, .14) !important;
    color: #d97706 !important;
}
.dl-lock-tag {
    margin-left: 2px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(234, 179, 8, .14);
    color: #b45309;
    white-space: nowrap;
}
.dl-btn-lock {
    border-color: #d97706;
    color: #d97706;
}
.dl-btn-lock:hover {
    background: #d97706;
    color: #fff;
}


/* ===== 분류 탭 ===== */
.dl-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.dl-cat {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-light);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dl-cat:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.dl-cat.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    font-weight: var(--font-semibold);
}

.dl-cat-n {
    opacity: .75;
    font-size: var(--text-xs);
    margin-left: 2px;
}


/* ===== 자료 상세 창 ===== */
.dl-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dl-modal.active { display: flex; }

.dl-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.dl-modal-box {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 28px 30px 26px;
    box-shadow: var(--shadow-lg);
}

.dl-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-muted);
    cursor: pointer;
    line-height: 1;
}

.dl-modal-close:hover { color: var(--color-primary); }

.dm-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-white);
    margin-bottom: 6px;
    padding-right: 28px;
    line-height: 1.4;
}

.dm-desc {
    font-size: var(--text-sm);
    color: var(--color-text-light);
    line-height: 1.7;
    margin-bottom: 16px;
}

.dm-meta {
    width: 100%;
    border-collapse: collapse;
    border-top: 2px solid var(--color-text-white);
    margin-bottom: 20px;
}

.dm-meta th,
.dm-meta td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-sm);
    text-align: left;
}

.dm-meta th {
    width: 110px;
    background: #f8f9fb;
    color: var(--color-text-muted);
    font-weight: var(--font-semibold);
    white-space: nowrap;
}

.dm-meta td { color: var(--color-text-white); word-break: break-all; }

.dm-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 0;
    background: var(--color-primary);
    color: #ffffff;
    border-radius: var(--radius-md);
    font-weight: var(--font-bold);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.dm-download:hover { background: var(--color-primary-dark); color: #fff; }


/* ===== 출처 표기 ===== */
.dl-source {
    margin-top: 3px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.dl-source a {
    color: var(--color-text-muted);
    text-decoration: underline;
}

.dl-source a:hover { color: var(--color-primary); }

.dl-source i.fa-quote-left { font-size: 9px; opacity: .6; }

.dm-meta td a { color: var(--color-primary); text-decoration: underline; }
