/* ---------------------------------------------------
 * 기본 페이지 스타일
 * --------------------------------------------------- */
body {
    background-color: #f0f2f5;
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    padding: 2rem;
}

/* 페이지 제목 스타일 */
#indextitle {
    /* CHANGE: 폰트 크기, 색상, 두께, 여백 조정 */
    font-size: 1.1rem;
    font-weight: 600;
    color: #adb5bd;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* ---------------------------------------------------
 * ▼▼▼ 카드 UI 핵심 스타일 ▼▼▼
 * 기존 테이블 레이아웃을 카드 그리드로 변환합니다.
 * --------------------------------------------------- */

/* 테이블의 기본 스타일을 초기화하고 그리드 컨테이너로 만듭니다. */
#indexlist {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    border-spacing: 0;
    width: 100%;
    max-width: 1200px; /* 최대 너비 설정 */
    margin: 0 auto; /* 중앙 정렬 */
}

/* 테이블 헤더, 구분선, address 태그 숨기기 */
#indexlist .indexhead,
#indexlist .indexbreakrow,
body > address {
    display: none;
}

/* Parent Directory 행 숨기기 */
#indexlist tr:has(img[alt="[PARENTDIR]"]) {
    display: none;
}

/* 각 행(tr)을 카드 형태로 만듭니다. */
#indexlist tr {
    position: relative; /* NEW: 자식 요소의 절대 위치 기준이 됨 */
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    grid-template-areas: "icon name date";
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#indexlist tr:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* 아이콘, 이름, 날짜, 크기, 설명 컬럼의 기본 table-cell 속성 초기화 */
#indexlist td {
    display: block;
    border: none;
    padding: 0;
}

/* ---------------------------------------------------
 * 카드 내부 요소 스타일
 * --------------------------------------------------- */

/* 아이콘 (폴더, 파일 등) */
.indexcolicon {
    grid-area: icon;
    display: flex;
    align-items: center;
    justify-content: center;
}

.indexcolicon img {
    width: 22px;
    height: 22px;
}

/* 이름 (파일명/폴더명) */
.indexcolname {
    grid-area: name;
    display: flex;
    align-items: center;
    min-width: 0; /* 이름이 너무 길 때 레이아웃이 깨지는 것을 방지 */
}

.indexcolname a {
    color: #1c1e21;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* NEW: 링크 영역을 카드 전체로 확장하는 핵심 코드 */
.indexcolname a::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* 수정 날짜 */
.indexcollastmod {
    grid-area: date;
    color: #8a8d91;
    font-size: 0.85rem;
    text-align: right;
    white-space: nowrap; /* 날짜가 두 줄로 나뉘는 것 방지 */
}

/* 크기, 설명 컬럼 숨기기 */
#indexlist .indexcolsize,
#indexlist .indexcoldesc {
    display: none;
}


/* ---------------------------------------------------
 * ▼▼▼ 반응형 디자인 (모바일) ▼▼▼
 * 화면 너비가 768px 이하일 때 적용
 * --------------------------------------------------- */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    #indextitle {
        font-size: 1rem;
    }

    #indexlist {
        gap: 0.5rem;
    }

    #indexlist tr {
        padding: 0.75rem;
        grid-template-areas: "icon name";
        grid-template-columns: auto 1fr;
    }

    /* 모바일에서 날짜 정보 숨기기 */
    #indexlist .indexcollastmod {
        display: none;
    }

    /* 모바일에서 긴 텍스트가 다음 줄로 넘어가도록 설정 */
    #indexlist .indexcolname a {
        white-space: normal;
        word-break: break-all;
    }
}
