/**
 * 智能响应式分页组件 - 方案E
 * 
 * 特性：
 * - 桌面端：完整数字分页 + 快速跳转
 * - 移动端：简化上下翻页
 * - Gaming风格视觉设计
 * - 轻量级纯CSS实现（无JS依赖）
 */

/* ========================================
   分页容器
   ======================================== */
.smart-pagination {
    margin: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* 桌面端分页（默认显示） */
.smart-pagination .sp-desktop {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 移动端分页（默认隐藏） */
.smart-pagination .sp-mobile {
    display: none;
}

/* ========================================
   页码列表
   ======================================== */
.sp-pages {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ========================================
   页码项通用样式
   ======================================== */
.sp-item .sp-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    line-height: 1;
}

.sp-item .sp-link:hover:not(.disabled) {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* 当前激活页码 */
.sp-item.active .sp-link {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    pointer-events: none;
}

/* 禁用状态 */
.sp-item.disabled .sp-link {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* 省略号 */
.sp-ellipsis .sp-link {
    background: transparent;
    border: none;
    opacity: 0.5;
    cursor: default;
    min-width: 30px;
}

/* 首末页按钮图标稍小 */
.sp-first .sp-link,
.sp-last .sp-link {
    font-size: 13px;
}

/* ========================================
   快速跳转区域
   ======================================== */
.sp-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sp-jump-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

.sp-jump-input {
    width: 60px;
    height: 34px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

.sp-jump-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

.sp-jump-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
}

/* 移除数字输入框的上下箭头 */
.sp-jump-input::-webkit-inner-spin-button,
.sp-jump-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sp-jump-input[type=number] {
    -moz-appearance: textfield;
}

.sp-jump-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sp-jump-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sp-jump-btn:active {
    transform: scale(0.95);
}

/* ========================================
   移动端简化分页
   ======================================== */
.sp-mobile-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sp-mobile-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sp-mobile-btn:not(:disabled):hover {
    background: rgba(59, 130, 246, 0.15);
    color: #ffffff;
}

.sp-mobile-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sp-mobile-info {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    padding: 0 12px;
    white-space: nowrap;
}

/* ========================================
   响应式适配
   ======================================== */

/* 平板端：开始缩小间距和尺寸 */
@media (max-width: 991px) {
    .smart-pagination {
        margin: 30px 0;
        gap: 12px;
    }

    .smart-pagination .sp-desktop {
        gap: 12px;
    }

    .sp-pages {
        gap: 4px;
    }

    .sp-item .sp-link {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
        border-radius: 8px;
    }

    .sp-jump {
        padding: 6px 12px;
        gap: 6px;
    }

    .sp-jump-input {
        width: 54px;
        height: 30px;
        font-size: 13px;
    }

    .sp-jump-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

/* 移动端：切换到简化模式 */
@media (max-width: 767px) {
    .smart-pagination {
        margin: 24px 0;
        gap: 0;
    }

    /* 隐藏桌面端，显示移动端 */
    .smart-pagination .sp-desktop {
        display: none !important;
    }

    .smart-pagination .sp-mobile {
        display: block !important;
        width: 100%;
    }

    .sp-mobile-inner {
        max-width: 100%;
        padding: 10px 16px;
    }

    .sp-mobile-btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    .sp-mobile-info {
        font-size: 13px;
    }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
    .sp-mobile-inner {
        padding: 8px 12px;
        border-radius: 40px;
    }

    .sp-mobile-btn {
        font-size: 12px;
        padding: 8px 10px;
    }

    .sp-mobile-info {
        font-size: 12px;
        padding: 0 8px;
    }
}

/* ========================================
   暗色主题增强（可选）
   ======================================== */
@media (prefers-color-scheme: dark) {
    .sp-item .sp-link {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.08);
    }

    .sp-jump {
        background: rgba(255, 255, 255, 0.02);
        border-color: rgba(255, 255, 255, 0.06);
    }
}

/* ========================================
   动画效果（可选增强）
   ======================================== */

/* 页码切换时的微动画 */
@keyframes sp-page-enter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sp-item.active .sp-link {
    animation: sp-page-enter 0.3s ease-out;
}

/* 跳转按钮点击反馈 */
.sp-jump-btn:active {
    animation: sp-button-press 0.15s ease-out;
}

@keyframes sp-button-press {
    0% { transform: scale(1); }
    50% { transform: scale(0.92); }
    100% { transform: scale(1); }
}
