/* Hero 标题样式 - 更紧凑 */
.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.hero-title-primary {
    color: var(--gray-900);
}

.hero-title-secondary {
    color: var(--primary);
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--gray-600);
    margin-bottom: 0;
}

/* 搜索框样式 - 更紧凑 */
.search-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 1rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 800px;
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: 50px;
    padding: 0.4rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
}

.search-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(90, 103, 216, 0.15);
}

.search-icon-large {
    position: absolute;
    left: 1.2rem;
    color: var(--gray-500);
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.75rem 1rem 0.75rem 3rem;
    font-size: 0.95rem;
    color: var(--gray-900);
    background: transparent;
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.7rem 1.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    margin-left: 0.5rem;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(90, 103, 216, 0.3);
}

/* 表格优化 */
.table-modules {
    font-size: 0.9rem;
}

.table-modules thead th {
    padding: 0.75rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--gray-100);
    border-bottom: 2px solid var(--gray-300);
}

.table-modules tbody td {
    padding: 0.75rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
}

.table-modules tbody tr:hover {
    background: var(--gray-50);
}

/* 操作列按钮优化 */
.table-modules thead th:last-child {
    text-align: center !important;
}

.table-modules tbody td:last-child {
    width: 120px;
    min-width: 120px;
    text-align: center;
    padding: 0.75rem 0.5rem !important;
}

.action-btn {
    white-space: nowrap;
    min-width: 85px;
    width: 85px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.action-btn i {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.action-btn .btn-text {
    display: inline-block;
    min-width: 42px;
    text-align: center;
    flex-shrink: 0;
}


.module-name-cell {
    line-height: 1.4;
}

.module-name-cell strong {
    font-size: 0.95rem;
    color: var(--gray-900);
}

/* 简介显示优化 */
.module-description {
    position: relative;
}

.description-text {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.5;
    transition: all 0.3s ease;
}

.description-text.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.5em; /* 3行的高度 */
}

.description-text.expanded {
    display: block;
    max-height: none;
    -webkit-line-clamp: unset;
}

.btn-link-detail {
    background: none;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
    text-decoration: none;
    margin-top: 0.25rem;
}

.btn-link-detail:hover {
    color: var(--primary-dark) !important;
    text-decoration: underline;
}

.btn-link-detail i {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.btn-link-detail.expanded i {
    transform: rotate(180deg);
}

/* 简介显示优化 */
.module-description {
    position: relative;
}

.description-text {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.5;
    transition: all 0.3s ease;
}

.description-text.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.5em; /* 3行的高度 */
}

.description-text.expanded {
    display: block;
    max-height: none;
    -webkit-line-clamp: unset;
}

.btn-link-detail {
    background: none;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
    text-decoration: none;
}

.btn-link-detail:hover {
    color: var(--primary-dark) !important;
    text-decoration: underline;
}

.btn-link-detail i {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.btn-link-detail.expanded i {
    transform: rotate(180deg);
}

.module-name-cell .badge {
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
}

/* 图片可点击放大 */
.img-zoomable {
    transition: all 0.2s ease;
    border: 2px solid var(--gray-300);
}

.img-zoomable:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(90, 103, 216, 0.2);
    cursor: zoom-in;
}

/* 图片放大 Modal 的 z-index 要高于清单弹窗 */
#imageModal {
    z-index: 1060; /* Bootstrap modal 默认是 1055，这里设置更高 */
}

#imageModal .modal-backdrop {
    z-index: 1059;
}

/* 移动端卡片优化 - 紧凑布局 */
.module-card {
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.module-card-images {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.module-card-images img {
    width: 75px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--gray-300);
    cursor: zoom-in;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.module-card-images img:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.module-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0; /* 允许flex子元素收缩 */
    overflow: hidden; /* 防止内容溢出 */
}

.module-card-info > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: 0; /* 允许收缩 */
    gap: 0.5rem; /* 添加间距，防止按钮紧贴文字 */
}

.module-card-info > div > .flex-grow-1 {
    flex: 1;
    min-width: 0; /* 允许收缩 */
    overflow: hidden; /* 防止溢出 */
}

.module-card-info h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.15rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%; /* 确保不超过父容器 */
}

.module-card-info .text-muted {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-left: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap; /* 防止换行 */
}

/* 移动端操作按钮 */
.action-btn-mobile {
    white-space: nowrap;
    min-width: 65px;
    max-width: 65px; /* 固定最大宽度 */
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex-shrink: 0; /* 不允许收缩 */
    flex-grow: 0; /* 不允许扩展 */
}

.action-btn-mobile .btn-text {
    font-size: 0.7rem;
}

.action-btn-mobile i {
    font-size: 0.8rem;
}

.module-row.hidden,
.module-card-item.hidden,
.module-row.pagination-hidden,
.module-card-item.pagination-hidden {
    display: none !important;
}

/* 分页样式 */
.pagination-info {
    font-size: 0.875rem;
}

.pagination {
    margin: 0;
}

.pagination .page-link {
    color: var(--primary);
    border-color: var(--gray-300);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: var(--gray-500);
    pointer-events: none;
    background-color: var(--gray-100);
    border-color: var(--gray-300);
}

.pagination .page-link:hover:not(.disabled) {
    background-color: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.card-footer {
    padding: 0.75rem 1rem;
}

/* 移动端分页优化 */
@media (max-width: 768px) {
    .card-footer {
        padding: 0.5rem 0.75rem;
    }
    
    .pagination-info {
        font-size: 0.75rem;
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* 响应式 */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
    }
    
    .search-container {
        border-radius: 25px;
        padding: 0.3rem;
    }
    
    .search-input {
        padding: 0.65rem 0.75rem 0.65rem 2.5rem;
        font-size: 0.85rem;
    }
    
    .search-icon-large {
        left: 0.9rem;
        font-size: 1rem;
    }
    
    .search-btn {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
    }
    
    /* 移动端模块卡片优化 - 确保按钮不错位 */
    .module-card {
        gap: 0.5rem; /* 减小间距，为文字和按钮留出更多空间 */
    }
    
    .module-card-info > div {
        gap: 0.5rem; /* 确保名称和按钮之间有间距 */
    }
    
    .module-card-info h6 {
        font-size: 0.85rem; /* 稍微减小字体，留出更多空间 */
    }
    
    .action-btn-mobile {
        min-width: 60px; /* 移动端稍微减小按钮宽度 */
        max-width: 60px;
        padding: 0.3rem 0.4rem;
    }
}

/* 已选清单弹窗样式 */
.cart-modules-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-module-item {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cart-module-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.cart-module-content {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.cart-module-images {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cart-module-img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--gray-300);
    cursor: zoom-in;
    transition: all 0.2s ease;
}

.cart-module-img:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(90, 103, 216, 0.2);
}

.cart-image-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    font-weight: 500;
    text-align: center;
    margin-top: 0.25rem;
}

.cart-no-image {
    width: 80px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    gap: 0.25rem;
}

.cart-no-image i {
    font-size: 1.2rem;
}

.cart-no-image span {
    font-size: 0.65rem;
}

.cart-module-info {
    flex: 1;
    min-width: 0;
}

.cart-module-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.cart-module-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.cart-module-title h6 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    flex: 1;
    min-width: 0;
}

.cart-module-item .remove-item {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.cart-empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.cart-empty-state i {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.cart-empty-state p {
    color: var(--gray-500);
    margin: 0;
}

/* 手机端按钮优化 */
@media (max-width: 768px) {
    /* 首页按钮：只显示图标 */
    .cart-action-btn .cart-btn-text {
        display: none;
    }
    
    .cart-action-btn {
        padding: 0.3rem 0.4rem !important;
        min-width: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .cart-action-btn i {
        margin: 0 !important;
    }
    
    /* 弹窗优化 */
    #cartModal .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100% - 0.5rem);
    }
    
    #cartModal .modal-header {
        padding: 0.5rem 0.75rem;
    }
    
    #cartModal .modal-title {
        font-size: 0.9rem;
    }
    
    #cartModal .modal-body {
        padding: 0.5rem;
        max-height: 55vh;
    }
    
    .cart-modal-body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 弹窗按钮：紧凑布局，一行两个按钮 */
    .cart-modal-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
        white-space: nowrap;
        line-height: 1.3;
    }
    
    .cart-modal-btn .cart-modal-btn-text {
        display: inline-block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        font-size: 0.75rem;
    }
    
    .cart-modal-btn i {
        font-size: 0.8rem;
        flex-shrink: 0;
    }
    
    /* 弹窗底部按钮布局 - 一行两个按钮 */
    #cartModal .modal-footer {
        padding: 0.5rem 0.4rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: flex-start;
        align-items: stretch;
    }
    
    #cartModal .modal-footer .btn,
    #cartModal .modal-footer a.btn {
        flex: 0 0 calc(50% - 0.25rem);
        width: calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
        max-width: calc(50% - 0.25rem);
        box-sizing: border-box;
    }
    
    /* 超小屏幕进一步优化 */
    @media (max-width: 360px) {
        .cart-modal-btn {
            padding: 0.3rem 0.3rem;
            font-size: 0.65rem;
            gap: 0.15rem;
        }
        
        .cart-modal-btn .cart-modal-btn-text {
            font-size: 0.65rem;
        }
        
        .cart-modal-btn i {
            font-size: 0.7rem;
        }
        
        #cartModal .modal-footer {
            gap: 0.4rem;
            padding: 0.4rem 0.3rem;
        }
        
        #cartModal .modal-footer .btn,
        #cartModal .modal-footer a.btn {
            flex: 0 0 calc(50% - 0.2rem);
            width: calc(50% - 0.2rem);
            min-width: calc(50% - 0.2rem);
            max-width: calc(50% - 0.2rem);
        }
    }
    
    /* 关闭按钮在手机端显示X图标 */
    .cart-modal-close-icon {
        display: inline-block;
    }
    
    /* 桌面端关闭按钮不显示图标 */
    @media (min-width: 769px) {
        .cart-modal-close-icon {
            display: none;
        }
        
        #cartModal .modal-footer .btn {
            flex: 1;
            min-width: 0;
        }
        
        #cartModal .modal-footer .btn-secondary {
            flex: 1;
            min-width: 0;
        }
    }
    
    /* 弹窗内模块列表优化 - 紧凑布局 */
    .cart-modules-list {
        gap: 0.5rem;
    }
    
    .cart-module-item {
        padding: 0.6rem;
        margin-bottom: 0;
    }
    
    .cart-module-content {
        flex-direction: row;
        gap: 0.6rem;
        align-items: center;
    }
    
    .cart-module-images {
        flex-shrink: 0;
        gap: 0.4rem;
    }
    
    .cart-module-img {
        width: 60px;
        height: 45px;
    }
    
    .cart-no-image {
        width: 60px;
        height: 45px;
    }
    
    .cart-module-info {
        flex: 1;
        min-width: 0;
    }
    
    .cart-module-title {
        flex-wrap: nowrap;
        gap: 0.4rem;
        margin-bottom: 0.3rem;
        align-items: center;
        width: 100%;
    }
    
    .cart-module-number {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
        flex-shrink: 0;
    }
    
    .cart-module-title h6 {
        font-size: 0.85rem;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin: 0;
        order: 0;
        padding-right: 0.3rem;
    }
    
    .cart-module-item .remove-item {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
        order: 0;
        padding: 0;
        margin-left: auto;
    }
    
    /* 隐藏图片标签以节省空间 */
    .cart-image-label {
        display: none;
    }
    
    /* 弹窗标题优化 */
    #cartModal .modal-title {
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    #cartModal .modal-title i {
        font-size: 1rem;
    }
    
    #cartModal .modal-title .badge {
        font-size: 0.7rem;
        padding: 0.2em 0.5em;
    }
    
    /* 弹窗头部优化 */
    #cartModal .modal-header {
        border-bottom: 1px solid var(--gray-200);
    }
    
    /* 优化已选清单文字显示 */
    #cartModal .modal-title {
        word-break: break-word;
    }
}
}