/* ========================================
   卡券选择页面增强样式
   优化图标和文字比例，提升视觉效果
   ======================================== */

/* ===== 卡券选择容器优化 ===== */
.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 16px;
    margin-bottom: 0;
    padding: 8px 0;
}

/* ===== 卡券项目优化 ===== */
.category-item {
    width: 128px;
    height: 88px;
    border-radius: 12px;
    border: 2px solid #f0f0f0;
    background: #fff;
    padding: 8px 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 悬停效果 */
.category-item:hover {
    border-color: #1890ff;
    background: linear-gradient(135deg, #f5faff 0%, #e6f7ff 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(24, 144, 255, 0.15);
}

.category-item:hover .card-type-logo {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* 选中状态 */
.category-item.active {
    border-color: #1890ff;
    background: linear-gradient(135deg, #e6f7ff 0%, #f0f9ff 100%);
    color: #1890ff;
    box-shadow: 0 4px 16px rgba(24, 144, 255, 0.25);
    transform: translateY(-1px);
}

.category-item.active .card-type-logo {
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.4);
}

/* ===== 卡券内容布局优化 ===== */
.card-type-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ===== 图标容器优化 ===== */
.card-logo-container {
    height: 52px;
    width: 52px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

/* ===== 图标样式优化 ===== */
.card-type-logo {
    max-height: 48px;
    max-width: 48px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

/* ===== 文字样式优化 ===== */
.card-type-name {
    font-size: 14px !important;
    min-height: 20px !important;
    text-align: center;
    width: 100%;
    color: #333;
    margin-top: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3 !important;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
    word-break: break-all;
    font-weight: 400 !important;
    position: relative;
    z-index: 2;
}

/* 只有文字的情况 */
.card-type-name.only-text {
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    min-height: 20px !important;
    height: auto;
    display: block;
    text-align: center;
    white-space: normal;
    word-break: break-all;
    padding: 0 8px;
    margin: auto 0;
    color: #333;
}

/* 选中状态文字颜色 */
.category-item.active .card-type-name {
    color: #1890ff;
    font-weight: 600;
}

/* ===== 移动端优化 ===== */
@media (max-width: 768px) {
    .category-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 4px 0;
    }
    
    .category-item {
        width: 100%;
        height: 84px;
        padding: 6px 4px;
        border-radius: 10px;
    }
    
    .card-logo-container {
        height: 44px;
        width: 44px;
        margin-bottom: 4px;
    }
    
    .card-type-logo {
        max-height: 40px;
        max-width: 40px;
        border-radius: 8px;
    }
    
    .card-type-name {
        font-size: 13px !important;
        min-height: 18px !important;
        line-height: 1.2 !important;
        font-weight: 400 !important;
    }
    
    .card-type-name.only-text {
        font-size: 14px !important;
        padding: 0 6px;
        font-weight: 500 !important;
    }
}

/* ===== 小屏幕优化 ===== */
@media (max-width: 480px) {
    .category-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .category-item {
        height: 80px;
    }
    
    .card-logo-container {
        height: 40px;
        width: 40px;
    }
    
    .card-type-logo {
        max-height: 36px;
        max-width: 36px;
    }
}

/* ===== 特殊效果 ===== */
/* 为不同类型的卡券添加微妙的背景色 */
.category-item[data-maintype="电商卡"] {
    border-color: #ff6b6b;
}

.category-item[data-maintype="电商卡"]:hover {
    border-color: #ff5252;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe6e6 100%);
}

.category-item[data-maintype="出行券"] {
    border-color: #4ecdc4;
}

.category-item[data-maintype="出行券"]:hover {
    border-color: #26a69a;
    background: linear-gradient(135deg, #f0fffe 0%, #e0f7f5 100%);
}

.category-item[data-maintype="美食券"] {
    border-color: #ffd93d;
}

.category-item[data-maintype="美食券"]:hover {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fffdf0 0%, #fff8e1 100%);
}

/* ===== 加载状态 ===== */
.category-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.category-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
