/* Nginx Fancyindex CSS - Seti UI Style */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'DejaVu Sans Mono', monospace;
    background: #0d1117;
    color: #c9d1d9;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

/* 기본 제목 스타일 */
h1 {
    font-size: 1.5rem;
    font-weight: 400;
    color: #f0f6fc;
    margin-bottom: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #21262d;
    display: flex;
    align-items: center;
    gap: 10px;
}

h1::before {
    content: '📁';
    font-size: 1.2em;
}

/* 검색 박스 - JavaScript로 추가됨 */
#search {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    padding: 8px 12px;
    font-size: 14px;
    width: 250px;
    outline: none;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    float: right;
}

#search:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

#search::placeholder {
    color: #7d8590;
}

/* 테이블 컨테이너 */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 8px;
    overflow: hidden;
    clear: both;
}

/* 테이블 헤더 */
thead {
    background: transparent;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #ffffff;
    background: transparent;
    border-bottom: 1px solid #21262d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}

thead th:hover {
    background: #161b22;
}

/* 테이블 바디 */
tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #21262d;
    background: transparent !important;
}

tbody tr:nth-child(even) {
    background: transparent !important;
}

tbody tr:nth-child(odd) {
    background: transparent !important;
}

tbody tr:hover {
    background: #161b22 !important;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 10px 16px;
    vertical-align: middle;
    border: none;
    background: transparent !important;
}

/* nginx fancyindex 기본 스타일 강제 덮어쓰기 */
table tr,
table tbody tr,
tbody tr,
tr {
    background: transparent !important;
    background-color: transparent !important;
}

table td,
tbody td,
td {
    background: transparent !important;
    background-color: transparent !important;
}

/* 기본 링크 스타일 */
a {
    color: #c9d1d9;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    transition: color 0.2s ease;
}

a:hover {
    color: #58a6ff;
}

/* 파일 아이콘 - CSS로 직접 구현 */
a::before {
    content: '';
    width: 16px;
    height: 16px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
    border-radius: 2px;
    text-align: center;
    line-height: 16px;
    font-size: 10px;
    color: white;
    font-weight: bold;
}

/* Parent directory */
a[href="../"]::before {
    content: '↖';
    background: #6f42c1;
    font-size: 12px;
}

/* 폴더 아이콘 */
a[href$="/"]::before {
    content: '📁';
    background: none;
    font-size: 14px;
}

/* 특수 폴더들 */
a[href$=".git/"]::before,
a[href*="github"]::before {
    content: '🐙';
    background: none;
    font-size: 14px;
}

a[href$="node_modules/"]::before {
    content: '📦';
    background: none;
    font-size: 14px;
}

/* JavaScript 파일 */
a[href$=".js"]::before,
a[href$=".mjs"]::before,
a[href$=".jsx"]::before {
    content: 'JS';
    background: #f1e05a;
    color: #000;
}

/* TypeScript 파일 */
a[href$=".ts"]::before,
a[href$=".tsx"]::before {
    content: 'TS';
    background: #2b7489;
    color: white;
}

/* JSON 파일 */
a[href$=".json"]::before {
    content: '{}';
    background: #f1e05a;
    color: #000;
    font-size: 8px;
}

/* CSS 파일 */
a[href$=".css"]::before,
a[href$=".scss"]::before,
a[href$=".sass"]::before {
    content: '#';
    background: #563d7c;
    color: white;
    font-size: 12px;
}

/* HTML 파일 */
a[href$=".html"]::before,
a[href$=".htm"]::before {
    content: '<>';
    background: #e34c26;
    color: white;
    font-size: 8px;
}

/* Python 파일 */
a[href$=".py"]::before {
    content: 'PY';
    background: #3572A5;
    color: white;
}

/* PHP 파일 */
a[href$=".php"]::before {
    content: '<?';
    background: #4F5D95;
    color: white;
    font-size: 8px;
}

/* Markdown 파일 */
a[href$=".md"]::before,
a[href$=".markdown"]::before {
    content: 'MD';
    background: #083fa1;
    color: white;
}

/* 이미지 파일 */
a[href$=".jpg"]::before,
a[href$=".jpeg"]::before,
a[href$=".png"]::before,
a[href$=".gif"]::before,
a[href$=".svg"]::before,
a[href$=".webp"]::before {
    content: '🖼';
    background: none;
    font-size: 12px;
}

/* 압축 파일 */
a[href$=".zip"]::before,
a[href$=".tar"]::before,
a[href$=".gz"]::before,
a[href$=".rar"]::before,
a[href$=".7z"]::before {
    content: '📦';
    background: none;
    font-size: 12px;
}

/* 라이센스 파일 */
a[href*="LICENSE"]::before,
a[href*="license"]::before,
a[href*="License"]::before {
    content: '⚖';
    background: none;
    font-size: 12px;
}

/* README 파일 */
a[href*="README"]::before,
a[href*="readme"]::before {
    content: '📖';
    background: none;
    font-size: 12px;
}

/* 일반 파일 */
a:not([href$="/"])::before {
    content: '📄';
    background: none;
    font-size: 12px;
}

/* 마지막 수정일 컬럼 스타일 */
td:nth-child(2) {
    color: #7d8590;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    white-space: nowrap;
}

/* 크기 컬럼 스타일 */
td:nth-child(3) {
    color: #7d8590;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

/* 설명 컬럼 스타일 */
td:nth-child(4) {
    color: #7d8590;
    font-size: 12px;
    font-style: italic;
}

/* 빈 셀 처리 */
td:empty::after {
    content: '-';
    color: #484f58;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.2rem;
        margin-bottom: 15px;
        padding: 15px 0;
    }
    
    #search {
        width: 100%;
        max-width: 300px;
        float: none;
        margin-bottom: 15px;
    }
    
    table {
        font-size: 13px;
    }
    
    thead th,
    tbody td {
        padding: 8px 12px;
    }
    
    /* 모바일에서 설명 컬럼 숨기기 */
    td:nth-child(4),
    th:nth-child(4) {
        display: none;
    }
}

@media (max-width: 480px) {
    /* 아주 작은 화면에서 크기 컬럼도 숨기기 */
    td:nth-child(3),
    th:nth-child(3) {
        display: none;
    }
    
    thead th,
    tbody td {
        padding: 6px 8px;
    }
    
    a::before {
        width: 14px;
        height: 14px;
        font-size: 8px;
        line-height: 14px;
    }
}

/* 페이드인 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

tbody tr {
    animation: fadeIn 0.3s ease forwards;
}

/* 커스텀 스크롤바 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* 포커스 스타일 */
a:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
    border-radius: 3px;
}

#search:focus {
    outline: none;
}

/* 정렬 인디케이터 */
.sort-asc::after {
    content: ' ▲';
    color: #58a6ff;
}

.sort-desc::after {
    content: ' ▼';
    color: #58a6ff;
}

/* 빈 상태 메시지 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #7d8590;
    border: 1px solid #21262d;
    border-radius: 8px;
    margin-top: 20px;
    background: #161b22;
}

.empty-state::before {
    content: '📂';
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

/* 로딩 상태 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}