/* 학습교안 목록 페이지 스타일 */

.worksheets-list-page {
    min-height: 100vh;
}

/* Sidebar */
.sidebar.-worksheets {
    position: sticky;
    top: 100px;
}

.sidebar__item {
    /* margin-bottom: 30px; */
}

.sidebar__title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Accordion */
.accordion__button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px 0;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.3s ease;
}

.accordion__button:hover {
    color: #6c5ce7;
}

.accordion__icon {
    transition: transform 0.3s ease;
}

.accordion__item.is-active .accordion__icon {
    transform: rotate(180deg);
}

.accordion__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion__content__inner {
    /* padding-top: 15px; */
}

/* Checkbox & Radio Filters */
.sidebar-checkbox__item {
    padding: 8px 0;
    transition: all 0.2s ease;
}

.sidebar-checkbox__item:hover {
    padding-left: 0;
}

.sidebar-checkbox__item label {
    cursor: pointer;
    width: 100%;
    margin: 0;
}

.sidebar-checkbox__title {
    flex: 1;
    margin-left: 10px;
}

.sidebar-checkbox__count {
    color: #999;
    font-size: 14px;
}

/* Form Elements */
.form-checkbox,
.form-radio {
    position: relative;
}

.form-checkbox input,
.form-radio input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.form-checkbox__mark,
.radio__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.radio__mark {
    border-radius: 50%;
}

.form-checkbox input:checked ~ .form-checkbox__mark,
.radio input:checked ~ .radio__mark {
    background-color: #6c5ce7;
    border-color: #6c5ce7;
}

.form-checkbox__icon,
.radio__icon {
    color: white;
    font-size: 12px;
    display: none;
}

.form-checkbox input:checked ~ .form-checkbox__mark .form-checkbox__icon {
    display: block;
}

.radio__icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
}

.radio input:checked ~ .radio__mark .radio__icon {
    display: block;
}

/* Sort Dropdown */
#sortDropdown {
    position: relative;
}

.dropdown__button {
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    min-width: 200px;
    justify-content: space-between;
    height: 50px;
    /* padding은 유틸리티 클래스 px-20 py-10 사용 = padding: 10px 20px */
}

.dropdown__button:hover {
    border-color: #6c5ce7;
    background-color: #f9fafb;
}

#sortDropdown.-is-dd-active .dropdown__button {
    border-color: #6c5ce7;
}

#sortDropdownContent {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    min-width: 180px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
}

#sortDropdownContent.-is-el-visible {
    display: block;
}

.js-dropdown-list {
    padding: 8px 0;
}

.js-dropdown-list > div {
    padding: 0;
}

.js-dropdown-link {
    display: block;
    padding: 5px 10px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.js-dropdown-link:hover {
    background-color: #f8f9fa;
    color: #6c5ce7;
}

.js-dropdown-link.activeMenu {
    background-color: #f0ebff;
    color: #6c5ce7;
    font-weight: 500;
}

/* Worksheet Cards */
.worksheetsCard {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
    padding-bottom: 15px;
    position: relative;
}

/* 미리보기 슬라이드쇼 오버레이 */
.preview-slideshow-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 50;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    background: rgba(0, 0, 0, 0.45);
}
.preview-slideshow-overlay.visible {
    display: block;
}
.preview-slideshow-overlay:active {
    cursor: pointer;
}
.preview-slideshow-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s ease;
    will-change: transform;
}
.preview-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    padding: 28px 14px;
    box-sizing: border-box;
}
.preview-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
}
.preview-slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0.75;
    transition: opacity 0.2s, background 0.2s;
    padding: 0;
}
.preview-slide-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.75);
}
.preview-slide-btn.psh {
    opacity: 0.25;
    pointer-events: none;
}
.preview-slide-prev { left: 8px; }
.preview-slide-next { right: 8px; }
.preview-slide-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}
.preview-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: background 0.2s, transform 0.2s;
}
.preview-dot.active {
    background: #fff;
    transform: scale(1.3);
}

/* 이미지 로딩 스피너 */
@keyframes preview-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
.preview-slideshow-overlay.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: preview-spin 0.7s linear infinite;
    z-index: 20;
    pointer-events: none;
}

.worksheetsCard:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.worksheetsCard__image {
    position: relative;
    overflow: hidden;
    padding-top: 56.62%; /* 710x402 비율 */
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    transition: border-color 0.3s ease;
}

.worksheetsCard:hover .worksheetsCard__image {
    border-color: #000;
}

.worksheetsCard__image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 0.3s ease;
}

.worksheetsCard:hover .worksheetsCard__image img {
    transform: scale(1.05);
}

.worksheetsCard__image_overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.worksheetsCard:hover .worksheetsCard__image_overlay {
    opacity: 1;
}

.worksheetsCard > .h-100 {
    padding: 15px 15px 0 15px;
}

.worksheetsCard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.worksheetsCard-footer__author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.worksheetsCard-footer__author img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.worksheetsCard-footer__price {
    display: flex;
    gap: 8px;
    align-items: center;
}

.worksheetsCard-footer__price div:first-child {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
}

.worksheetsCard-footer__price div:last-child {
    font-size: 18px;
    font-weight: 600;
    color: #6c5ce7;
}

/* Side Content (Hover Card) */
.side-content {
    position: relative;
}

/* Hover 레이어 썸네일 스타일 */
.hover-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.hover-thumbnail img {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.side-content__item {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: none;
}

.side-content__item > div {
    border: 2px solid #000 !important;
}

/* 3컬럼 레이아웃에서 중앙 열(두 번째 카드)은 오른쪽에 레이어 표시 */
.side-content:nth-child(3n+2) .side-content__item {
    left: auto;
    right: 0;
    transform: translateX(0);
}

/* 3컬럼 레이아웃에서 왼쪽과 오른쪽 열은 가운데 정렬 */
.side-content:nth-child(3n+1) .side-content__item,
.side-content:nth-child(3n) .side-content__item {
    left: 50%;
    transform: translateX(-50%);
}

/* 호버시 레이어 표시 - 일시 비활성화 */
/*
.side-content:hover .side-content__item {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
*/

/* Mobile Filter Accordion */
#mobileFilterAccordion {
    transition: max-height 0.3s ease;
}

.bg-light-3 {
    background-color: #EEF2F6;
}

.w-unset {
    width: unset !important;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pagination__button {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    background-color: #f5f5f7;
    color: #6c5ce7;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination__button .icon {
    font-size: 12px;
}

.pagination__button:hover:not(:disabled) {
    background-color: #6c5ce7;
    color: white;
}

.pagination__button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination__count {
    display: flex;
    align-items: center;
}

.pagination__count > * {
    position: relative;
    font-size: 14px;
    font-weight: 400;
    line-height: 16px;
    color: #1a1a1a;
}

.pagination__count > * + * {
    margin-left: 30px;
}

.pagination__count a {
    text-decoration: none;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.pagination__count a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 16px;
    height: 2px;
    transform: translateX(-50%);
    background-color: #6c5ce7;
    transition: all 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
    opacity: 0;
}

.pagination__count a:hover {
    color: #6c5ce7;
}

.pagination__count a.-count-is-active {
    color: #6c5ce7;
}

.pagination__count a.-count-is-active::after {
    opacity: 1;
}

.pagination__count span {
    color: #1a1a1a;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state__icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state__title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.empty-state__text {
    font-size: 16px;
    color: #999;
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6c5ce7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sort Label - 절대 변경되지 않도록 보호 */
#sortLabel {
    pointer-events: none;
    user-select: none;
}

/* Mobile Filter Button */
#mobileFilterBtn {
    display: none;
}

/* Responsive */
@media (max-width: 991px) {
    /* 모바일에서는 사이드바를 기본 숨김 */
    #sidebarFilter.lg\:d-none {
        display: none !important;
    }
    
    /* 모바일에서 사이드바가 표시될 때 */
    #sidebarFilter.d-block {
        display: block !important;
        width: 100%;
        margin-bottom: 30px;
    }
    
    #sidebarFilter.d-block .sidebar.-worksheets {
        background-color: #EEF2F6;
        border-radius: 8px;
        padding: 30px;
    }
    
    /* 모바일 필터 버튼 표시 */
    #mobileFilterBtn {
        display: inline-flex;
    }
    
    .sidebar.-worksheets {
        position: static;
    }
    
    .side-content__item {
        display: none;
    }
}

/* 반별 (icomoon에 없으므로 FontAwesome star-half-o 사용) */
.icon-star-half {
    font-family: 'FontAwesome' !important;
}
.icon-star-half::before {
    content: "\f123"; /* fa-star-half-o: 왼쪽 절반 채워짐, 오른쪽 아웃라인 */
}
@media (max-width: 767px) {
    .worksheetsCard-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
