/* ===================================
   Shop of Korea 페이지네이션 전용 CSS (Bootstrap 호환)
   작성일: 2025-01-12
   설명: sok- 접두사 사용, Bootstrap 반응형 유틸리티 호환
   =================================== */

/* ===================================
   Bootstrap 호환 반응형 유틸리티
   =================================== */
/* d-none 기본 */
.sok-d-none {
    display: none !important;
}

/* d-block */
.sok-d-block {
    display: block !important;
}

/* d-flex */
.sok-d-flex {
    display: flex !important;
}

/* Large devices (lg) - 992px and up */
@media (min-width: 992px) {
    .sok-d-lg-none {
        display: none !important;
    }
    
    .sok-d-lg-block {
        display: block !important;
    }
    
    .sok-d-lg-flex {
        display: flex !important;
    }
}

/* ===================================
   Bootstrap 호환 레이아웃 클래스
   =================================== */
.sok-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.sok-col {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

.sok-col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

.sok-col-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
}

.sok-col {
    flex-basis: 0;
    flex-grow: 1;
    max-width: 100%;
}

/* Bootstrap 호환 간격 유틸리티 */
.sok-mt-4 {
    margin-top: 1.5rem !important;
}

.sok-mt-5 {
    margin-top: 3rem !important;
}

.sok-mb-5 {
    margin-bottom: 3rem !important;
}

/* ===================================
   페이지네이션 컨테이너
   =================================== */
.sok-pagination-container {
    margin-top: 40px;
    margin-bottom: 40px;
}

/* ===================================
   모바일 페이지네이션 (한 줄 유지)
   =================================== */
/* 모바일 페이징 행 - 중앙 정렬, 한 줄 유지 */
.sok-row.sok-d-lg-none {
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap; /* 한 줄로 유지 */
}

/* 모바일에서 컬럼 조정 */
@media (max-width: 991px) {
    .sok-row.sok-d-lg-none {
        margin-left: -5px;  /* 간격 줄이기 */
        margin-right: -5px;
    }
    
    .sok-row.sok-d-lg-none .sok-col-5,
    .sok-row.sok-d-lg-none .sok-col {
        padding-left: 5px;  /* 간격 줄이기 */
        padding-right: 5px;
    }
    
    /* mt-4 클래스 제거 또는 줄이기 */
    .sok-row.sok-d-lg-none .sok-mt-4 {
        margin-top: 0 !important;
    }
    
    .sok-row.sok-d-lg-none .sok-col-5 {
        flex: 0 0 auto;
        max-width: none;
        width: auto;
    }
    
    .sok-row.sok-d-lg-none .sok-col {
        flex: 1 1 auto;
        max-width: none;
    }
}

/* 드롭다운 래퍼 */
.sok-dropdown-wrapper {
    position: relative;
}

/* 페이징 셀렉트 박스 */
.sok-paging-select {
    width: 100%;
    min-width: 110px;
    max-width: 140px;
    height: 42px;
    padding: 0 30px 0 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    transition: all 0.3s ease;
}

.sok-paging-select:hover {
    border-color: #b82647;
}

.sok-paging-select:focus {
    outline: none;
    border-color: #b82647;
    box-shadow: 0 0 0 3px rgba(184, 38, 71, 0.1);
}

/* 더보기 버튼 (Bootstrap 버튼 스타일 확장) */
.sok-btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.sok-btn.sok-w-100 {
    width: 100% !important;
}

.sok-paging-btn {
    height: 42px;
    background: #b82647;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sok-paging-btn:hover {
    background: #a02040;
    transform: translateY(-1px);
}

.sok-paging-btn:active {
    transform: translateY(0);
}

.sok-paging-btn.sok-loading {
    background: #ccc;
    pointer-events: none;
}

.sok-paging-btn.sok-loading::after {
    content: "로딩중...";
}

/* ===================================
   PC 페이지네이션
   =================================== */
/* PC 페이징 행 - 중앙 정렬 */
.sok-row.sok-d-lg-block {
    text-align: center;
}

/* 페이지네이션 리스트 */
.sok-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 5px;
}

.sok-pagination li {
    margin: 0;
}

/* 페이지 링크 */
.sok-pagination a,
.sok-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sok-pagination a:hover {
    background: #f8f9fa;
    border-color: #b82647;
    color: #b82647;
}

/* 현재 페이지 */
.sok-pagination .sok-active a,
.sok-pagination .sok-active span,
.sok-pagination .sok-current {
    background: #b82647;
    border-color: #b82647;
    color: #fff;
    pointer-events: none;
}

/* 비활성 페이지 */
.sok-pagination .sok-disabled a,
.sok-pagination .sok-disabled span {
    background: #f8f9fa;
    border-color: #e0e0e0;
    color: #999;
    pointer-events: none;
}

/* 이전/다음 버튼 */
.sok-pagination .sok-prev a,
.sok-pagination .sok-next a {
    padding: 0 15px;
    font-weight: 400;
}

.sok-pagination .sok-prev a::before {
    content: "‹";
    margin-right: 5px;
    font-size: 18px;
}

.sok-pagination .sok-next a::after {
    content: "›";
    margin-left: 5px;
    font-size: 18px;
}

/* 첫 페이지/마지막 페이지 */
.sok-pagination .sok-first a,
.sok-pagination .sok-last a {
    font-weight: 400;
}

.sok-pagination .sok-first a::before {
    content: "«";
    margin-right: 5px;
    font-size: 16px;
}

.sok-pagination .sok-last a::after {
    content: "»";
    margin-left: 5px;
    font-size: 16px;
}

/* 줄임표 */
.sok-pagination .sok-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 40px;
    color: #999;
    pointer-events: none;
}

/* ===================================
   로딩 상태
   =================================== */
.sok-pagination-loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.sok-pagination-loading::after {
    content: "로딩중...";
    display: inline-block;
    animation: sok-dots 1.5s infinite;
}

@keyframes sok-dots {
    0%, 20% { content: "로딩중."; }
    40% { content: "로딩중.."; }
    60%, 100% { content: "로딩중..."; }
}

/* ===================================
   모바일 최적화 (더 작은 화면)
   =================================== */
@media (max-width: 480px) {
    /* 아주 작은 화면에서 추가 조정 */
    .sok-row.sok-d-lg-none {
        margin-left: -3px;
        margin-right: -3px;
    }
    
    .sok-row.sok-d-lg-none .sok-col-5,
    .sok-row.sok-d-lg-none .sok-col {
        padding-left: 3px;
        padding-right: 3px;
    }
    
    .sok-paging-select {
        min-width: 95px;
        max-width: 120px;
        height: 40px;
        font-size: 13px;
        padding: 0 25px 0 10px;
        background-position: right 10px center;
    }
    
    .sok-paging-btn {
        height: 40px;
        font-size: 13px;
        padding: 0 15px;
    }
    
    .sok-pagination a,
    .sok-pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 10px;
    }
}

/* 아주 작은 화면 (360px 이하) */
@media (max-width: 360px) {
    .sok-paging-select {
        min-width: 85px;
        max-width: 100px;
        font-size: 12px;
    }
    
    .sok-paging-btn {
        font-size: 12px;
        padding: 0 12px;
    }
}

/* ===================================
   CI Pagination 라이브러리 호환
   기존 클래스명도 지원 (하위 호환성)
   =================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 5px;
}

.pagination li {
    margin: 0;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: #f8f9fa;
    border-color: #b82647;
    color: #b82647;
}

.pagination .active a,
.pagination .active span {
    background: #b82647;
    border-color: #b82647;
    color: #fff;
    pointer-events: none;
}

.pagination .disabled a,
.pagination .disabled span {
    background: #f8f9fa;
    border-color: #e0e0e0;
    color: #999;
    pointer-events: none;
}