/* /css/bugreports/list.css */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

/* === CSS Variables === */
:root {
    --primary-color: #fd7e14;
    --primary-color-dark: #e8700f;
    --secondary-color: #ff9a40;
    --text-color: #e9ecef;
    --text-light-color: #adb5bd;
    --bg-color: #212529;
    --bg-alt-color: #343a40;
    --border-color: #495057;
    --border-color-light: #3e444a;
    --font-main: 'Noto Sans KR', 'Gowun Dodum', sans-serif;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --shadow-light: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.3);
    --transition-speed: 0.3s;
    --container-width: 1200px;
    --header-height-pc: 80px; /* 실제 헤더 높이에 맞게 조정 */
    --header-height-mobile-tablet: 10px; /* 실제 헤더 높이에 맞게 조정 */

    /* 새로운 답변 상태 색상 변수 */
    --answered-yes-bg: rgba(40, 167, 69, 0.15); /* 민트/초록 배경 */
    --answered-yes-text: #28a745;             /* 민트/초록 텍스트 */
    --answered-yes-border: #28a745;           /* 민트/초록 테두리 */

    /* 답변대기: 흰색 배경에 어두운 회색 글씨, 회색 테두리 */
    --answered-no-bg: #f8f9fa;
    --answered-no-text: #495057;
    --answered-no-border: #dee2e6;
}

/* === Base Styles === */
body {
    font-family: var(--font-main);
    color: var(--text-color);
    background-color: rgb(17, 17, 17);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    box-sizing: border-box;
}
*, *::before, *::after {
    box-sizing: inherit;
}

/* === Layout & Container === */
.bugreport-list-container {
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    margin-top: var(--header-height-pc);
    margin-bottom: 40px;
    padding: 40px 30px;
    background-color: var(--bg-color);
    box-shadow: var(--shadow-medium);
    border-radius: var(--border-radius-md);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.bugreport-list-container.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Page Title & Divider === */
.bugreport-list-page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}
.bugreport-list-page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.5s 0.3s ease-out, width 0.5s 0.3s ease-out;
}
.bugreport-list-container.is-visible .bugreport-list-page-title::after {
    opacity: 1;
    width: 120px;
}
.bugreport-list-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color-light);
    margin: 30px 0;
}

/* === Controls Area === */
.bugreport-list-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--bg-alt-color);
    border-radius: var(--border-radius-md);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s 0.2s ease-out, transform 0.5s 0.2s ease-out;
}
.bugreport-list-container.is-visible .bugreport-list-controls {
    opacity: 1;
    transform: translateY(0);
}
.bugreport-list-filter-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-grow: 1;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-checkboxes { /* 추가 스타일 필요시 */ }
.search-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.filter-item { display: flex; align-items: center; }
.filter-item-checkbox label {
    margin-left: 5px; cursor: pointer;
    color: var(--text-light-color); transition: color var(--transition-speed);
}
.filter-item-checkbox input[type="checkbox"] { cursor: pointer; accent-color: var(--primary-color); }
.filter-item-checkbox label:hover { color: var(--text-color); }
.bugreport-list-select, .bugreport-list-input {
    padding: 10px 12px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm); font-size: 0.95rem;
    background-color: var(--bg-color); color: var(--text-color);
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}
.bugreport-list-select { min-width: 160px; }
.bugreport-list-input { flex-grow: 1; min-width: 180px; }
.bugreport-list-select:focus, .bugreport-list-input:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(253, 126, 20, 0.25);
}
.bugreport-list-input::placeholder { color: var(--text-light-color); }
.bugreport-list-button {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 18px; border-radius: var(--border-radius-sm);
    font-weight: 500; text-decoration: none; cursor: pointer;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    border: none;
}
.bugreport-list-button i { margin-right: 8px; }
.bugreport-list-button .btn-text { display: inline; }
.bugreport-list-button-search { background-color: var(--primary-color); color: white; }
.bugreport-list-button-search:hover { background-color: var(--primary-color-dark); transform: translateY(-2px); box-shadow: var(--shadow-light); }
.bugreport-list-write-button-area { flex-shrink: 0; align-self: flex-end; }
.bugreport-list-button-write { background-color: var(--text-color); color: var(--bg-color); }
.bugreport-list-button-write:hover { background-color: var(--text-light-color); transform: translateY(-2px); box-shadow: var(--shadow-light); }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* === Bug Report List Items === */
.bugreport-list-items-wrapper {
    opacity: 0; transform: translateY(15px);
    transition: opacity 0.5s 0.4s ease-out, transform 0.5s 0.4s ease-out;
}
.bugreport-list-container.is-visible .bugreport-list-items-wrapper {
    opacity: 1; transform: translateY(0);
}

.bugreport-list-header,
.bugreport-list-item {
    display: flex;
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color-light);
    align-items: center; /* 수직 중앙 정렬 */
}
.bugreport-list-header {
    background-color: var(--primary-color); color: white; font-weight: 700;
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    position: sticky; top: 0; z-index: 10;
}
.bugreport-list-item {
    transition: background-color var(--transition-speed) ease, opacity 0.5s ease-out, transform 0.5s ease-out;
    opacity: 0; transform: translateY(20px);
}
.bugreport-list-item.is-visible { opacity: 1; transform: translateY(0); }
.bugreport-list-item:nth-child(odd) { background-color: var(--bg-alt-color); }
.bugreport-list-item:hover { background-color: #495057; }

/* PC/Tablet: Column Definitions */
.bugreport-col {
    width: 100px;
    padding-left: 8px;
    padding-right: 8px;
    display: flex;
    overflow: hidden;
    min-width: 0;
    justify-content: center;
    align-items: center;
}

/* 컬럼 너비 %로 명확히 지정하여 헤더와 내용 정렬 맞춤 */
.bugreport-list-header .bugreport-col-id,
.bugreport-list-item .bugreport-col-id        { flex: 0 0 6%; justify-content: center; }

.bugreport-list-header .bugreport-col-category,
.bugreport-list-item .bugreport-col-category  {
    flex: 0 0 11%; justify-content: center; /* 기존 12%에서 약간 줄임 */
}
/* 카테고리 컬럼 내부 span에도 ellipsis 적용 */
.bugreport-list-item .bugreport-col-category > span {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Title column for header and item */
.bugreport-list-header .bugreport-col-title,
.bugreport-list-item .bugreport-col-title {
    flex: 0 0 40%; /* 제목 컬럼에 40% 할당 (기존 flex: 1 1 0에서 변경) */
    justify-content: flex-start;
    /* overflow: hidden; /* .bugreport-col 에서 이미 처리 */
}

/* Styling for children within the item's title column (lock icon and link) */
.bugreport-list-item .bugreport-col-title > .lock-icon-wrapper {
    margin-right: 5px;
    display: inline-block;
    flex-shrink: 0; /* 아이콘 크기 유지 */
    color: var(--text-light-color);
}

.bugreport-list-item .bugreport-col-title > a,
.bugreport-list-item .bugreport-col-title > span { /* 비공개 글입니다 텍스트도 동일하게 처리 */
    display: block; /* 전체 너비를 차지하도록 block으로 변경 */
    /* width: 100%; /* display:block 으로 충분하거나, flex-grow:1 로 대체 가능 */
    flex-grow: 1; /* 아이콘 옆에서 남은 공간 모두 차지 */
    min-width: 0; /* 내용이 길어도 ellipsis가 적용되도록 함 (매우 중요) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* General style for links within any title column */
.bugreport-col-title a {
    color: var(--text-color); text-decoration: none; font-weight: 500;
    transition: color var(--transition-speed) ease; position: relative;
}
.bugreport-col-title a::after {
    content: ''; position: absolute; width: 0; height: 1px;
    display: block; margin-top: 2px; right: 0;
    background: var(--primary-color); transition: width .3s ease;
}
.bugreport-col-title a:hover { color: var(--primary-color); }
.bugreport-col-title a:hover::after { width: 100%; left: 0; background: var(--primary-color); }


.bugreport-list-header .bugreport-col-author,
.bugreport-list-item .bugreport-col-author    {
    flex: 0 0 12%; justify-content: center; /* 기존 13%에서 약간 줄임 */
}
/* 작성자 이름도 길 경우 ellipsis 처리 */
.bugreport-list-item .bugreport-col-author > span {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bugreport-list-header .bugreport-col-answered,
.bugreport-list-item .bugreport-col-answered  {
    flex: 0 0 11%; justify-content: center; /* 기존 12%에서 약간 줄임 */
}

.bugreport-list-header .bugreport-col-date,
.bugreport-list-item .bugreport-col-date      {
    flex: 0 0 12%; justify-content: center; /* 기존 15%에서 줄임 */
    white-space: nowrap;
}

.bugreport-list-header .bugreport-col-views,
.bugreport-list-item .bugreport-col-views{
    flex: 0 0 8%;
    /* align-items: center; /* .bugreport-col 에서 이미 처리 */
}
/* 컬럼 % 합계: 6 + 11 + 40 + 12 + 11 + 12 + 8 = 100% */
.bugreport-list-item .bugreport-col-views .fa-eye {
    margin-right: 3px; /* 아이콘과 숫자 사이의 간격을 줄입니다. 0으로 하면 거의 붙습니다. */
    /* vertical-align: middle; /* 필요시 추가, 보통 align-items로 처리됨 */
}

.bugreport-col-date .date-mobile { display: none; }
.bugreport-col-date .date-pc { display: inline; }

/* Answered Badge Styles */
.answered-badge {
    display: inline-flex; align-items: center;
    padding: 5px 10px; font-size: 0.8rem; font-weight: 500;
    border-radius: var(--border-radius-md); line-height: 1.3;
    text-align: center; white-space: nowrap;
}
.answered-badge i { margin-right: 4px; }
.answered-yes {
    background-color: var(--answered-yes-bg); color: var(--answered-yes-text);
    border: 1px solid var(--answered-yes-border);
}
.answered-no {
    background-color: var(--answered-no-bg); color: var(--answered-no-text);
    border: 1px solid var(--answered-no-border);
}

.bugreport-list-no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light-color);
    font-size: 1.1rem;
}
.bugreport-list-no-data i {
    margin-right: 8px;
    color: var(--primary-color);
}

/* Pagination Styles */
.bugreport-list-pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}
.bugreport-list-pagination a {
    color: var(--text-light-color);
    background-color: var(--bg-alt-color);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
    font-size: 0.9rem;
    min-width: 38px; /* Ensure consistent button size */
    height: 38px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}
.bugreport-list-pagination a:hover,
.bugreport-list-pagination a:focus {
    background-color: var(--primary-color-dark);
    color: white;
    border-color: var(--primary-color-dark);
}
.bugreport-list-pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 700;
    cursor: default;
}
.bugreport-list-pagination a[aria-label*="이전"],
.bugreport-list-pagination a[aria-label*="다음"] {
    font-weight: bold;
}

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .bugreport-list-container { padding: 30px 15px; margin-top: var(--header-height-mobile-tablet); margin-bottom: 30px; }
    .bugreport-list-page-title { font-size: 2.2rem; }
    .bugreport-list-controls { align-items: stretch; }
    .search-group { margin-top: 15px; }
    .bugreport-list-write-button-area { align-self: center; margin-left: 0; margin-top: 15px; width: 100%;}
    .bugreport-list-button-write { width: 100%; }

    /* Tablet에서도 PC와 동일한 flex % 유지 (위에서 이미 %로 설정됨) */
    /* .bugreport-list-header .bugreport-col-title,
    .bugreport-list-item .bugreport-col-title     { min-width: 150px; } /* 이미 flex basis로 관리되므로 min-width는 필요에 따라 조정 */
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .bugreport-list-container { padding: 20px 10px; margin: var(--header-height-mobile-tablet) 10px 20px 10px; box-shadow: var(--shadow-light); }
    .bugreport-list-page-title { font-size: 1.8rem; }
    .bugreport-list-page-title::after { width: 80px; }
    .bugreport-list-container.is-visible .bugreport-list-page-title::after { width: 80px; }

    .bugreport-list-controls { flex-direction: column; }
    .bugreport-list-filter-form { gap: 10px; }
    .filter-row { flex-direction: column; gap: 10px; margin-bottom: 0; }
    .filter-item { width: 100%; }
    .bugreport-list-select, .bugreport-list-input, .bugreport-list-button { width: 100%; }
    .bugreport-list-button i { margin-right: 5px; }
    .search-group { margin-top: 10px; }
    .bugreport-list-write-button-area { width: 100%; margin-top: 10px; }

    .bugreport-list-header { display: none; }

    .bugreport-list-item {
        display: grid;
        /*
        1행: 조회수 | 카테고리 | 답변상태
        2행: 제목 (전체 너비)
        3행: 작성자 | (빈 공간) | 날짜
        */
        grid-template-areas:
            "views category answered"  /* 1행: 3개의 컬럼 */
            "title title    title"     /* 2행: 제목이 3개 컬럼 모두 차지 */
            "author .        date";    /* 3행: 작성자, 빈 공간, 날짜 */
        grid-template-columns: auto 1fr auto; /* 조회수(auto) | 카테고리(1fr) | 답변상태(auto) */
        /* 제목은 이 컬럼 정의에 걸쳐서 표시됨 */
        /* 작성자(auto) | (1fr) | 날짜(auto) 에 대응 */
        gap: 5px 8px; /* row-gap, column-gap */
        padding: 10px;
        margin-bottom: 12px;
        border-radius: var(--border-radius-sm);
        box-shadow: var(--shadow-light);
        border: 1px solid var(--border-color);
        /* align-items: center; /* 각 그리드 아이템별로 align-self 또는 flexbox로 정렬 */
    }
    .bugreport-list-item:nth-child(odd) { background-color: var(--bg-color); }

    .bugreport-list-item {
        display: grid;
        /*
        1행: 조회수 | 카테고리 | 답변상태
        2행: 제목 (전체 너비)
        3행: 작성자 | (빈 공간) | 날짜
        */
        grid-template-areas:
            "views category answered"  /* 1행: 3개의 컬럼 */
            "title title    title"     /* 2행: 제목이 3개 컬럼 모두 차지 */
            "author .        date";    /* 3행: 작성자, 빈 공간, 날짜 */
        grid-template-columns: auto 1fr auto; /* 조회수(auto) | 카테고리(1fr) | 답변상태(auto) */
        /* 제목은 이 컬럼 정의에 걸쳐서 표시됨 */
        /* 작성자(auto) | (1fr) | 날짜(auto) 에 대응 */
        gap: 5px 8px; /* row-gap, column-gap */
        padding: 10px;
        margin-bottom: 12px;
        border-radius: var(--border-radius-sm);
        box-shadow: var(--shadow-light);
        border: 1px solid var(--border-color);
        /* align-items: center; /* 각 그리드 아이템별로 align-self 또는 flexbox로 정렬 */
    }
    .bugreport-list-item:nth-child(odd) { background-color: var(--bg-color); }

    .bugreport-list-item .bugreport-col {
        flex-basis: auto !important;
        width: auto !important;
        text-align: left !important;
        margin-bottom: 0;
        padding: 2px 0;
        display: flex;
        align-items: center;
        min-width: 0;
        font-size: 0.8rem;
    }
    .bugreport-list-item .bugreport-col-id { display: none; }

    /* 1행 요소 */
    .bugreport-list-item .mobile-stats-group {
        grid-area: views;
        margin-top: 0;
    }
    /* .bugreport-list-item .mobile-stats-group .bugreport-col-views 는 특별한 추가 스타일 없음 */

    .bugreport-list-item .bugreport-col-category {
        grid-area: category;
        background-color: var(--bg-alt-color);
        padding: 3px 7px;
        border-radius: var(--border-radius-sm);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        justify-self: start; /* 카테고리는 왼쪽 정렬 */
    }

    .bugreport-list-item .bugreport-col-answered {
        grid-area: answered;
        justify-self: end; /* 답변상태는 오른쪽 정렬 */
    }
    .bugreport-list-item .bugreport-col-answered .answered-badge {
        padding: 2px 6px;
        font-size: 0.75rem;
    }

    /* 2행 요소 */
    .bugreport-list-item .bugreport-col-title {
        grid-area: title;
        font-size: 0.95rem;
        font-weight: 500;
        line-height: 1.4;
        margin: 5px 0; /* 제목 위아래 여백 추가 */
        /* width: 100%; /* grid-area가 전체 너비를 차지하도록 설정 */
        justify-self: stretch; /* 그리드 영역을 꽉 채움 */
    }
    .bugreport-list-item .bugreport-col-title > a,
    .bugreport-list-item .bugreport-col-title > span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        width: 100%;
        color: var(--text-color);
    }
    .bugreport-list-item .bugreport-col-title a::after { display: none; }
    .bugreport-list-item .bugreport-col-title > .lock-icon-wrapper {
        font-size: 0.9em;
        margin-right: 4px;
    }

    /* 3행 요소 */
    .bugreport-list-item .bugreport-col-author  {
        grid-area: author;
        color: var(--text-light-color);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        justify-self: start; /* 작성자 왼쪽 정렬 */
    }
    .bugreport-list-item .bugreport-col-date    {
        grid-area: date;
        color: var(--text-light-color);
        white-space: nowrap;
        justify-self: end; /* 날짜 오른쪽 정렬 */
    }
    .bugreport-list-item .bugreport-col-date .date-pc { display: none; }
    .bugreport-list-item .bugreport-col-date .date-mobile { display: inline; }


    .bugreport-list-item .mobile-stats-group .bugreport-col {
        margin-right: 0;
    }
    .bugreport-list-item .mobile-stats-group .bugreport-col i {
        margin-right: 4px;
    }

    .bugreport-list-item .bugreport-col[data-label]::before { display: none; }

    .bugreport-list-pagination { flex-wrap: wrap; gap: 5px; }
    .bugreport-list-pagination a { min-width: 32px; height: 32px; font-size: 0.8rem; }
}